From aff403aafb44da01a8018bbe466337679b209f33 Mon Sep 17 00:00:00 2001 From: Matt <4009945+MattBDev@users.noreply.github.com> Date: Thu, 24 Apr 2014 22:42:55 -0400 Subject: [PATCH 001/314] Fix Deprecation. --- .../com/github/lunatrius/schematica/Settings.java | 2 +- .../lunatrius/schematica/config/BlockInfo.java | 14 +++++++------- .../lunatrius/schematica/world/SchematicWorld.java | 8 ++++---- .../schematica/world/schematic/SchematicAlpha.java | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index 1be95437..4ccb6d59 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -137,7 +137,7 @@ public boolean saveSchematic(File directory, String filename, Vector3f from, Vec for (int x = minX; x <= maxX; x++) { for (int y = minY; y <= maxY; y++) { for (int z = minZ; z <= maxZ; z++) { - blocks[x - minX][y - minY][z - minZ] = (short) GameData.blockRegistry.getId(this.minecraft.theWorld.getBlock(x, y, z)); + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(this.minecraft.theWorld.getBlock(x, y, z)); metadata[x - minX][y - minY][z - minZ] = (byte) this.minecraft.theWorld.getBlockMetadata(x, y, z); tileEntity = this.minecraft.theWorld.getTileEntity(x, y, z); if (tileEntity != null) { diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 1d079a81..632b1336 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -64,7 +64,7 @@ private static boolean addIgnoredBlock(String blockName) { return false; } - return addIgnoredBlock(GameData.blockRegistry.get(String.format("%s:%s", modId, blockName))); + return addIgnoredBlock(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); } public static void populateIgnoredBlockMetadata() { @@ -155,7 +155,7 @@ private static boolean addIgnoredBlockMetadata(String blockName) { return false; } - return addIgnoredBlockMetadata(GameData.blockRegistry.get(String.format("%s:%s", modId, blockName))); + return addIgnoredBlockMetadata(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); } public static void populateBlockItemMap() { @@ -217,7 +217,7 @@ private static Item addBlockItemMapping(Object blockObj, Object itemObj) { if (blockObj instanceof Block) { block = (Block) blockObj; } else if (blockObj instanceof String) { - block = GameData.blockRegistry.get(String.format("%s:%s", modId, blockObj)); + block = GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockObj)); } if (itemObj instanceof Item) { @@ -226,9 +226,9 @@ private static Item addBlockItemMapping(Object blockObj, Object itemObj) { item = Item.getItemFromBlock((Block) itemObj); } else if (itemObj instanceof String) { String formattedName = String.format("%s:%s", modId, itemObj); - item = GameData.itemRegistry.get(formattedName); + item = GameData.getItemRegistry().getObject(formattedName); if (item == null) { - item = Item.getItemFromBlock(GameData.blockRegistry.get(formattedName)); + item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); } } @@ -312,9 +312,9 @@ public static PlacementData addPlacementMapping(Object itemObj, PlacementData da item = Item.getItemFromBlock((Block) itemObj); } else if (itemObj instanceof String) { String formattedName = String.format("%s:%s", modId, itemObj); - item = GameData.itemRegistry.get(formattedName); + item = GameData.getItemRegistry().getObject(formattedName); if (item == null) { - item = Item.getItemFromBlock(GameData.blockRegistry.get(formattedName)); + item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index fc164587..b0080cfc 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -130,12 +130,12 @@ public static ItemStack getIconFromName(String iconName) { } } - icon = new ItemStack(GameData.blockRegistry.get(name), 1, damage); + icon = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, damage); if (icon.getItem() != null) { return icon; } - icon = new ItemStack(GameData.itemRegistry.get(name), 1, damage); + icon = new ItemStack(GameData.getItemRegistry().getObject(name), 1, damage); if (icon.getItem() != null) { return icon; } @@ -268,12 +268,12 @@ private int getBlockId(int x, int y, int z) { } public Block getBlockRaw(int x, int y, int z) { - return GameData.blockRegistry.get(getBlockIdRaw(x, y, z)); + return GameData.getBlockRegistry().getRaw(getBlockIdRaw(x, y, z)); } @Override public Block getBlock(int x, int y, int z) { - return GameData.blockRegistry.get(getBlockId(x, y, z)); + return GameData.getBlockRegistry().getObjectById(getBlockId(x, y, z)); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index d693b38f..03ba70c3 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -116,10 +116,10 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } catch (Exception e) { int pos = tileEntity.xCoord + (tileEntity.yCoord * world.getLength() + tileEntity.zCoord) * world.getWidth(); if (--count > 0) { - Block block = GameData.blockRegistry.get(localBlocks[pos]); - Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? GameData.blockRegistry.getNameForObject(block) : "?", tileEntity.getClass().getName()), e); + Block block = GameData.getBlockRegistry().getObjectById(localBlocks[pos]); + Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? GameData.getBlockRegistry().getNameForObject(block) : "?", tileEntity.getClass().getName()), e); } - localBlocks[pos] = (byte) GameData.blockRegistry.getId(Blocks.bedrock); + localBlocks[pos] = (byte) GameData.getBlockRegistry().getId(Blocks.bedrock); localMetadata[pos] = 0; extraBlocks[pos] = 0; } From 9358cc563be44e387d7563146e3a68e5745465d6 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 26 Apr 2014 22:55:28 +0200 Subject: [PATCH 002/314] Get the block from the world instead of the lower 8 bits only. --- .../lunatrius/schematica/world/schematic/SchematicAlpha.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 03ba70c3..cbc88326 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -116,7 +116,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } catch (Exception e) { int pos = tileEntity.xCoord + (tileEntity.yCoord * world.getLength() + tileEntity.zCoord) * world.getWidth(); if (--count > 0) { - Block block = GameData.getBlockRegistry().getObjectById(localBlocks[pos]); + Block block = world.getBlockRaw(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? GameData.getBlockRegistry().getNameForObject(block) : "?", tileEntity.getClass().getName()), e); } localBlocks[pos] = (byte) GameData.getBlockRegistry().getId(Blocks.bedrock); From 40a2af37e9dfc56fee8bf68773c31f5f1e5ce8ea Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 26 Apr 2014 22:56:57 +0200 Subject: [PATCH 003/314] Removed code that will not be used (thanks @MattBDev). --- .../com/github/lunatrius/schematica/world/SchematicWorld.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index b0080cfc..ee6a6f45 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -41,10 +41,6 @@ import java.util.List; public class SchematicWorld extends World { - public class SchematicWorldRendererData { - public boolean foobar; - } - // private static final AnvilSaveHandler SAVE_HANDLER = new AnvilSaveHandler(Minecraft.getMinecraft().mcDataDir, "tmp/schematica", false); private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); private static final Comparator BLOCK_COMPARATOR = new Comparator() { From e0001c9f799874ef637458caf13c74389b587ce4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 9 May 2014 23:14:03 +0200 Subject: [PATCH 004/314] Prevent a possible NPE. --- .../client/gui/GuiSchematicLoad.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 2ce013c8..e2be67c9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -118,19 +118,29 @@ protected void reloadSchematics() { Reference.logger.error("Failed to add GuiSchematicEntry!", e); } - for (File file : this.currentDirectory.listFiles(FILE_FILTER_FOLDER)) { - name = file.getName(); + File[] filesFolders = this.currentDirectory.listFiles(FILE_FILTER_FOLDER); + if (filesFolders == null) { + Reference.logger.error(String.format("listFiles returned null (directory: %s)!", this.currentDirectory)); + } else { + for (File file : filesFolders) { + if (file == null) { + continue; + } - item = file == null || file.listFiles() == null || file.listFiles().length == 0 ? Items.bucket : Items.water_bucket; + name = file.getName(); - this.schematicFiles.add(new GuiSchematicEntry(name, item, 0, file.isDirectory())); + File[] files = file.listFiles(); + item = (files == null || files.length == 0) ? Items.bucket : Items.water_bucket; + + this.schematicFiles.add(new GuiSchematicEntry(name, item, 0, file.isDirectory())); + } } - File[] files = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); - if (files.length == 0) { + File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); + if (filesSchematics == null || filesSchematics.length == 0) { this.schematicFiles.add(new GuiSchematicEntry(I18n.format("schematica.gui.noschematic"), Blocks.dirt, 0, false)); } else { - for (File file : files) { + for (File file : filesSchematics) { name = file.getName(); this.schematicFiles.add(new GuiSchematicEntry(name, SchematicWorld.getIconFromFile(file), file.isDirectory())); From 0f5e661a79b750058903b330fe45aa7a03bf26a4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 May 2014 23:16:31 +0200 Subject: [PATCH 005/314] Fixed NPE (I blame @MattBDev :P). --- .../com/github/lunatrius/schematica/world/SchematicWorld.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index ee6a6f45..ae0190fd 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -264,7 +264,7 @@ private int getBlockId(int x, int y, int z) { } public Block getBlockRaw(int x, int y, int z) { - return GameData.getBlockRegistry().getRaw(getBlockIdRaw(x, y, z)); + return GameData.getBlockRegistry().getObjectById(getBlockIdRaw(x, y, z)); } @Override From 17d2f892a57c1e3ad18a2f53fec1c20baaa7bdb2 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 May 2014 23:44:58 +0200 Subject: [PATCH 006/314] Replaced vectors from LWJGL with vectors from the core. --- .../github/lunatrius/schematica/Settings.java | 4 ++-- .../client/renderer/RenderHelper.java | 2 +- .../renderer/RendererSchematicChunk.java | 2 +- .../RendererSchematicChunkSorter.java | 5 ++--- .../renderer/RendererSchematicGlobal.java | 22 +++++++++---------- .../schematica/world/SchematicWorld.java | 2 +- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index 4ccb6d59..7f9ef817 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -13,7 +14,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.ChunkCache; import net.minecraftforge.common.util.ForgeDirection; -import org.lwjgl.util.vector.Vector3f; import java.io.File; import java.io.FileInputStream; @@ -177,7 +177,7 @@ public boolean saveSchematic(File directory, String filename, Vector3f from, Vec } public Vector3f getTranslationVector() { - Vector3f.sub(this.playerPosition, this.offset, this.translationVector); + this.translationVector.set(this.playerPosition).sub(this.offset); return this.translationVector; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java index f60cea25..0958f568 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java @@ -1,8 +1,8 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.lib.Reference; import org.lwjgl.BufferUtils; -import org.lwjgl.util.vector.Vector3f; import java.nio.FloatBuffer; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 16950229..f2eadd6c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -19,7 +20,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; -import org.lwjgl.util.vector.Vector3f; import java.lang.reflect.Field; import java.util.ArrayList; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java index fc2aa2d7..b106c60e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.Settings; -import org.lwjgl.util.vector.Vector3f; import java.util.Comparator; @@ -14,8 +14,7 @@ public int doCompare(RendererSchematicChunk par1RendererSchematicChunk, Renderer } else if (!par1RendererSchematicChunk.isInFrustrum && par2RendererSchematicChunk.isInFrustrum) { return 1; } else { - Vector3f position = new Vector3f(); - Vector3f.sub(this.settings.playerPosition, this.settings.offset, position); + Vector3f position = this.settings.playerPosition.clone().sub(this.settings.offset); double dist1 = par1RendererSchematicChunk.distanceToPoint(position); double dist2 = par2RendererSchematicChunk.distanceToPoint(position); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 577c7bb3..87b3f101 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -13,7 +14,6 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; -import org.lwjgl.util.vector.Vector3f; import java.util.Collections; @@ -105,23 +105,21 @@ public void render(SchematicWorld schematic) { } if (this.settings.isRenderingGuide) { - Vector3f start = new Vector3f(); - Vector3f end = new Vector3f(); + Vector3f start; + Vector3f end; - Vector3f.sub(this.settings.pointMin, this.settings.offset, start); - Vector3f.sub(this.settings.pointMax, this.settings.offset, end); - end.translate(1, 1, 1); + start = this.settings.pointMin.clone().sub(this.settings.offset); + end = this.settings.pointMax.clone().sub(this.settings.offset); + end.add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); - Vector3f.sub(this.settings.pointA, this.settings.offset, start); - Vector3f.sub(this.settings.pointA, this.settings.offset, end); - end.translate(1, 1, 1); + start = this.settings.pointA.clone().sub(this.settings.offset); + end = start.clone().add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - Vector3f.sub(this.settings.pointB, this.settings.offset, start); - Vector3f.sub(this.settings.pointB, this.settings.offset, end); - end.translate(1, 1, 1); + start = this.settings.pointB.clone().sub(this.settings.offset); + end = start.clone().add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index ae0190fd..a6ae68ef 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.world; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.lib.Reference; import cpw.mods.fml.common.registry.GameData; @@ -30,7 +31,6 @@ import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.storage.SaveHandlerMP; import net.minecraftforge.common.util.ForgeDirection; -import org.lwjgl.util.vector.Vector3f; import java.io.File; import java.io.FileInputStream; From d555763a3a90575a8f7b76574413c58334dff423 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 14 May 2014 00:02:17 +0200 Subject: [PATCH 007/314] Moved ItemStack renderer into a helper class. --- .../github/lunatrius/schematica/Settings.java | 3 -- .../schematica/client/gui/GuiHelper.java | 39 +++++++++++++++++++ .../client/gui/GuiSchematicLoadSlot.java | 31 +-------------- .../client/gui/GuiSchematicMaterialsSlot.java | 30 +------------- 4 files changed, 41 insertions(+), 62 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index 7f9ef817..d16b381d 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -8,7 +8,6 @@ import cpw.mods.fml.common.registry.GameData; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -24,8 +23,6 @@ public class Settings { public static final Settings instance = new Settings(); - public static final RenderItem renderItem = new RenderItem(); - private final Vector3f translationVector = new Vector3f(); public Minecraft minecraft = Minecraft.getMinecraft(); public ChunkCache mcWorldCache = null; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java new file mode 100644 index 00000000..354d93a9 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java @@ -0,0 +1,39 @@ +package com.github.lunatrius.schematica.client.gui; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiHelper { + private static final RenderItem renderItem = new RenderItem(); + + public static void drawItemStack(TextureManager textureManager, FontRenderer fontRenderer, int x, int y, ItemStack itemStack) { + drawItemStackSlot(textureManager, x, y); + + if (itemStack != null && itemStack.getItem() != null) { + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + renderItem.renderItemIntoGUI(fontRenderer, textureManager, itemStack, x + 2, y + 2); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + } + + public static void drawItemStackSlot(TextureManager textureManager, int x, int y) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + textureManager.bindTexture(Gui.statIcons); + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125f, 18 * 0.0078125f); + tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125f, 18 * 0.0078125f); + tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125f, 0 * 0.0078125f); + tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125f, 0 * 0.0078125f); + tessellator.draw(); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java index 034a6222..fa70afcc 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java @@ -2,14 +2,9 @@ import com.github.lunatrius.schematica.Settings; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiSlot; -import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; public class GuiSchematicLoadSlot extends GuiSlot { private final Settings settings = Settings.instance; @@ -69,32 +64,8 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); } - drawItemStack(x, y, schematic.getItemStack()); + GuiHelper.drawItemStack(this.renderEngine, this.fontRenderer, x, y, schematic.getItemStack()); this.guiSchematicLoad.drawString(this.settings.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); } - - private void drawItemStack(int x, int y, ItemStack itemStack) { - drawItemStackSlot(x, y); - - if (itemStack != null) { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - RenderHelper.enableGUIStandardItemLighting(); - Settings.renderItem.renderItemIntoGUI(this.fontRenderer, this.renderEngine, itemStack, x + 2, y + 2); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - } - - private void drawItemStackSlot(int x, int y) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.renderEngine.bindTexture(Gui.statIcons); - Tessellator var10 = Tessellator.instance; - var10.startDrawingQuads(); - var10.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125F, 18 * 0.0078125F); - var10.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125F, 18 * 0.0078125F); - var10.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125F, 0 * 0.0078125F); - var10.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125F, 0 * 0.0078125F); - var10.draw(); - } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index dec0499f..29b19f91 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -3,14 +3,10 @@ import com.github.lunatrius.schematica.Settings; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiSlot; -import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; class GuiSchematicMaterialsSlot extends GuiSlot { private final FontRenderer fontRenderer = Settings.instance.minecraft.fontRenderer; @@ -62,33 +58,9 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat itemName = "Unknown"; } - drawItemStack(x, y, itemStack); + GuiHelper.drawItemStack(this.renderEngine, this.fontRenderer, x, y, itemStack); this.guiSchematicMaterials.drawString(this.fontRenderer, itemName, x + 24, y + 6, 16777215); this.guiSchematicMaterials.drawString(this.fontRenderer, amount, x + 215 - this.fontRenderer.getStringWidth(amount), y + 6, 16777215); } - - private void drawItemStack(int x, int y, ItemStack itemStack) { - drawItemStackSlot(x, y); - - if (itemStack != null && itemStack.getItem() != null) { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - RenderHelper.enableGUIStandardItemLighting(); - Settings.renderItem.renderItemIntoGUI(this.fontRenderer, this.renderEngine, itemStack, x + 2, y + 2); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - } - - private void drawItemStackSlot(int x, int y) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.renderEngine.bindTexture(Gui.statIcons); - Tessellator var10 = Tessellator.instance; - var10.startDrawingQuads(); - var10.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125F, 18 * 0.0078125F); - var10.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125F, 18 * 0.0078125F); - var10.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125F, 0 * 0.0078125F); - var10.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125F, 0 * 0.0078125F); - var10.draw(); - } } From 881b0ba9f3cbde45db325e83c4ad4a06b3c4a404 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 14 May 2014 23:24:10 +0200 Subject: [PATCH 008/314] Added minimum required forge version. --- build.gradle | 1 + build.properties | 1 + src/main/resources/mcmod.info | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 743b801b..27c116da 100644 --- a/build.gradle +++ b/build.gradle @@ -75,6 +75,7 @@ processResources { "version": modversion, "mcversion": config.version.minecraft, "forgeversion": config.version.forge, + "minforgeversion": config.version.minforge ?: config.version.forge, "coreversion": config.version.lunatriuscore ]) } diff --git a/build.properties b/build.properties index 1e8d1d88..ccd25c0b 100644 --- a/build.properties +++ b/build.properties @@ -3,6 +3,7 @@ version.minor=6 version.micro=1 version.minecraft=1.7.2 version.forge=10.12.1.1060 +version.minforge=10.12.0.1056 version.lunatriuscore=1.0.2.7 mod.id=Schematica diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index db714cbc..261f444a 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -12,9 +12,9 @@ ], "credits": "AbrarSyed, UltraMoogleMan", "dependants": [ ], - "dependencies": [ "LunatriusCore@[${coreversion},)" ], + "dependencies": [ "Forge@[${minforgeversion},)", "LunatriusCore@[${coreversion},)" ], "parent": "", - "requiredMods": [ "LunatriusCore@[${coreversion},)" ], + "requiredMods": [ "Forge@[${minforgeversion},)", "LunatriusCore@[${coreversion},)" ], "logoFile": "/assets/schematica/logo.png", "screenshots": [ ], "updateUrl": "http://mc.lunatri.us/", From 3d0d6ee81c6fd2c9f5d7fc5e69010cb0a4f322e2 Mon Sep 17 00:00:00 2001 From: Anton Date: Sun, 18 May 2014 17:07:42 +0400 Subject: [PATCH 009/314] Update ru_RU.lang --- src/main/resources/assets/schematica/lang/ru_RU.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 16350a0c..762c7877 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -1,7 +1,7 @@ # GUI schematica.gui.openFolder=Открыть папку со схемами schematica.gui.done=Готово -schematica.gui.title=Выберите файл Schematic +schematica.gui.title=Выберите файл схемы schematica.gui.folderInfo=(Место хранения схем) schematica.gui.noschematic=-- Нет схем -- schematica.gui.increase=+ @@ -18,7 +18,7 @@ schematica.gui.layers=Слои schematica.gui.operations=Операции schematica.gui.point.red=Красная точка schematica.gui.point.blue=Синяя точка -schematica.gui.saveselection=Сохранить схему выделенной области. +schematica.gui.saveselection=Сохранить схему выделенной области schematica.gui.enable=Включить schematica.gui.disable=Выключить schematica.gui.x=X: @@ -30,7 +30,7 @@ schematica.gui.materialamount=Количество schematica.gui.printer=Принтер # Keys -# schematica.key.category=Schematica +schematica.key.category=Schematica schematica.key.load=Загрузить схему schematica.key.save=Сохранить схему schematica.key.control=Манипулирование схемой From 38886f3631688c1371dffa5f4af4b346ed3836cc Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 21 May 2014 17:57:55 +0200 Subject: [PATCH 010/314] Fixed a possible NPE. --- .../java/com/github/lunatrius/schematica/SchematicPrinter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index fd76b1b3..1eda98ed 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -283,7 +283,7 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player } } - if (itemStack.stackSize == 0 && success) { + if (itemStack != null && itemStack.stackSize == 0 && success) { player.inventory.mainInventory[player.inventory.currentItem] = null; } From ca3bcf55c239c972d3e787a2d85dc3c21a8c5678 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 24 May 2014 16:16:45 +0200 Subject: [PATCH 011/314] Make sure to unset the checked flag for chests. --- .../com/github/lunatrius/schematica/world/SchematicWorld.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index a6ae68ef..6d154f35 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -442,7 +442,9 @@ public void refreshChests() { tileEntity = this.tileEntities.get(i); if (tileEntity instanceof TileEntityChest) { - ((TileEntityChest) tileEntity).checkForAdjacentChests(); + TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; + tileEntityChest.adjacentChestChecked = false; + tileEntityChest.checkForAdjacentChests(); } } } From 4fd64a4fbd194045b067089c23537bc7b2b28120 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 24 May 2014 16:23:45 +0200 Subject: [PATCH 012/314] Replace loops with the iterator version. --- .../lunatrius/schematica/world/SchematicWorld.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 6d154f35..4ab08db7 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -274,8 +274,7 @@ public Block getBlock(int x, int y, int z) { @Override public TileEntity getTileEntity(int x, int y, int z) { - for (int i = 0; i < this.tileEntities.size(); i++) { - TileEntity tileEntity = this.tileEntities.get(i); + for (TileEntity tileEntity : this.tileEntities) { if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { return tileEntity; } @@ -437,10 +436,7 @@ public void incrementRenderingLayer() { } public void refreshChests() { - TileEntity tileEntity; - for (int i = 0; i < this.tileEntities.size(); i++) { - tileEntity = this.tileEntities.get(i); - + for (TileEntity tileEntity : this.tileEntities) { if (tileEntity instanceof TileEntityChest) { TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; tileEntityChest.adjacentChestChecked = false; @@ -511,10 +507,8 @@ public void rotate() { this.blocks = localBlocks; this.metadata = localMetadata; - TileEntity tileEntity; int coord; - for (int i = 0; i < this.tileEntities.size(); i++) { - tileEntity = this.tileEntities.get(i); + for (TileEntity tileEntity : this.tileEntities) { coord = tileEntity.zCoord; tileEntity.zCoord = tileEntity.xCoord; tileEntity.xCoord = this.length - 1 - coord; From 6f7b64e880da36b2193fbe94352b3ef37b2b9c9a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 24 May 2014 17:23:09 +0200 Subject: [PATCH 013/314] Removed ChunkCache. Not even sure why it was in the code... --- .../com/github/lunatrius/schematica/Settings.java | 13 ------------- .../schematica/client/gui/GuiSchematicControl.java | 6 ------ .../schematica/client/gui/GuiSchematicSave.java | 12 ++++++------ .../client/renderer/RendererSchematicChunk.java | 4 ++-- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index d16b381d..f9422309 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -11,7 +11,6 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkCache; import net.minecraftforge.common.util.ForgeDirection; import java.io.File; @@ -25,7 +24,6 @@ public class Settings { private final Vector3f translationVector = new Vector3f(); public Minecraft minecraft = Minecraft.getMinecraft(); - public ChunkCache mcWorldCache = null; public Vector3f playerPosition = new Vector3f(); public final List sortedRendererSchematicChunk = new ArrayList(); public RenderBlocks renderBlocks = null; @@ -56,7 +54,6 @@ public void reset() { this.isRenderingGuide = false; Schematica.proxy.setActiveSchematic(null); this.renderBlocks = null; - this.mcWorldCache = null; while (this.sortedRendererSchematicChunk.size() > 0) { this.sortedRendererSchematicChunk.remove(0).delete(); } @@ -256,16 +253,6 @@ public void moveHere() { this.offset.z += 1; break; } - - reloadChunkCache(); - } - } - - public void reloadChunkCache() { - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (schematic != null) { - this.mcWorldCache = new ChunkCache(this.minecraft.theWorld, (int) this.offset.x - 1, (int) this.offset.y - 1, (int) this.offset.z - 1, (int) this.offset.x + schematic.getWidth() + 1, (int) this.offset.y + schematic.getHeight() + 1, (int) this.offset.z + schematic.getLength() + 1, 0); - refreshSchematic(); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 746e4e98..6396ec58 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -138,28 +138,22 @@ protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDecX.id) { this.settings.offset.x -= this.settings.increments[this.incrementX]; - this.settings.reloadChunkCache(); } else if (guiButton.id == this.btnIncX.id) { this.settings.offset.x += this.settings.increments[this.incrementX]; - this.settings.reloadChunkCache(); } else if (guiButton.id == this.btnAmountX.id) { this.incrementX = (this.incrementX + 1) % this.settings.increments.length; this.btnAmountX.displayString = Integer.toString(this.settings.increments[this.incrementX]); } else if (guiButton.id == this.btnDecY.id) { this.settings.offset.y -= this.settings.increments[this.incrementY]; - this.settings.reloadChunkCache(); } else if (guiButton.id == this.btnIncY.id) { this.settings.offset.y += this.settings.increments[this.incrementY]; - this.settings.reloadChunkCache(); } else if (guiButton.id == this.btnAmountY.id) { this.incrementY = (this.incrementY + 1) % this.settings.increments.length; this.btnAmountY.displayString = Integer.toString(this.settings.increments[this.incrementY]); } else if (guiButton.id == this.btnDecZ.id) { this.settings.offset.z -= this.settings.increments[this.incrementZ]; - this.settings.reloadChunkCache(); } else if (guiButton.id == this.btnIncZ.id) { this.settings.offset.z += this.settings.increments[this.incrementZ]; - this.settings.reloadChunkCache(); } else if (guiButton.id == this.btnAmountZ.id) { this.incrementZ = (this.incrementZ + 1) % this.settings.increments.length; this.btnAmountZ.displayString = Integer.toString(this.settings.increments[this.incrementZ]); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 1ebdfa0e..5d0769cb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -226,16 +226,16 @@ protected void actionPerformed(GuiButton guiButton) { } @Override - protected void mouseClicked(int par1, int par2, int par3) { - this.tfFilename.mouseClicked(par1, par2, par3); - super.mouseClicked(par1, par2, par3); + protected void mouseClicked(int x, int y, int action) { + this.tfFilename.mouseClicked(x, y, action); + super.mouseClicked(x, y, action); } @Override - protected void keyTyped(char par1, int par2) { - this.tfFilename.textboxKeyTyped(par1, par2); + protected void keyTyped(char character, int code) { + this.tfFilename.textboxKeyTyped(character, code); this.filename = this.tfFilename.getText(); - super.keyTyped(par1, par2); + super.keyTyped(character, code); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index f2eadd6c..35f65227 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -219,7 +219,7 @@ public void render(int renderPass) { } public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { - IBlockAccess mcWorld = this.settings.mcWorldCache; + IBlockAccess mcWorld = this.minecraft.theWorld; RenderBlocks renderBlocks = this.settings.renderBlocks; int x, y, z, wx, wy, wz; @@ -338,7 +338,7 @@ public void renderTileEntities(int renderPass) { return; } - IBlockAccess mcWorld = this.settings.mcWorldCache; + IBlockAccess mcWorld = this.minecraft.theWorld; int x, y, z; Block mcBlock; From debe287e85b5f1a0e58eb8bd9ea880589568ab3a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 8 Jun 2014 22:45:44 +0200 Subject: [PATCH 014/314] Make sure the schematic can be saved even if some blocks "refuse" to save. --- .../github/lunatrius/schematica/Settings.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index f9422309..cbb50f7f 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -8,6 +8,7 @@ import cpw.mods.fml.common.registry.GameData; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.init.Blocks; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -135,14 +136,20 @@ public boolean saveSchematic(File directory, String filename, Vector3f from, Vec metadata[x - minX][y - minY][z - minZ] = (byte) this.minecraft.theWorld.getBlockMetadata(x, y, z); tileEntity = this.minecraft.theWorld.getTileEntity(x, y, z); if (tileEntity != null) { - tileEntityNBT = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityNBT); - - tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); - tileEntity.xCoord -= minX; - tileEntity.yCoord -= minY; - tileEntity.zCoord -= minZ; - tileEntities.add(tileEntity); + try { + tileEntityNBT = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityNBT); + + tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); + tileEntity.xCoord -= minX; + tileEntity.yCoord -= minY; + tileEntity.zCoord -= minZ; + tileEntities.add(tileEntity); + } catch (Exception e) { + Reference.logger.error("Error while trying to save tile entity " + tileEntity + "!", e); + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); + metadata[x - minX][y - minY][z - minZ] = 0; + } } } } From 86870f3b4a2caee8191b9a17f2fb45d26c59d8d5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Jun 2014 02:57:23 +0200 Subject: [PATCH 015/314] Save block mapping to schematic files for cross save compatibility. --- .../world/schematic/SchematicAlpha.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index cbc88326..3302a2c8 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -12,7 +12,10 @@ import net.minecraftforge.common.util.Constants; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; public class SchematicAlpha extends SchematicFormat { @Override @@ -43,6 +46,16 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { short[][][] blocks = new short[width][height][length]; byte[][][] metadata = new byte[width][height][length]; + Short id = null; + Map oldToNew = new HashMap(); + if (tagCompound.hasKey("SchematicaMapping")) { + NBTTagCompound mapping = tagCompound.getCompoundTag("SchematicaMapping"); + Set names = mapping.func_150296_c(); + for (String name : names) { + oldToNew.put(mapping.getShort(name), (short) GameData.getBlockRegistry().getId(name)); + } + } + for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < length; z++) { @@ -51,6 +64,9 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { if (extra) { blocks[x][y][z] |= ((extraBlocks[x + (y * length + z) * width]) & 0xFF) << 8; } + if ((id = oldToNew.get(blocks[x][y][z])) != null) { + blocks[x][y][z] = id; + } } } } @@ -85,6 +101,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { byte extraBlocks[] = new byte[size]; byte extraBlocksNibble[] = new byte[(int) Math.ceil(size / 2.0)]; boolean extra = false; + NBTTagCompound mapping = new NBTTagCompound(); for (int x = 0; x < world.getWidth(); x++) { for (int y = 0; y < world.getHeight(); y++) { @@ -94,6 +111,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { if ((extraBlocks[x + (y * world.getLength() + z) * world.getWidth()] = (byte) (world.getBlockIdRaw(x, y, z) >> 8)) > 0) { extra = true; } + mapping.setShort(GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)), (short) world.getBlockIdRaw(x, y, z)); } } } @@ -133,6 +151,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } tagCompound.setTag("Entities", new NBTTagList()); tagCompound.setTag("TileEntities", tileEntitiesList); + tagCompound.setTag("SchematicaMapping", mapping); return true; } From 8d8bc30029071cbb4875de2bcab3b406f6a5b580 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Jun 2014 04:32:43 +0200 Subject: [PATCH 016/314] Extract all constants. --- .../world/schematic/SchematicAlpha.java | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 3302a2c8..2e827333 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -18,38 +18,52 @@ import java.util.Set; public class SchematicAlpha extends SchematicFormat { + public static final String ICON = "Icon"; + public static final String BLOCKS = "Blocks"; + public static final String DATA = "Data"; + public static final String ADD_BLOCKS = "AddBlocks"; + public static final String ADD_BLOCKS_SCHEMATICA = "Add"; + public static final String WIDTH = "Width"; + public static final String LENGTH = "Length"; + public static final String HEIGHT = "Height"; + public static final String MATERIALS = "Materials"; + public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it + public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; + public static final String TILE_ENTITIES = "TileEntities"; + public static final String ENTITIES = "Entities"; + @Override public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { ItemStack icon = SchematicWorld.getIconFromNBT(tagCompound); - byte localBlocks[] = tagCompound.getByteArray("Blocks"); - byte localMetadata[] = tagCompound.getByteArray("Data"); + byte localBlocks[] = tagCompound.getByteArray(BLOCKS); + byte localMetadata[] = tagCompound.getByteArray(DATA); - boolean extra = tagCompound.hasKey("Add") || tagCompound.hasKey("AddBlocks"); + boolean extra = tagCompound.hasKey(ADD_BLOCKS_SCHEMATICA) || tagCompound.hasKey(ADD_BLOCKS); byte extraBlocks[] = null; byte extraBlocksNibble[] = null; - if (tagCompound.hasKey("AddBlocks")) { - extraBlocksNibble = tagCompound.getByteArray("AddBlocks"); + if (tagCompound.hasKey(ADD_BLOCKS)) { + extraBlocksNibble = tagCompound.getByteArray(ADD_BLOCKS); extraBlocks = new byte[extraBlocksNibble.length * 2]; for (int i = 0; i < extraBlocksNibble.length; i++) { extraBlocks[i * 2 + 0] = (byte) ((extraBlocksNibble[i] >> 4) & 0xF); extraBlocks[i * 2 + 1] = (byte) (extraBlocksNibble[i] & 0xF); } - } else if (tagCompound.hasKey("Add")) { - extraBlocks = tagCompound.getByteArray("Add"); + } else if (tagCompound.hasKey(ADD_BLOCKS_SCHEMATICA)) { + extraBlocks = tagCompound.getByteArray(ADD_BLOCKS_SCHEMATICA); } - short width = tagCompound.getShort("Width"); - short length = tagCompound.getShort("Length"); - short height = tagCompound.getShort("Height"); + short width = tagCompound.getShort(WIDTH); + short length = tagCompound.getShort(LENGTH); + short height = tagCompound.getShort(HEIGHT); short[][][] blocks = new short[width][height][length]; byte[][][] metadata = new byte[width][height][length]; Short id = null; Map oldToNew = new HashMap(); - if (tagCompound.hasKey("SchematicaMapping")) { - NBTTagCompound mapping = tagCompound.getCompoundTag("SchematicaMapping"); + if (tagCompound.hasKey(MAPPING_SCHEMATICA)) { + NBTTagCompound mapping = tagCompound.getCompoundTag(MAPPING_SCHEMATICA); Set names = mapping.func_150296_c(); for (String name : names) { oldToNew.put(mapping.getShort(name), (short) GameData.getBlockRegistry().getId(name)); @@ -72,7 +86,7 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { } List tileEntities = new ArrayList(); - NBTTagList tileEntitiesList = tagCompound.getTagList("TileEntities", Constants.NBT.TAG_COMPOUND); + NBTTagList tileEntitiesList = tagCompound.getTagList(TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tileEntitiesList.tagCount(); i++) { TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); @@ -89,11 +103,11 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { NBTTagCompound tagCompoundIcon = new NBTTagCompound(); ItemStack icon = world.getIcon(); icon.writeToNBT(tagCompoundIcon); - tagCompound.setTag("Icon", tagCompoundIcon); + tagCompound.setTag(ICON, tagCompoundIcon); - tagCompound.setShort("Width", (short) world.getWidth()); - tagCompound.setShort("Length", (short) world.getLength()); - tagCompound.setShort("Height", (short) world.getHeight()); + tagCompound.setShort(WIDTH, (short) world.getWidth()); + tagCompound.setShort(LENGTH, (short) world.getLength()); + tagCompound.setShort(HEIGHT, (short) world.getHeight()); int size = world.getWidth() * world.getLength() * world.getHeight(); byte localBlocks[] = new byte[size]; @@ -143,15 +157,15 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } } - tagCompound.setString("Materials", "Alpha"); - tagCompound.setByteArray("Blocks", localBlocks); - tagCompound.setByteArray("Data", localMetadata); + tagCompound.setString(MATERIALS, FORMAT_ALPHA); + tagCompound.setByteArray(BLOCKS, localBlocks); + tagCompound.setByteArray(DATA, localMetadata); if (extra) { - tagCompound.setByteArray("AddBlocks", extraBlocksNibble); + tagCompound.setByteArray(ADD_BLOCKS, extraBlocksNibble); } - tagCompound.setTag("Entities", new NBTTagList()); - tagCompound.setTag("TileEntities", tileEntitiesList); - tagCompound.setTag("SchematicaMapping", mapping); + tagCompound.setTag(ENTITIES, new NBTTagList()); + tagCompound.setTag(TILE_ENTITIES, tileEntitiesList); + tagCompound.setTag(MAPPING_SCHEMATICA, mapping); return true; } From 9120494c1e8947526afe5171f870876d7413b5f1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Jun 2014 04:43:27 +0200 Subject: [PATCH 017/314] Minor optimizations when saving/loading schematic files. --- .../world/schematic/SchematicAlpha.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 2e827333..a688df85 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -39,10 +39,11 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { byte localBlocks[] = tagCompound.getByteArray(BLOCKS); byte localMetadata[] = tagCompound.getByteArray(DATA); - boolean extra = tagCompound.hasKey(ADD_BLOCKS_SCHEMATICA) || tagCompound.hasKey(ADD_BLOCKS); + boolean extra = false; byte extraBlocks[] = null; byte extraBlocksNibble[] = null; if (tagCompound.hasKey(ADD_BLOCKS)) { + extra = true; extraBlocksNibble = tagCompound.getByteArray(ADD_BLOCKS); extraBlocks = new byte[extraBlocksNibble.length * 2]; for (int i = 0; i < extraBlocksNibble.length; i++) { @@ -50,6 +51,7 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { extraBlocks[i * 2 + 1] = (byte) (extraBlocksNibble[i] & 0xF); } } else if (tagCompound.hasKey(ADD_BLOCKS_SCHEMATICA)) { + extra = true; extraBlocks = tagCompound.getByteArray(ADD_BLOCKS_SCHEMATICA); } @@ -73,11 +75,9 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < length; z++) { - blocks[x][y][z] = (short) ((localBlocks[x + (y * length + z) * width]) & 0xFF); - metadata[x][y][z] = (byte) ((localMetadata[x + (y * length + z) * width]) & 0xFF); - if (extra) { - blocks[x][y][z] |= ((extraBlocks[x + (y * length + z) * width]) & 0xFF) << 8; - } + int index = x + (y * length + z) * width; + blocks[x][y][z] = (short) ((localBlocks[index] & 0xFF) | (extra ? ((extraBlocks[index] & 0xFF) << 8) : 0)); + metadata[x][y][z] = (byte) (localMetadata[index] & 0xFF); if ((id = oldToNew.get(blocks[x][y][z])) != null) { blocks[x][y][z] = id; } @@ -120,12 +120,14 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { for (int x = 0; x < world.getWidth(); x++) { for (int y = 0; y < world.getHeight(); y++) { for (int z = 0; z < world.getLength(); z++) { - localBlocks[x + (y * world.getLength() + z) * world.getWidth()] = (byte) world.getBlockIdRaw(x, y, z); - localMetadata[x + (y * world.getLength() + z) * world.getWidth()] = (byte) world.getBlockMetadata(x, y, z); - if ((extraBlocks[x + (y * world.getLength() + z) * world.getWidth()] = (byte) (world.getBlockIdRaw(x, y, z) >> 8)) > 0) { + int index = x + (y * world.getLength() + z) * world.getWidth(); + int blockId = world.getBlockIdRaw(x, y, z); + localBlocks[index] = (byte) blockId; + localMetadata[index] = (byte) world.getBlockMetadata(x, y, z); + if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { extra = true; } - mapping.setShort(GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)), (short) world.getBlockIdRaw(x, y, z)); + mapping.setShort(GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)), (short) blockId); } } } From 2d50dc23d0d5d887f60517e9d3a76797790e3c93 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Jun 2014 04:45:16 +0200 Subject: [PATCH 018/314] Bumped version number. --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index ccd25c0b..343b55cc 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ version.major=1 -version.minor=6 -version.micro=1 +version.minor=7 +version.micro=0 version.minecraft=1.7.2 version.forge=10.12.1.1060 version.minforge=10.12.0.1056 From 0a61b1b4086541bef44d6ccadf7a771cb5138dce Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Thu, 26 Jun 2014 20:39:06 -0500 Subject: [PATCH 019/314] Only add mapping if it doesn't already exist. --- .../schematica/world/schematic/SchematicAlpha.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index a688df85..96d5a726 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -127,7 +127,12 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { extra = true; } - mapping.setShort(GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)), (short) blockId); + + String name = GameData.getBlockRegistry().getNameForObject(blockId); + if(!mapping.hasKey(name)) + { + mapping.setShort(name, (short) blockId); + } } } } From beff37cd9da65c37864b353a86a843f0874ba166 Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Thu, 26 Jun 2014 21:08:45 -0500 Subject: [PATCH 020/314] Move MATERIALS constant to SchematicFormat --- .../lunatrius/schematica/world/schematic/SchematicAlpha.java | 1 - .../lunatrius/schematica/world/schematic/SchematicFormat.java | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 96d5a726..82685700 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -26,7 +26,6 @@ public class SchematicAlpha extends SchematicFormat { public static final String WIDTH = "Width"; public static final String LENGTH = "Length"; public static final String HEIGHT = "Height"; - public static final String MATERIALS = "Materials"; public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; public static final String TILE_ENTITIES = "TileEntities"; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 54055da1..e8242d4f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -20,6 +20,7 @@ public abstract class SchematicFormat { public static final Map FORMATS = new HashMap(); + public static final String MATERIALS = "Materials"; public static final String FORMAT_CLASSIC = "Classic"; public static final String FORMAT_ALPHA = "Alpha"; public static String FORMAT_DEFAULT; @@ -32,7 +33,7 @@ public static SchematicWorld readFromFile(File file) { try { InputStream stream = new FileInputStream(file); NBTTagCompound tagCompound = CompressedStreamTools.readCompressed(stream); - String format = tagCompound.getString("Materials"); + String format = tagCompound.getString(MATERIALS); SchematicFormat schematicFormat = FORMATS.get(format); if (schematicFormat == null) { From 38946dac513b050de4be578fc9459e68d980cd1e Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Thu, 26 Jun 2014 21:15:03 -0500 Subject: [PATCH 021/314] Use tabs --- .../schematica/world/schematic/SchematicAlpha.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 82685700..cf5ff498 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -127,11 +127,11 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { extra = true; } - String name = GameData.getBlockRegistry().getNameForObject(blockId); - if(!mapping.hasKey(name)) - { - mapping.setShort(name, (short) blockId); - } + String name = GameData.getBlockRegistry().getNameForObject(blockId); + if(!mapping.hasKey(name)) + { + mapping.setShort(name, (short) blockId); + } } } } From c72722d623589315a5b1893ada3ebe4ba688408e Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Thu, 26 Jun 2014 21:22:56 -0500 Subject: [PATCH 022/314] More formatting, missed a tab. --- .../lunatrius/schematica/world/schematic/SchematicFormat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index e8242d4f..0dbf4308 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -20,7 +20,7 @@ public abstract class SchematicFormat { public static final Map FORMATS = new HashMap(); - public static final String MATERIALS = "Materials"; + public static final String MATERIALS = "Materials"; public static final String FORMAT_CLASSIC = "Classic"; public static final String FORMAT_ALPHA = "Alpha"; public static String FORMAT_DEFAULT; From ee8780cc4652ee02a74b3503b2b814b321542178 Mon Sep 17 00:00:00 2001 From: Colton Schlosser Date: Fri, 27 Jun 2014 07:53:41 -0500 Subject: [PATCH 023/314] Formatting --- .../lunatrius/schematica/world/schematic/SchematicAlpha.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index cf5ff498..5c5b759d 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -128,8 +128,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } String name = GameData.getBlockRegistry().getNameForObject(blockId); - if(!mapping.hasKey(name)) - { + if(!mapping.hasKey(name)) { mapping.setShort(name, (short) blockId); } } From 0c93beb1575e38ce22e0d2f59113d862f8098c2e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Jun 2014 17:18:22 +0200 Subject: [PATCH 024/314] Added missing comparator mapping. --- .../java/com/github/lunatrius/schematica/config/BlockInfo.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 632b1336..5ed695fe 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -192,6 +192,8 @@ public static void populateBlockItemMap() { addBlockItemMapping(Blocks.carrots, Items.carrot); addBlockItemMapping(Blocks.potatoes, Items.potato); addBlockItemMapping(Blocks.skull, Items.skull); + addBlockItemMapping(Blocks.unpowered_comparator, Items.comparator); + addBlockItemMapping(Blocks.powered_comparator, Items.comparator); } private static Item addBlockItemMapping(Block block, Item item) { From e02801e3c29e474fcf9ea95a035832a483abb230 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 29 Jun 2014 03:11:20 +0200 Subject: [PATCH 025/314] Fixed a NPE introduced in #35. Block != int (blockId) --- .../lunatrius/schematica/world/schematic/SchematicAlpha.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 5c5b759d..addf02b5 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -127,8 +127,8 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { extra = true; } - String name = GameData.getBlockRegistry().getNameForObject(blockId); - if(!mapping.hasKey(name)) { + String name = GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)); + if (!mapping.hasKey(name)) { mapping.setShort(name, (short) blockId); } } From 1ee2d921e01aff504ecd581cceab2534ac4e95f0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 29 Jun 2014 19:18:12 +0200 Subject: [PATCH 026/314] Update forge version to latest recommended. --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 343b55cc..c5896172 100644 --- a/build.properties +++ b/build.properties @@ -2,7 +2,7 @@ version.major=1 version.minor=7 version.micro=0 version.minecraft=1.7.2 -version.forge=10.12.1.1060 +version.forge=10.12.2.1121 version.minforge=10.12.0.1056 version.lunatriuscore=1.0.2.7 From bf1dc677203a3f19826135a97aef6bbba48307da Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 11 Jul 2014 10:56:17 +0200 Subject: [PATCH 027/314] Updated Forge and LunatriusCore. --- build.gradle | 4 ++-- build.properties | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 27c116da..be3f21d3 100644 --- a/build.gradle +++ b/build.gradle @@ -53,9 +53,9 @@ minecraft { version = "${config.version.minecraft}-${config.version.forge}" if (!project.hasProperty("run_location")) - assetDir = "run/assets" + runDir = "run" else - assetDir = run_location.replace("{modid}", config.mod.id).replace("{mcversion}", config.version.minecraft) + "assets" + runDir = run_location.replace("{modid}", config.mod.id).replace("{mcversion}", config.version.minecraft) } jar { diff --git a/build.properties b/build.properties index c5896172..0e8422ac 100644 --- a/build.properties +++ b/build.properties @@ -1,9 +1,9 @@ version.major=1 version.minor=7 version.micro=0 -version.minecraft=1.7.2 -version.forge=10.12.2.1121 -version.minforge=10.12.0.1056 -version.lunatriuscore=1.0.2.7 +version.minecraft=1.7.10 +version.forge=10.13.0.1179 +version.minforge=10.13.0.1151 +version.lunatriuscore=1.1.0.8 mod.id=Schematica From 75273fb350be5e966dbbb90361a01a0d490da73d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 15 Jul 2014 13:49:05 +0200 Subject: [PATCH 028/314] Updated for Minecraft 1.7.10. Added a configuration GUI. Moved strings from the Strings class to the appropriate classes. Added FMLAT. --- build.gradle | 106 +++++++------ build.properties | 6 +- settings.gradle | 1 + .../schematica/SchematicPrinter.java | 10 +- .../lunatrius/schematica/Schematica.java | 11 +- .../schematica/client/gui/GuiFactory.java | 28 ++++ .../schematica/client/gui/GuiModConfig.java | 25 +++ .../client/gui/GuiSchematicLoad.java | 9 +- .../client/gui/GuiSchematicSave.java | 4 +- .../client/renderer/RenderHelper.java | 10 +- .../renderer/RendererSchematicChunk.java | 29 ++-- .../schematica/config/BlockInfo.java | 11 +- .../lunatrius/schematica/config/Config.java | 75 --------- .../handler/ConfigurationHandler.java | 150 ++++++++++++++++++ .../client}/ChatEventHandler.java | 13 +- .../client}/KeyInputHandler.java | 14 +- .../client}/TickHandler.java | 5 +- .../lunatrius/schematica/lib/Constants.java | 5 - .../lunatrius/schematica/lib/Reference.java | 11 +- .../lunatrius/schematica/lib/Strings.java | 14 -- .../{client => proxy}/ClientProxy.java | 20 ++- .../schematica/proxy/CommonProxy.java | 37 +++++ .../ServerProxy.java} | 26 +-- .../schematica/world/SchematicWorld.java | 5 + src/main/resources/META-INF/schematica_at.cfg | 3 + .../assets/schematica/lang/en_US.lang | 42 ++++- 26 files changed, 445 insertions(+), 225 deletions(-) create mode 100644 settings.gradle create mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/config/Config.java create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java rename src/main/java/com/github/lunatrius/schematica/{client/events => handler/client}/ChatEventHandler.java (66%) rename src/main/java/com/github/lunatrius/schematica/{client/events => handler/client}/KeyInputHandler.java (78%) rename src/main/java/com/github/lunatrius/schematica/{client/events => handler/client}/TickHandler.java (95%) delete mode 100644 src/main/java/com/github/lunatrius/schematica/lib/Constants.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/lib/Strings.java rename src/main/java/com/github/lunatrius/schematica/{client => proxy}/ClientProxy.java (65%) create mode 100644 src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java rename src/main/java/com/github/lunatrius/schematica/{CommonProxy.java => proxy/ServerProxy.java} (58%) create mode 100644 src/main/resources/META-INF/schematica_at.cfg diff --git a/build.gradle b/build.gradle index be3f21d3..4d5e26ba 100644 --- a/build.gradle +++ b/build.gradle @@ -2,22 +2,22 @@ buildscript { repositories { mavenCentral() maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" + name = 'forge' + url = 'http://files.minecraftforge.net/maven' } maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" + name = 'sonatype' + url = 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT" + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' } } -apply plugin: "forge" +apply plugin: 'forge' -ext.configFile = file "build.properties" +ext.configFile = file 'build.properties' configFile.withReader { def prop = new Properties() @@ -25,22 +25,21 @@ configFile.withReader { ext.config = new ConfigSlurper().parse prop } -ext.build = System.getenv().BUILD_NUMBER ?: "dev" +ext.build = System.getenv().BUILD_NUMBER ?: 'git' ext.modversion = "${config.version.major}.${config.version.minor}.${config.version.micro}.${build}" -group = "com.github.lunatrius" +group = 'com.github.lunatrius' version = "${config.version.minecraft}-${modversion}" -archivesBaseName = config.mod.id repositories { ivy { - name = "lunatrius' ivy repo" - url "http://mc.lunatri.us/files" + name = 'lunatrius\' ivy repo' + url 'http://mc.lunatri.us/files' } } dependencies { - compile group: group, name: "LunatriusCore", version: "${config.version.minecraft}-${config.version.lunatriuscore}", classifier: "deobf" + compile group: group, name: 'LunatriusCore', version: "${config.version.minecraft}-${config.version.lunatriuscore}", classifier: 'dev' } idea { @@ -49,66 +48,73 @@ idea { } } +def commonManifest = { + if (config.extra.fmlat) { + attributes 'FMLAT': config.extra.fmlat + } +} + minecraft { version = "${config.version.minecraft}-${config.version.forge}" - if (!project.hasProperty("run_location")) - runDir = "run" + if (!project.hasProperty('run_location')) + runDir = 'run' else - runDir = run_location.replace("{modid}", config.mod.id).replace("{mcversion}", config.version.minecraft) + runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', config.version.minecraft) } jar { - classifier = "universal" + classifier = config.extra.classifier ?: 'universal' + manifest commonManifest } processResources { // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + inputs.property 'version', project.version + inputs.property 'mcversion', project.minecraft.version from (sourceSets.main.resources.srcDirs) { - include "mcmod.info" - include "version.properties" - - expand (["modid": config.mod.id, - "version": modversion, - "mcversion": config.version.minecraft, - "forgeversion": config.version.forge, - "minforgeversion": config.version.minforge ?: config.version.forge, - "coreversion": config.version.lunatriuscore + include 'mcmod.info' + include 'version.properties' + + expand (['modid': project.name, + 'version': modversion, + 'mcversion': config.version.minecraft, + 'forgeversion': config.version.forge, + 'minforgeversion': config.version.minforge ?: config.version.forge, + 'coreversion': config.version.lunatriuscore ]) } from (sourceSets.main.resources.srcDirs) { - exclude "mcmod.info" - exclude "version.properties" + exclude 'mcmod.info' + exclude 'version.properties' } } -if (!project.hasProperty("keystore_location")) - ext.keystore_location = "." +if (!project.hasProperty('keystore_location')) + ext.keystore_location = '.' -if (!project.hasProperty("keystore_alias")) - ext.keystore_alias = "" +if (!project.hasProperty('keystore_alias')) + ext.keystore_alias = '' -if (!project.hasProperty("keystore_password")) - ext.keystore_password = "" +if (!project.hasProperty('keystore_password')) + ext.keystore_password = '' -if (!project.hasProperty("release_location")) - ext.release_location = "." +if (!project.hasProperty('release_location')) + ext.release_location = '.' else - ext.release_location = release_location.replace("{modid}", config.mod.id).replace("{mcversion}", config.version.minecraft).replace("{version}", version) + ext.release_location = release_location.replace('{modid}', project.name).replace('{mcversion}', config.version.minecraft).replace('{version}', version) -task signJar(dependsOn: "reobf") { +task signJar(dependsOn: 'reobf') { inputs.file jar.getArchivePath() inputs.file keystore_location - inputs.property "keystore_alias", keystore_alias - inputs.property "keystore_password", keystore_password + inputs.property 'keystore_alias', keystore_alias + inputs.property 'keystore_password', keystore_password outputs.file jar.getArchivePath() onlyIf { - return keystore_location != "." + return keystore_location != '.' } doLast { @@ -122,25 +128,27 @@ task signJar(dependsOn: "reobf") { } } -task deobfJar(type: Jar) { +task devJar(type: Jar) { from sourceSets.main.output - classifier = "deobf" + classifier = 'dev' + manifest commonManifest } task sourceJar(type: Jar) { from sourceSets.main.allSource - classifier = "sources" + classifier = 'sources' + manifest commonManifest } -task release(dependsOn: ["sourceJar", "deobfJar", "signJar"], type: Copy) { +task release(dependsOn: ['sourceJar', 'devJar', 'signJar'], type: Copy) { from project.tasks.jar.destinationDir into project.file(project.release_location) eachFile { file -> - logger.info "copying ${file}" + logger.lifecycle "copying ${file}" } onlyIf { - return project.release_location != "." + return project.release_location != '.' } } diff --git a/build.properties b/build.properties index 0e8422ac..ff6c7a31 100644 --- a/build.properties +++ b/build.properties @@ -2,8 +2,8 @@ version.major=1 version.minor=7 version.micro=0 version.minecraft=1.7.10 -version.forge=10.13.0.1179 -version.minforge=10.13.0.1151 +version.forge=10.13.0.1180 +version.minforge=10.13.0.1180 version.lunatriuscore=1.1.0.8 -mod.id=Schematica +extra.fmlat=schematica_at.cfg diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..59942795 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'Schematica' diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 1eda98ed..57dd7cd0 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -2,7 +2,7 @@ import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.config.PlacementData; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -112,7 +112,7 @@ public boolean print() { } if (this.timeout[x][y][z] > 0) { - this.timeout[x][y][z] -= Reference.config.placeDelay; + this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; continue; } @@ -127,8 +127,8 @@ public boolean print() { int metadata = this.schematic.getBlockMetadata(x, y, z); if (placeBlock(this.minecraft, world, player, wx, wy, wz, BlockInfo.getItemFromBlock(block), metadata)) { - this.timeout[x][y][z] = (byte) Reference.config.timeout; - if (!Reference.config.placeInstantly) { + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + if (!ConfigurationHandler.placeInstantly) { player.inventory.currentItem = slot; syncSneaking(player, isSneaking); return true; @@ -224,7 +224,7 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player } } - if (direction != ForgeDirection.UNKNOWN || !Reference.config.placeAdjacent) { + if (direction != ForgeDirection.UNKNOWN || !ConfigurationHandler.placeAdjacent) { return placeBlock(minecraft, world, player, x, y, z, direction, 0.0f, offsetY, 0.0f); } diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 9267a787..7c22df38 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -1,8 +1,9 @@ package com.github.lunatrius.schematica; import com.github.lunatrius.core.version.VersionChecker; -import com.github.lunatrius.schematica.config.Config; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.proxy.CommonProxy; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -11,12 +12,12 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -@Mod(modid = Reference.MODID, name = Reference.NAME) +@Mod(modid = Reference.MODID, name = Reference.NAME, guiFactory = Reference.GUI_FACTORY) public class Schematica { @Instance(Reference.MODID) public static Schematica instance; - @SidedProxy(serverSide = Reference.PROXY_COMMON, clientSide = Reference.PROXY_CLIENT) + @SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT) public static CommonProxy proxy; @EventHandler @@ -25,8 +26,8 @@ public void preInit(FMLPreInitializationEvent event) { Reference.logger = event.getModLog(); - Reference.config = new Config(event.getSuggestedConfigurationFile()); - Reference.config.save(); + ConfigurationHandler.init(event.getSuggestedConfigurationFile()); + proxy.setConfigEntryClasses(); proxy.registerKeybindings(); proxy.createFolders(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java new file mode 100644 index 00000000..dc38a39a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java @@ -0,0 +1,28 @@ +package com.github.lunatrius.schematica.client.gui; + +import cpw.mods.fml.client.IModGuiFactory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; + +import java.util.Set; + +public class GuiFactory implements IModGuiFactory { + @Override + public void initialize(Minecraft minecraftInstance) { + } + + @Override + public Class mainConfigGuiClass() { + return GuiModConfig.class; + } + + @Override + public Set runtimeGuiCategories() { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java new file mode 100644 index 00000000..91c4b848 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java @@ -0,0 +1,25 @@ +package com.github.lunatrius.schematica.client.gui; + +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.lib.Reference; +import cpw.mods.fml.client.config.GuiConfig; +import cpw.mods.fml.client.config.IConfigElement; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigElement; + +import java.util.ArrayList; +import java.util.List; + +public class GuiModConfig extends GuiConfig { + public GuiModConfig(GuiScreen guiScreen) { + super(guiScreen, getConfigElements(), Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())); + } + + private static List getConfigElements() { + List elements = new ArrayList(); + for (String name : ConfigurationHandler.configuration.getCategoryNames()) { + elements.add(new ConfigElement(ConfigurationHandler.configuration.getCategory(name).setLanguageKey(String.format("%s.category.%s", ConfigurationHandler.LANG_PREFIX, name)))); + } + return elements; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index e2be67c9..78b01ba7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -2,6 +2,7 @@ import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Settings; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; @@ -32,7 +33,7 @@ public class GuiSchematicLoad extends GuiScreen { private final String strTitle = I18n.format("schematica.gui.title"); private final String strFolderInfo = I18n.format("schematica.gui.folderInfo"); - protected File currentDirectory = Reference.schematicDirectory; + protected File currentDirectory = ConfigurationHandler.schematicDirectory; protected final List schematicFiles = new ArrayList(); public GuiSchematicLoad(GuiScreen guiScreen) { @@ -63,14 +64,14 @@ protected void actionPerformed(GuiButton guiButton) { try { Class c = Class.forName("java.awt.Desktop"); Object m = c.getMethod("getDesktop").invoke(null); - c.getMethod("browse", URI.class).invoke(m, Reference.schematicDirectory.toURI()); + c.getMethod("browse", URI.class).invoke(m, ConfigurationHandler.schematicDirectory.toURI()); } catch (Throwable e) { success = true; } if (success) { Reference.logger.info("Opening via Sys class!"); - Sys.openURL("file://" + Reference.schematicDirectory.getAbsolutePath()); + Sys.openURL("file://" + ConfigurationHandler.schematicDirectory.getAbsolutePath()); } } else if (guiButton.id == this.btnDone.id) { if (this.settings.isLoadEnabled) { @@ -111,7 +112,7 @@ protected void reloadSchematics() { this.schematicFiles.clear(); try { - if (!this.currentDirectory.getCanonicalPath().equals(Reference.schematicDirectory.getCanonicalPath())) { + if (!this.currentDirectory.getCanonicalPath().equals(ConfigurationHandler.schematicDirectory.getCanonicalPath())) { this.schematicFiles.add(new GuiSchematicEntry("..", Items.lava_bucket, 0, true)); } } catch (IOException e) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 5d0769cb..3b1f92bc 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.schematica.Settings; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; @@ -217,7 +217,7 @@ protected void actionPerformed(GuiButton guiButton) { this.btnSave.enabled = this.settings.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; - if (this.settings.saveSchematic(Reference.schematicDirectory, path, this.settings.pointMin, this.settings.pointMax)) { + if (this.settings.saveSchematic(ConfigurationHandler.schematicDirectory, path, this.settings.pointMin, this.settings.pointMax)) { this.filename = ""; this.tfFilename.setText(this.filename); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java index 0958f568..60515b99 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.renderer; import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import org.lwjgl.BufferUtils; import java.nio.FloatBuffer; @@ -119,8 +119,8 @@ private static float[] createAndCopyBuffer(int newSize, float[] oldBuffer) { } public static void drawCuboidSurface(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { - vecZero.set(zero.x - Reference.config.blockDelta, zero.y - Reference.config.blockDelta, zero.z - Reference.config.blockDelta); - vecSize.set(size.x + Reference.config.blockDelta, size.y + Reference.config.blockDelta, size.z + Reference.config.blockDelta); + vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); + vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); if (quadCount + 24 >= quadSize) { quadSize *= 2; @@ -284,8 +284,8 @@ public static void drawCuboidSurface(Vector3f zero, Vector3f size, int sides, fl } public static void drawCuboidOutline(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { - vecZero.set(zero.x - Reference.config.blockDelta, zero.y - Reference.config.blockDelta, zero.z - Reference.config.blockDelta); - vecSize.set(size.x + Reference.config.blockDelta, size.y + Reference.config.blockDelta, size.z + Reference.config.blockDelta); + vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); + vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); if (lineCount + 24 >= lineSize) { lineSize *= 2; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 35f65227..c8f9c68a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -2,6 +2,7 @@ import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.Settings; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.relauncher.ReflectionHelper; @@ -275,44 +276,44 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, boolean isAirBlock = mcWorld.isAirBlock(wx, wy, wz); if (!isAirBlock) { - if (Reference.config.highlight && renderPass == 2) { - if (block == Blocks.air && Reference.config.highlightAir) { + if (ConfigurationHandler.highlight && renderPass == 2) { + if (block == Blocks.air && ConfigurationHandler.highlightAir) { zero.set(x, y, z); size.set(x + 1, y + 1, z + 1); - if (Reference.config.drawQuads) { + if (ConfigurationHandler.drawQuads) { RenderHelper.drawCuboidSurface(zero, size, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.75f, 0.25f); } - if (Reference.config.drawLines) { + if (ConfigurationHandler.drawLines) { RenderHelper.drawCuboidOutline(zero, size, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); } } else if (block != mcBlock) { zero.set(x, y, z); size.set(x + 1, y + 1, z + 1); - if (Reference.config.drawQuads) { + if (ConfigurationHandler.drawQuads) { RenderHelper.drawCuboidSurface(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); } - if (Reference.config.drawLines) { + if (ConfigurationHandler.drawLines) { RenderHelper.drawCuboidOutline(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); } } else if (this.schematic.getBlockMetadata(x, y, z) != mcWorld.getBlockMetadata(wx, wy, wz)) { zero.set(x, y, z); size.set(x + 1, y + 1, z + 1); - if (Reference.config.drawQuads) { + if (ConfigurationHandler.drawQuads) { RenderHelper.drawCuboidSurface(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); } - if (Reference.config.drawLines) { + if (ConfigurationHandler.drawLines) { RenderHelper.drawCuboidOutline(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); } } } } else if (block != Blocks.air) { - if (Reference.config.highlight && renderPass == 2) { + if (ConfigurationHandler.highlight && renderPass == 2) { zero.set(x, y, z); size.set(x + 1, y + 1, z + 1); - if (Reference.config.drawQuads) { + if (ConfigurationHandler.drawQuads) { RenderHelper.drawCuboidSurface(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); } - if (Reference.config.drawLines) { + if (ConfigurationHandler.drawLines) { RenderHelper.drawCuboidOutline(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); } } @@ -343,7 +344,7 @@ public void renderTileEntities(int renderPass) { int x, y, z; Block mcBlock; - GL11.glColor4f(1.0f, 1.0f, 1.0f, Reference.config.alpha); + GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); try { for (TileEntity tileEntity : this.tileEntities) { @@ -372,7 +373,7 @@ public void renderTileEntities(int renderPass) { } catch (Exception e) { Reference.logger.error("Failed to render a tile entity!", e); } - GL11.glColor4f(1.0f, 1.0f, 1.0f, Reference.config.alpha); + GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); } } } @@ -382,7 +383,7 @@ public void renderTileEntities(int renderPass) { } private void bindTexture() { - if (!Reference.config.enableAlpha) { + if (!ConfigurationHandler.enableAlpha) { this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); return; } diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 5ed695fe..98156de6 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -1,6 +1,5 @@ package com.github.lunatrius.schematica.config; -import com.github.lunatrius.schematica.lib.Strings; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; @@ -27,13 +26,15 @@ import static com.github.lunatrius.schematica.config.PlacementData.PlacementType; public class BlockInfo { + public static final String MINECRAFT = "minecraft"; + public static final List BLOCK_LIST_IGNORE_BLOCK = new ArrayList(); public static final List BLOCK_LIST_IGNORE_METADATA = new ArrayList(); public static final Map BLOCK_ITEM_MAP = new HashMap(); public static final Map CLASS_PLACEMENT_MAP = new HashMap(); public static final Map ITEM_PLACEMENT_MAP = new HashMap(); - private static String modId = Strings.MINECRAFT; + private static String modId = MINECRAFT; public static void setModId(String modId) { BlockInfo.modId = modId; @@ -60,7 +61,7 @@ private static boolean addIgnoredBlock(Block block) { } private static boolean addIgnoredBlock(String blockName) { - if (!Strings.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + if (!MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { return false; } @@ -151,7 +152,7 @@ private static boolean addIgnoredBlockMetadata(Block block) { } private static boolean addIgnoredBlockMetadata(String blockName) { - if (!Strings.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + if (!MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { return false; } @@ -209,7 +210,7 @@ private static Item addBlockItemMapping(Block block, Block item) { } private static Item addBlockItemMapping(Object blockObj, Object itemObj) { - if (!Strings.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + if (!MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/config/Config.java b/src/main/java/com/github/lunatrius/schematica/config/Config.java deleted file mode 100644 index 99a3131d..00000000 --- a/src/main/java/com/github/lunatrius/schematica/config/Config.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.github.lunatrius.schematica.config; - -import com.github.lunatrius.core.config.Configuration; -import com.github.lunatrius.core.lib.Reference; -import com.github.lunatrius.schematica.Schematica; -import net.minecraftforge.common.config.Property; - -import java.io.File; -import java.io.IOException; - -public class Config extends Configuration { - public final Property propEnableAlpha; - public final Property propAlpha; - public final Property propHighlight; - public final Property propHighlightAir; - public final Property propBlockDelta; - public final Property propPlaceDelay; - public final Property propTimeout; - public final Property propPlaceInstantly; - public final Property propPlaceAdjacent; - public final Property propDrawQuads; - public final Property propDrawLines; - public final Property propSchematicDirectory; - - public boolean enableAlpha = false; - public float alpha = 1.0f; - public boolean highlight = true; - public boolean highlightAir = true; - public float blockDelta = 0.005f; - public int placeDelay = 1; - public int timeout = 10; - public boolean placeInstantly = false; - public boolean placeAdjacent = true; - public boolean drawQuads = true; - public boolean drawLines = true; - public File schematicDirectory = new File(Schematica.proxy.getDataDirectory(), "schematics"); - - public Config(File file) { - super(file); - - String directory; - try { - directory = this.schematicDirectory.getCanonicalPath(); - } catch (IOException e) { - Reference.logger.info("Failed to get path!"); - directory = this.schematicDirectory.getAbsolutePath(); - } - - this.propEnableAlpha = get("general", "alphaEnabled", this.enableAlpha, "Enable transparent textures."); - this.propAlpha = get("general", "alpha", this.alpha, 0.0, 1.0, "Alpha value used when rendering the schematic (example: 1.0 = opaque, 0.5 = half transparent, 0.0 = transparent)."); - this.propHighlight = get("general", "highlight", this.highlight, "Highlight invalid placed blocks and to be placed blocks."); - this.propHighlightAir = get("general", "highlightAir", this.highlightAir, "Highlight invalid placed blocks (where there should be no block)."); - this.propBlockDelta = get("general", "blockDelta", this.blockDelta, 0.0, 0.5, "Delta value used for highlighting (if you're having issue with overlapping textures try setting this value higher)."); - this.propPlaceDelay = get("general", "placeDelay", this.placeDelay, 0, 20, "Delay in ticks between placement attempts."); - this.propTimeout = get("general", "timeout", this.timeout, 0, 100, "Timeout before re-trying failed blocks."); - this.propPlaceInstantly = get("general", "placeInstantly", this.placeInstantly, "Place all blocks that can be placed in one tick."); - this.propPlaceAdjacent = get("general", "placeAdjacent", this.placeAdjacent, "Place blocks only if there is an adjacent block next to it."); - this.propDrawQuads = get("general", "drawQuads", this.drawQuads, "Draw surface areas."); - this.propDrawLines = get("general", "drawLines", this.drawLines, "Draw outlines."); - this.propSchematicDirectory = get("general", "schematicDirectory", directory, "Schematic directory."); - - this.enableAlpha = this.propEnableAlpha.getBoolean(this.enableAlpha); - this.alpha = (float) this.propAlpha.getDouble(this.alpha); - this.highlight = this.propHighlight.getBoolean(this.highlight); - this.highlightAir = this.propHighlightAir.getBoolean(this.highlightAir); - this.blockDelta = (float) this.propBlockDelta.getDouble(this.blockDelta); - this.placeDelay = this.propPlaceDelay.getInt(this.placeDelay); - this.timeout = this.propTimeout.getInt(this.timeout); - this.placeInstantly = this.propPlaceInstantly.getBoolean(this.placeInstantly); - this.placeAdjacent = this.propPlaceAdjacent.getBoolean(this.placeAdjacent); - this.drawQuads = this.propDrawQuads.getBoolean(this.drawQuads); - this.drawLines = this.propDrawLines.getBoolean(this.drawLines); - this.schematicDirectory = new File(this.propSchematicDirectory.getString()); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java new file mode 100644 index 00000000..f72653ca --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -0,0 +1,150 @@ +package com.github.lunatrius.schematica.handler; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.lib.Reference; +import cpw.mods.fml.client.event.ConfigChangedEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import java.io.File; +import java.io.IOException; + +public class ConfigurationHandler { + public static final String CATEGORY_RENDER = "render"; + public static final String CATEGORY_PRINTER = "printer"; + public static final String CATEGORY_GENERAL = "general"; + + public static final String ALPHA_ENABLED = "alphaEnabled"; + public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; + public static final String ALPHA = "alpha"; + public static final String ALPHA_DESC = "Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent)."; + public static final String HIGHLIGHT = "highlight"; + public static final String HIGHLIGHT_DESC = "Highlight invalid placed blocks and to be placed blocks."; + public static final String HIGHLIGHT_AIR = "highlightAir"; + public static final String HIGHLIGHT_AIR_DESC = "Highlight blocks that should be air."; + public static final String BLOCK_DELTA = "blockDelta"; + public static final String BLOCK_DELTA_DESC = "Delta value used for highlighting (if you experience z-fighting increase this)."; + public static final String DRAW_QUADS = "drawQuads"; + public static final String DRAW_QUADS_DESC = "Draw surface areas."; + public static final String DRAW_LINES = "drawLines"; + public static final String DRAW_LINES_DESC = "Draw outlines."; + + public static final String PLACE_DELAY = "placeDelay"; + public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; + public static final String TIMEOUT = "timeout"; + public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; + public static final String PLACE_INSTANTLY = "placeInstantly"; + public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; + public static final String PLACE_ADJACENT = "placeAdjacent"; + public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; + + public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; + public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; + + public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; + + public static Configuration configuration; + + public static boolean enableAlpha = false; + public static float alpha = 1.0f; + public static boolean highlight = true; + public static boolean highlightAir = true; + public static float blockDelta = 0.005f; + public static int placeDelay = 1; + public static int timeout = 10; + public static boolean placeInstantly = false; + public static boolean placeAdjacent = true; + public static boolean drawQuads = true; + public static boolean drawLines = true; + public static File schematicDirectory = new File(Schematica.proxy.getDataDirectory(), "schematics"); + + public static Property propEnableAlpha = null; + public static Property propAlpha = null; + public static Property propHighlight = null; + public static Property propHighlightAir = null; + public static Property propBlockDelta = null; + public static Property propPlaceDelay = null; + public static Property propTimeout = null; + public static Property propPlaceInstantly = null; + public static Property propPlaceAdjacent = null; + public static Property propDrawQuads = null; + public static Property propDrawLines = null; + public static Property propSchematicDirectory = null; + + public static void init(File configFile) { + if (configuration == null) { + configuration = new Configuration(configFile); + loadConfiguration(); + } + } + + private static void loadConfiguration() { + propEnableAlpha = configuration.get(CATEGORY_RENDER, ALPHA_ENABLED, enableAlpha, ALPHA_ENABLED_DESC); + propEnableAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA_ENABLED)); + propEnableAlpha.setShowInGui(false); + enableAlpha = propEnableAlpha.getBoolean(enableAlpha); + + propAlpha = configuration.get(CATEGORY_RENDER, ALPHA, alpha, ALPHA_DESC, 0.0, 1.0); + propAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA)); + propAlpha.setShowInGui(false); + alpha = (float) propAlpha.getDouble(alpha); + + propHighlight = configuration.get(CATEGORY_RENDER, HIGHLIGHT, highlight, HIGHLIGHT_DESC); + propHighlight.setLanguageKey(String.format("%s.%s", LANG_PREFIX, HIGHLIGHT)); + highlight = propHighlight.getBoolean(highlight); + + propHighlightAir = configuration.get(CATEGORY_RENDER, HIGHLIGHT_AIR, highlightAir, HIGHLIGHT_AIR_DESC); + propHighlightAir.setLanguageKey(String.format("%s.%s", LANG_PREFIX, HIGHLIGHT_AIR)); + highlightAir = propHighlightAir.getBoolean(highlightAir); + + propBlockDelta = configuration.get(CATEGORY_RENDER, BLOCK_DELTA, blockDelta, BLOCK_DELTA_DESC, 0.0, 0.2); + propBlockDelta.setLanguageKey(String.format("%s.%s", LANG_PREFIX, BLOCK_DELTA)); + blockDelta = (float) propBlockDelta.getDouble(blockDelta); + + propDrawQuads = configuration.get(CATEGORY_RENDER, DRAW_QUADS, drawQuads, DRAW_QUADS_DESC); + propDrawQuads.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DRAW_QUADS)); + drawQuads = propDrawQuads.getBoolean(drawQuads); + + propDrawLines = configuration.get(CATEGORY_RENDER, DRAW_LINES, drawLines, DRAW_LINES_DESC); + propDrawLines.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DRAW_LINES)); + drawLines = propDrawLines.getBoolean(drawLines); + + propPlaceDelay = configuration.get(CATEGORY_PRINTER, PLACE_DELAY, placeDelay, PLACE_DELAY_DESC, 0, 20); + propPlaceDelay.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_DELAY)); + placeDelay = propPlaceDelay.getInt(placeDelay); + + propTimeout = configuration.get(CATEGORY_PRINTER, TIMEOUT, timeout, TIMEOUT_DESC, 0, 100); + propTimeout.setLanguageKey(String.format("%s.%s", LANG_PREFIX, TIMEOUT)); + timeout = propTimeout.getInt(timeout); + + propPlaceInstantly = configuration.get(CATEGORY_PRINTER, PLACE_INSTANTLY, placeInstantly, PLACE_INSTANTLY_DESC); + propPlaceInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_INSTANTLY)); + placeInstantly = propPlaceInstantly.getBoolean(placeInstantly); + + propPlaceAdjacent = configuration.get(CATEGORY_PRINTER, PLACE_ADJACENT, placeAdjacent, PLACE_ADJACENT_DESC); + propPlaceAdjacent.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_ADJACENT)); + placeAdjacent = propPlaceAdjacent.getBoolean(placeAdjacent); + + try { + schematicDirectory = schematicDirectory.getCanonicalFile(); + } catch (IOException e) { + Reference.logger.warn("Could not canonize file path!", e); + } + + propSchematicDirectory = configuration.get(CATEGORY_GENERAL, SCHEMATIC_DIRECTORY, schematicDirectory.getAbsolutePath().replace("\\", "/"), SCHEMATIC_DIRECTORY_DESC); + propSchematicDirectory.setLanguageKey(String.format("%s.%s", LANG_PREFIX, SCHEMATIC_DIRECTORY)); + schematicDirectory = new File(propSchematicDirectory.getString()); + + if (configuration.hasChanged()) { + configuration.save(); + } + } + + @SubscribeEvent + public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { + if (event.modID.equalsIgnoreCase(Reference.MODID)) { + loadConfiguration(); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/events/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java similarity index 66% rename from src/main/java/com/github/lunatrius/schematica/client/events/ChatEventHandler.java rename to src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 21d17616..372f27dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/events/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -1,13 +1,16 @@ -package com.github.lunatrius.schematica.client.events; +package com.github.lunatrius.schematica.handler.client; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.lib.Reference; -import com.github.lunatrius.schematica.lib.Strings; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; public class ChatEventHandler { + public static final String SBC_DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; + public static final String SBC_DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; + public static final String SBC_DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; + private final Settings settings = Settings.instance; @SubscribeEvent @@ -16,15 +19,15 @@ public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { if (this.settings.chatLines < 10) { String message = event.message.getFormattedText(); - if (message.contains(Strings.SBC_DISABLE_PRINTER)) { + if (message.contains(SBC_DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); SchematicPrinter.INSTANCE.setEnabled(false); } - if (message.contains(Strings.SBC_DISABLE_SAVE)) { + if (message.contains(SBC_DISABLE_SAVE)) { Reference.logger.info("Saving is disabled on this server."); this.settings.isSaveEnabled = false; } - if (message.contains(Strings.SBC_DISABLE_LOAD)) { + if (message.contains(SBC_DISABLE_LOAD)) { Reference.logger.info("Loading is disabled on this server."); this.settings.isLoadEnabled = false; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/events/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java similarity index 78% rename from src/main/java/com/github/lunatrius/schematica/client/events/KeyInputHandler.java rename to src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 4c661e87..a929c75a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/events/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -1,9 +1,8 @@ -package com.github.lunatrius.schematica.client.events; +package com.github.lunatrius.schematica.handler.client; import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; -import com.github.lunatrius.schematica.lib.Strings; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -13,9 +12,14 @@ import static cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; public class KeyInputHandler { - private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(Strings.KEY_LOAD, Keyboard.KEY_DIVIDE, Strings.KEY_CATEGORY); - private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(Strings.KEY_SAVE, Keyboard.KEY_MULTIPLY, Strings.KEY_CATEGORY); - private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(Strings.KEY_CONTROL, Keyboard.KEY_SUBTRACT, Strings.KEY_CATEGORY); + public static final String CATEGORY = "schematica.key.category"; + public static final String LOAD = "schematica.key.load"; + public static final String SAVE = "schematica.key.save"; + public static final String CONTROL = "schematica.key.control"; + + private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(LOAD, Keyboard.KEY_DIVIDE, CATEGORY); + private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(SAVE, Keyboard.KEY_MULTIPLY, CATEGORY); + private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(CONTROL, Keyboard.KEY_SUBTRACT, CATEGORY); public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL diff --git a/src/main/java/com/github/lunatrius/schematica/client/events/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java similarity index 95% rename from src/main/java/com/github/lunatrius/schematica/client/events/TickHandler.java rename to src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 6ce45429..0c23a449 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/events/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -1,9 +1,10 @@ -package com.github.lunatrius.schematica.client.events; +package com.github.lunatrius.schematica.handler.client; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -49,7 +50,7 @@ public void clientTick(TickEvent.ClientTickEvent event) { this.minecraft.mcProfiler.startSection("printer"); SchematicPrinter printer = SchematicPrinter.INSTANCE; if (printer.isEnabled() && printer.isPrinting() && this.ticks-- < 0) { - this.ticks = Reference.config.placeDelay; + this.ticks = ConfigurationHandler.placeDelay; printer.print(); } diff --git a/src/main/java/com/github/lunatrius/schematica/lib/Constants.java b/src/main/java/com/github/lunatrius/schematica/lib/Constants.java deleted file mode 100644 index eeaf9569..00000000 --- a/src/main/java/com/github/lunatrius/schematica/lib/Constants.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.lunatrius.schematica.lib; - -public class Constants { - -} diff --git a/src/main/java/com/github/lunatrius/schematica/lib/Reference.java b/src/main/java/com/github/lunatrius/schematica/lib/Reference.java index e68e8e14..a494d283 100644 --- a/src/main/java/com/github/lunatrius/schematica/lib/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/lib/Reference.java @@ -1,10 +1,8 @@ package com.github.lunatrius.schematica.lib; -import com.github.lunatrius.schematica.config.Config; import com.google.common.base.Throwables; import org.apache.logging.log4j.Logger; -import java.io.File; import java.io.InputStream; import java.util.Properties; @@ -17,7 +15,7 @@ public class Reference { prop.load(stream); stream.close(); } catch (Exception e) { - Throwables.propagate(e); + throw Throwables.propagate(e); } VERSION = prop.getProperty("version.mod"); @@ -30,10 +28,9 @@ public class Reference { public static final String VERSION; public static final String FORGE; public static final String MINECRAFT; - public static final String PROXY_COMMON = "com.github.lunatrius.schematica.CommonProxy"; - public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.client.ClientProxy"; + public static final String PROXY_SERVER = "com.github.lunatrius.schematica.proxy.ServerProxy"; + public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; + public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; public static Logger logger = null; - public static Config config = null; - public static File schematicDirectory = new File(".", "schematics"); } diff --git a/src/main/java/com/github/lunatrius/schematica/lib/Strings.java b/src/main/java/com/github/lunatrius/schematica/lib/Strings.java deleted file mode 100644 index 7676208e..00000000 --- a/src/main/java/com/github/lunatrius/schematica/lib/Strings.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.github.lunatrius.schematica.lib; - -public class Strings { - public static final String MINECRAFT = "minecraft"; - - public static final String SBC_DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; - public static final String SBC_DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; - public static final String SBC_DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; - - public static final String KEY_CATEGORY = "schematica.key.category"; - public static final String KEY_LOAD = "schematica.key.load"; - public static final String KEY_SAVE = "schematica.key.save"; - public static final String KEY_CONTROL = "schematica.key.control"; -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java similarity index 65% rename from src/main/java/com/github/lunatrius/schematica/client/ClientProxy.java rename to src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 81ca29f4..8b9d3c18 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,11 +1,12 @@ -package com.github.lunatrius.schematica.client; +package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.schematica.CommonProxy; -import com.github.lunatrius.schematica.client.events.ChatEventHandler; -import com.github.lunatrius.schematica.client.events.KeyInputHandler; -import com.github.lunatrius.schematica.client.events.TickHandler; import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.handler.client.ChatEventHandler; +import com.github.lunatrius.schematica.handler.client.KeyInputHandler; +import com.github.lunatrius.schematica.handler.client.TickHandler; import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.client.config.GuiConfigEntries; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.client.Minecraft; @@ -19,6 +20,14 @@ public class ClientProxy extends CommonProxy { private RendererSchematicGlobal rendererSchematicGlobal = null; private SchematicWorld schematicWorld = null; + @Override + public void setConfigEntryClasses() { + ConfigurationHandler.propAlpha.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propBlockDelta.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propPlaceDelay.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propTimeout.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + } + @Override public void registerKeybindings() { for (KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) { @@ -30,6 +39,7 @@ public void registerKeybindings() { public void registerEvents() { FMLCommonHandler.instance().bus().register(new KeyInputHandler()); FMLCommonHandler.instance().bus().register(new TickHandler()); + FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); this.rendererSchematicGlobal = new RendererSchematicGlobal(); MinecraftForge.EVENT_BUS.register(this.rendererSchematicGlobal); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java new file mode 100644 index 00000000..97d5bef6 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -0,0 +1,37 @@ +package com.github.lunatrius.schematica.proxy; + +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; + +import java.io.File; + +public abstract class CommonProxy { + public abstract void setConfigEntryClasses(); + + public abstract void registerKeybindings(); + + public abstract void registerEvents(); + + public void createFolders() { + if (!ConfigurationHandler.schematicDirectory.exists()) { + if (!ConfigurationHandler.schematicDirectory.mkdirs()) { + Reference.logger.info("Could not create schematic directory [%s]!", ConfigurationHandler.schematicDirectory.getAbsolutePath()); + } + } + } + + public File getDataDirectory() { + return MinecraftServer.getServer().getFile("."); + } + + public abstract void setActiveSchematic(SchematicWorld world); + + public abstract void setActiveSchematic(SchematicWorld world, EntityPlayer player); + + public abstract SchematicWorld getActiveSchematic(); + + public abstract SchematicWorld getActiveSchematic(EntityPlayer player); +} diff --git a/src/main/java/com/github/lunatrius/schematica/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java similarity index 58% rename from src/main/java/com/github/lunatrius/schematica/CommonProxy.java rename to src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 11b71c4a..46856e5e 100644 --- a/src/main/java/com/github/lunatrius/schematica/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,43 +1,43 @@ -package com.github.lunatrius.schematica; +package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import java.io.File; -public class CommonProxy { - public void registerKeybindings() { +public class ServerProxy extends CommonProxy { + @Override + public void setConfigEntryClasses() { } - public void registerEvents() { + @Override + public void registerKeybindings() { } - public void createFolders() { - Reference.schematicDirectory = Reference.config.schematicDirectory; - - if (!Reference.schematicDirectory.exists()) { - if (!Reference.schematicDirectory.mkdirs()) { - Reference.logger.info("Could not create schematic directory [%s]!", Reference.schematicDirectory.getAbsolutePath()); - } - } + @Override + public void registerEvents() { } + @Override public File getDataDirectory() { return MinecraftServer.getServer().getFile("."); } + @Override public void setActiveSchematic(SchematicWorld world) { } + @Override public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { } + @Override public SchematicWorld getActiveSchematic() { return null; } + @Override public SchematicWorld getActiveSchematic(EntityPlayer player) { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 4ab08db7..79339b64 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -313,6 +313,11 @@ public boolean isBlockNormalCubeDefault(int x, int y, int z, boolean _default) { return _default; } + @Override + protected int func_152379_p() { + return 0; + } + @Override public boolean isAirBlock(int x, int y, int z) { Block block = getBlock(x, y, z); diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg new file mode 100644 index 00000000..f5a96e70 --- /dev/null +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -0,0 +1,3 @@ +# Schematica +public net.minecraft.client.renderer.RenderGlobal field_72768_k # sortedWorldRenderers +public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 73ed2de5..8d052e87 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Open schematic folder schematica.gui.done=Done schematica.gui.title=Select schematic file @@ -29,7 +29,45 @@ schematica.gui.materialname=Material schematica.gui.materialamount=Amount schematica.gui.printer=Printer -# Keys +# gui - config - categories +schematica.config.category.render=Rendering +schematica.config.category.render.tooltip=Render related settings. +schematica.config.category.printer=Printer +schematica.config.category.printer.tooltip=Printer related settings. +schematica.config.category.general=General +schematica.config.category.general.tooltip=General settings. + +# gui - config - render +schematica.config.alphaEnabled=Alpha Enabled +schematica.config.alphaEnabled.tooltip=Enable transparent textures. +schematica.config.alpha=Alpha +schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +schematica.config.highlight=Highlight Blocks +schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +schematica.config.highlightAir=Highlight Air +schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +schematica.config.blockDelta=Block Delta +schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +schematica.config.drawQuads=Draw Quads +schematica.config.drawQuads.tooltip=Draw surface areas. +schematica.config.drawLines=Draw Lines +schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +schematica.config.placeDelay=Placement Delay +schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +schematica.config.timeout=Timeout +schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +schematica.config.placeInstantly=Place Instantly +schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +schematica.config.placeAdjacent=Place Only Adjacent +schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +schematica.config.schematicDirectory=Schematic Directory +schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic From d2d9c8888f0c7d8d0d090817bfb0bcef1a078160 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 15 Jul 2014 13:52:03 +0200 Subject: [PATCH 029/314] Deprecated the Settings class and all it's fields. All of this has to be eventually refactored out. --- .../github/lunatrius/schematica/Settings.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index cbb50f7f..4138bc41 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -20,33 +20,55 @@ import java.util.ArrayList; import java.util.List; +@Deprecated public class Settings { + @Deprecated public static final Settings instance = new Settings(); + @Deprecated private final Vector3f translationVector = new Vector3f(); + @Deprecated public Minecraft minecraft = Minecraft.getMinecraft(); + @Deprecated public Vector3f playerPosition = new Vector3f(); + @Deprecated public final List sortedRendererSchematicChunk = new ArrayList(); + @Deprecated public RenderBlocks renderBlocks = null; + @Deprecated public Vector3f pointA = new Vector3f(); + @Deprecated public Vector3f pointB = new Vector3f(); + @Deprecated public Vector3f pointMin = new Vector3f(); + @Deprecated public Vector3f pointMax = new Vector3f(); + @Deprecated public int rotationRender = 0; + @Deprecated public ForgeDirection orientation = ForgeDirection.UNKNOWN; + @Deprecated public Vector3f offset = new Vector3f(); + @Deprecated public boolean isRenderingGuide = false; + @Deprecated public int chatLines = 0; + @Deprecated public boolean isSaveEnabled = true; + @Deprecated public boolean isLoadEnabled = true; + @Deprecated public boolean isPendingReset = false; + @Deprecated public int[] increments = { 1, 5, 15, 50, 250 }; + @Deprecated private Settings() { } + @Deprecated public void reset() { this.chatLines = 0; SchematicPrinter.INSTANCE.setEnabled(true); @@ -61,6 +83,7 @@ public void reset() { SchematicPrinter.INSTANCE.setSchematic(null); } + @Deprecated public void createRendererSchematicChunk() { SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); int width = (schematic.getWidth() - 1) / RendererSchematicChunk.CHUNK_WIDTH + 1; @@ -81,6 +104,7 @@ public void createRendererSchematicChunk() { } } + @Deprecated public boolean loadSchematic(String filename) { try { InputStream stream = new FileInputStream(filename); @@ -111,6 +135,7 @@ public boolean loadSchematic(String filename) { return true; } + @Deprecated public boolean saveSchematic(File directory, String filename, Vector3f from, Vector3f to) { try { int minX = (int) Math.min(from.x, to.x); @@ -177,29 +202,35 @@ public boolean saveSchematic(File directory, String filename, Vector3f from, Vec return true; } + @Deprecated public Vector3f getTranslationVector() { this.translationVector.set(this.playerPosition).sub(this.offset); return this.translationVector; } + @Deprecated public float getTranslationX() { return this.playerPosition.x - this.offset.x; } + @Deprecated public float getTranslationY() { return this.playerPosition.y - this.offset.y; } + @Deprecated public float getTranslationZ() { return this.playerPosition.z - this.offset.z; } + @Deprecated public void refreshSchematic() { for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { renderer.setDirty(); } } + @Deprecated public void updatePoints() { this.pointMin.x = Math.min(this.pointA.x, this.pointB.x); this.pointMin.y = Math.min(this.pointA.y, this.pointB.y); @@ -210,6 +241,7 @@ public void updatePoints() { this.pointMax.z = Math.max(this.pointA.z, this.pointB.z); } + @Deprecated public void moveHere(Vector3f point) { point.x = (int) Math.floor(this.playerPosition.x); point.y = (int) Math.floor(this.playerPosition.y - 1); @@ -235,6 +267,7 @@ public void moveHere(Vector3f point) { } } + @Deprecated public void moveHere() { this.offset.x = (int) Math.floor(this.playerPosition.x); this.offset.y = (int) Math.floor(this.playerPosition.y) - 1; From 006fe9417594720f141dd66eb81ee1762df75763 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 15 Jul 2014 13:57:38 +0200 Subject: [PATCH 030/314] Fixed the schematic not being refreshed when moved around. --- .../schematica/client/gui/GuiSchematicControl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 6396ec58..607775a9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -138,22 +138,28 @@ protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDecX.id) { this.settings.offset.x -= this.settings.increments[this.incrementX]; + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnIncX.id) { this.settings.offset.x += this.settings.increments[this.incrementX]; + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnAmountX.id) { this.incrementX = (this.incrementX + 1) % this.settings.increments.length; this.btnAmountX.displayString = Integer.toString(this.settings.increments[this.incrementX]); } else if (guiButton.id == this.btnDecY.id) { this.settings.offset.y -= this.settings.increments[this.incrementY]; + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnIncY.id) { this.settings.offset.y += this.settings.increments[this.incrementY]; + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnAmountY.id) { this.incrementY = (this.incrementY + 1) % this.settings.increments.length; this.btnAmountY.displayString = Integer.toString(this.settings.increments[this.incrementY]); } else if (guiButton.id == this.btnDecZ.id) { this.settings.offset.z -= this.settings.increments[this.incrementZ]; + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnIncZ.id) { this.settings.offset.z += this.settings.increments[this.incrementZ]; + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnAmountZ.id) { this.incrementZ = (this.incrementZ + 1) % this.settings.increments.length; this.btnAmountZ.displayString = Integer.toString(this.settings.increments[this.incrementZ]); @@ -171,6 +177,7 @@ protected void actionPerformed(GuiButton guiButton) { this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); } else if (guiButton.id == this.btnMove.id) { this.settings.moveHere(); + this.settings.refreshSchematic(); } else if (guiButton.id == this.btnFlip.id) { if (this.schematic != null) { this.schematic.flip(); From 017c0d21dc90f4f149a2929b0254dde77122309c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 15 Jul 2014 14:02:45 +0200 Subject: [PATCH 031/314] Replaced reflection code with AT references. --- .../handler/client/TickHandler.java | 31 ++++++------------- .../world/schematic/SchematicFormat.java | 9 +----- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 0c23a449..b778ec8c 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -10,23 +10,16 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.network.FMLNetworkEvent; -import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.util.AxisAlignedBB; -import java.lang.reflect.Field; - public class TickHandler { private final Minecraft minecraft = Minecraft.getMinecraft(); private int ticks = -1; - private final Field sortedWorldRenderers; - public TickHandler() { - this.sortedWorldRenderers = ReflectionHelper.findField(RenderGlobal.class, "n", "field_72768_k", "sortedWorldRenderers"); } @SubscribeEvent @@ -74,24 +67,18 @@ public void clientTick(TickEvent.ClientTickEvent event) { } private void checkDirty() { - if (this.sortedWorldRenderers != null) { - try { - WorldRenderer[] renderers = (WorldRenderer[]) this.sortedWorldRenderers.get(Minecraft.getMinecraft().renderGlobal); - if (renderers != null) { - int count = 0; - for (WorldRenderer worldRenderer : renderers) { - if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { - AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-Settings.instance.offset.x, -Settings.instance.offset.y, -Settings.instance.offset.z); - for (RendererSchematicChunk renderer : Settings.instance.sortedRendererSchematicChunk) { - if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { - renderer.setDirty(); - } - } + WorldRenderer[] renderers = this.minecraft.renderGlobal.sortedWorldRenderers; + if (renderers != null) { + int count = 0; + for (WorldRenderer worldRenderer : renderers) { + if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { + AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-Settings.instance.offset.x, -Settings.instance.offset.y, -Settings.instance.offset.z); + for (RendererSchematicChunk renderer : Settings.instance.sortedRendererSchematicChunk) { + if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { + renderer.setDirty(); } } } - } catch (Exception e) { - Reference.logger.error("Dirty check failed!", e); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 0dbf4308..092558cd 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -2,18 +2,14 @@ import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; -import java.io.DataOutput; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; -import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.zip.GZIPOutputStream; @@ -61,10 +57,7 @@ public static boolean writeToFile(File file, SchematicWorld world) { DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); try { - Method method = ReflectionHelper.findMethod(NBTTagCompound.class, null, new String[] { - "func_150298_a", "a" - }, String.class, NBTBase.class, DataOutput.class); - method.invoke(null, "Schematic", tagCompound, dataOutputStream); + NBTTagCompound.func_150298_a("Schematic", tagCompound, dataOutputStream); } finally { dataOutputStream.close(); } From 28732f68fa7acc250068675c8d077df20c2c80f8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 15 Jul 2014 14:04:03 +0200 Subject: [PATCH 032/314] Updated localizations. --- .../assets/schematica/lang/ca_ES.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/cs_CZ.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/da_DK.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/de_DE.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/en_GB.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/en_PT.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/es_ES.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/es_MX.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/fi_FI.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/fr_FR.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/hu_HU.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/it_IT.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/la_LA.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/lt_LT.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/nl_NL.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/no_NO.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/pl_PL.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/pt_PT.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/ru_RU.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/sk_SK.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/sl_SI.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/th_TH.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/tr_TR.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/uk_UA.lang | 42 ++++++++++++++++++- .../assets/schematica/lang/zh_CN.lang | 42 ++++++++++++++++++- 25 files changed, 1000 insertions(+), 50 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index d1a3fea0..65f0e4bf 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Obrir carpeta d'esquemes schematica.gui.done=Fet schematica.gui.title=Seleccionar arxiu d'esquemes @@ -29,7 +29,45 @@ schematica.gui.z=Z: schematica.gui.materialamount=Quantitat schematica.gui.printer=Imprimir -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Carregar esquema schematica.key.save=Guardar esquema diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 1ccad3fd..ec3b7026 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Otevřít složku se schématy schematica.gui.done=Hotovo schematica.gui.title=Vyberte soubor schématu @@ -29,7 +29,45 @@ schematica.gui.materialname=Materiál schematica.gui.materialamount=Množství schematica.gui.printer=Tiskárna -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Načíst schéma schematica.key.save=Uložit schéma diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index eded3207..0965d073 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Åbn schematics mappe schematica.gui.done=Færdig schematica.gui.title=Vælg schematic-fil @@ -29,7 +29,45 @@ schematica.gui.materialname=Materiale schematica.gui.materialamount=Antal # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Åbn schematic schematica.key.save=Gem schematic diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index e67131b3..1f73d2d5 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Öffne Schematic-Ordner schematica.gui.done=Fertig schematica.gui.title=Wähle Schematic-Datei @@ -29,7 +29,45 @@ schematica.gui.materialname=Material schematica.gui.materialamount=Menge schematica.gui.printer=Drucker -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Schematic laden schematica.key.save=Schematic speichern diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index af0ca43f..66e0bf73 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Open schematic folder schematica.gui.done=Done schematica.gui.title=Select schematic file @@ -29,7 +29,45 @@ schematica.gui.materialname=Material schematica.gui.materialamount=Amount schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index dd0579ac..02ac6202 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Open ye Blueprints schematica.gui.done=Plundered schematica.gui.title=Select ye Blueprint @@ -29,7 +29,45 @@ schematica.gui.materialname=Stuff schematica.gui.materialamount=Number schematica.gui.printer=Printing thing -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Load yer blueprint schematica.key.save=Keep yer blueprint diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 9a4afbe3..e196f9e0 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Abrir carpeta de esquemas schematica.gui.done=Hecho schematica.gui.title=Seleccionar archivo de esquema @@ -29,7 +29,45 @@ schematica.gui.materials=Materiales schematica.gui.materialamount=Cantidad schematica.gui.printer=Impresora -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Cargar esquema schematica.key.save=Guardar esquema diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index acd4fbe1..af064012 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Abrir carpeta de esquemas schematica.gui.done=Listo schematica.gui.title=Seleccionar archivo de esquema @@ -29,7 +29,45 @@ schematica.gui.materials=Materiales schematica.gui.materialamount=Cantidad # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Cargar esquema schematica.key.save=Guardar esquema diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 980ff353..76c5fe71 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Avaa kaavion sijainti schematica.gui.done=Valmis schematica.gui.title=Valitse kaavio tiedosto @@ -29,7 +29,45 @@ schematica.gui.materialname=Materiaali schematica.gui.materialamount=Määrä schematica.gui.printer=Tulostin -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Lataa kaava schematica.key.save=Tallenna kaava diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 8b00a610..f16c7b29 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Ouvrir le dossier schematic schematica.gui.done=Terminé schematica.gui.title=Sélectionner un schematic @@ -29,7 +29,45 @@ schematica.gui.materialname=Matériau schematica.gui.materialamount=Quantité schematica.gui.printer=Mode imprimante -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Charger un schematic schematica.key.save=Enregistrer le schematic diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 6f0d2794..51bf092b 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Klisé könyvtár megnyitása schematica.gui.done=Kész schematica.gui.title=Klisé megnyitása @@ -29,7 +29,45 @@ schematica.gui.materialname=Anyag schematica.gui.materialamount=Mennyiség schematica.gui.printer=Nyomtató -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Klisé betöltése schematica.key.save=Klisé mentése diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 386e36d3..39f58069 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Apri cartella schematiche schematica.gui.done=Fatto schematica.gui.title=Seleziona file schematico @@ -29,7 +29,45 @@ schematica.gui.materialname=Materiale schematica.gui.materialamount=Quantità # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Carica schematica schematica.key.save=Salva schematica diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 6b546ab6..b709c0a5 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general # schematica.gui.openFolder=Open schematic folder schematica.gui.done=Perfectus # schematica.gui.title=Select schematic file @@ -29,7 +29,45 @@ schematica.gui.point.blue=Caerulea res schematica.gui.materialamount=Numerus # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica # schematica.key.load=Load schematic # schematica.key.save=Save schematic diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 9b4aff44..f5156070 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Atidaryti schemø aplankà schematica.gui.done=Baigta schematica.gui.title=Pasirinkite schemos failà @@ -29,7 +29,45 @@ schematica.gui.materialname=Medþiaga schematica.gui.materialamount=Kiekis # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Atidaryti schemà schematica.key.save=Iðsaugoti schemà diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 2a43e93a..03b8ceac 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Open schematic map schematica.gui.done=Klaar schematica.gui.title=Selecteer schematic bestand @@ -29,7 +29,45 @@ schematica.gui.materialname=Materiaal schematica.gui.materialamount=Hoeveelheid # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Laad schematic schematica.key.save=Sla schematic op diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index dcc54093..9c59cbb8 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general # schematica.gui.openFolder=Open schematic folder # schematica.gui.done=Done # schematica.gui.title=Select schematic file @@ -29,7 +29,45 @@ schematica.gui.z=Z: # schematica.gui.materialamount=Amount # schematica.gui.printer=Printer -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica # schematica.key.load=Load schematic # schematica.key.save=Save schematic diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index d4bd5ea4..944eef68 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Otworz folder z schematami schematica.gui.done=Gotowe schematica.gui.title=Wybierz plik schematu @@ -29,7 +29,45 @@ schematica.gui.materials=Materialy schematica.gui.materialamount=Ilosc schematica.gui.printer=Drukarka -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Ladowanie schematu schematica.key.save=Zapisywanie schematu diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index a1c6a42c..e7a89aab 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Abrir pasta das schematicas schematica.gui.done=Feito schematica.gui.title=Selecionar schematica @@ -29,7 +29,45 @@ schematica.gui.materialname=Material schematica.gui.materialamount=Quantidade schematica.gui.printer=Modo de construçăo automática -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Carregar schematica schematica.key.save=Guardar schematica diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 762c7877..092a0cdd 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Открыть папку со схемами schematica.gui.done=Готово schematica.gui.title=Выберите файл схемы @@ -29,7 +29,45 @@ schematica.gui.materialname=Материал schematica.gui.materialamount=Количество schematica.gui.printer=Принтер -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys schematica.key.category=Schematica schematica.key.load=Загрузить схему schematica.key.save=Сохранить схему diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index f52d4fa6..8de35745 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Otvoriť priečinok so schématami schematica.gui.done=Hotovo schematica.gui.title=Vyberte schematický súbor @@ -29,7 +29,45 @@ schematica.gui.materialname=Materiál schematica.gui.materialamount=Množstvo schematica.gui.printer=Tlačiareň -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Načítať schému schematica.key.save=Uložiť schému diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index 9a48a380..f1dfc874 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Odpri shematično mapo schematica.gui.done=Končano schematica.gui.title=Izberi shematično datoteko @@ -29,7 +29,45 @@ schematica.gui.materialname=Material schematica.gui.materialamount=Količina schematica.gui.printer=Tiskalnik -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Naloži shemo schematica.key.save=Shrani shemo diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index a183a9c5..e17134e2 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=เปิดโฟลเดอร์ Schematic schematica.gui.done=เสร็จสิ้น schematica.gui.title=เลือกไฟล์ Schematic ที่ต้องการ @@ -29,7 +29,45 @@ schematica.gui.materialname=ส่วนประกอบ schematica.gui.materialamount=จำนวน schematica.gui.printer=การปริ๊น -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=เปิดไฟล์ Schematic schematica.key.save=บันทึกไฟล์ Schematic diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index e22a8148..fdd436ff 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Şematik klasörünü aç schematica.gui.done=Tamam schematica.gui.title=Şematik dosyasını seçin @@ -29,7 +29,45 @@ schematica.gui.materialname=Malzeme schematica.gui.materialamount=Miktar schematica.gui.printer=Yazıcı -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=Şematiki yükle schematica.key.save=Şematiki kaydet diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index c27895d0..6926ff24 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=Відкрити папку з технологічними схемами schematica.gui.done=Готово schematica.gui.title=вибррати файл технологічної схеми @@ -29,7 +29,45 @@ schematica.gui.materialname=Матеріал schematica.gui.materialamount=кількість schematica.gui.printer=Принтер -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=завантажити технологічну схему schematica.key.save=Зберегти технологічну схему diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 0e4ff753..406dd19d 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -1,4 +1,4 @@ -# GUI +# gui - general schematica.gui.openFolder=打开Schematic文件夹 schematica.gui.done=完成 schematica.gui.title=选择Schematic文件 @@ -29,7 +29,45 @@ schematica.gui.materialname=材料 schematica.gui.materialamount=数量 schematica.gui.printer=投影 -# Keys +# gui - config - categories +# schematica.config.category.render=Rendering +# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.printer=Printer +# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.general=General +# schematica.config.category.general.tooltip=General settings. + +# gui - config - render +# schematica.config.alphaEnabled=Alpha Enabled +# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alpha=Alpha +# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +# schematica.config.highlight=Highlight Blocks +# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +# schematica.config.highlightAir=Highlight Air +# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.blockDelta=Block Delta +# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +# schematica.config.drawQuads=Draw Quads +# schematica.config.drawQuads.tooltip=Draw surface areas. +# schematica.config.drawLines=Draw Lines +# schematica.config.drawLines.tooltip=Draw outlines. + +# gui - config - printer +# schematica.config.placeDelay=Placement Delay +# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.timeout=Timeout +# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +# schematica.config.placeInstantly=Place Instantly +# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.placeAdjacent=Place Only Adjacent +# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. + +# gui - config - general +# schematica.config.schematicDirectory=Schematic Directory +# schematica.config.schematicDirectory.tooltip=Schematic directory. + +# keys # schematica.key.category=Schematica schematica.key.load=载入Schematic文件 schematica.key.save=保存Schematic文件 From 22f924106ab11199d4376fdece2ff63d4c4fea8f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 16 Jul 2014 20:26:08 +0200 Subject: [PATCH 033/314] Moved a few fields from the settings class into appropriate event handlers and proxies. Tweaked a few GUI classes. --- .../github/lunatrius/schematica/Settings.java | 15 +------------- .../client/gui/GuiSchematicLoad.java | 3 ++- .../client/gui/GuiSchematicLoadSlot.java | 14 +++++-------- .../client/gui/GuiSchematicMaterialsSlot.java | 12 ++++------- .../client/gui/GuiSchematicSave.java | 3 ++- .../handler/client/ChatEventHandler.java | 12 +++++------ .../handler/client/KeyInputHandler.java | 2 +- .../handler/client/TickHandler.java | 17 ++++++++-------- .../schematica/proxy/ClientProxy.java | 20 ++++++++++++++++--- .../schematica/proxy/CommonProxy.java | 8 ++++++++ 10 files changed, 54 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index 4138bc41..47906b55 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -52,14 +52,6 @@ public class Settings { @Deprecated public boolean isRenderingGuide = false; @Deprecated - public int chatLines = 0; - @Deprecated - public boolean isSaveEnabled = true; - @Deprecated - public boolean isLoadEnabled = true; - @Deprecated - public boolean isPendingReset = false; - @Deprecated public int[] increments = { 1, 5, 15, 50, 250 }; @@ -70,17 +62,12 @@ private Settings() { @Deprecated public void reset() { - this.chatLines = 0; - SchematicPrinter.INSTANCE.setEnabled(true); - this.isSaveEnabled = true; - this.isLoadEnabled = true; + Schematica.proxy.resetSettings(); this.isRenderingGuide = false; - Schematica.proxy.setActiveSchematic(null); this.renderBlocks = null; while (this.sortedRendererSchematicChunk.size() > 0) { this.sortedRendererSchematicChunk.remove(0).delete(); } - SchematicPrinter.INSTANCE.setSchematic(null); } @Deprecated diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 78b01ba7..c5474740 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.schematica.FileFilterSchematic; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; @@ -74,7 +75,7 @@ protected void actionPerformed(GuiButton guiButton) { Sys.openURL("file://" + ConfigurationHandler.schematicDirectory.getAbsolutePath()); } } else if (guiButton.id == this.btnDone.id) { - if (this.settings.isLoadEnabled) { + if (Schematica.proxy.isLoadEnabled) { loadSchematic(); } this.mc.displayGuiScreen(this.prevGuiScreen); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java index fa70afcc..602d16de 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java @@ -1,22 +1,18 @@ package com.github.lunatrius.schematica.client.gui; -import com.github.lunatrius.schematica.Settings; -import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureManager; public class GuiSchematicLoadSlot extends GuiSlot { - private final Settings settings = Settings.instance; - private final FontRenderer fontRenderer = this.settings.minecraft.fontRenderer; - private final TextureManager renderEngine = this.settings.minecraft.renderEngine; + private final Minecraft minecraft = Minecraft.getMinecraft(); private final GuiSchematicLoad guiSchematicLoad; protected int selectedIndex = -1; public GuiSchematicLoadSlot(GuiSchematicLoad guiSchematicLoad) { - super(Settings.instance.minecraft, guiSchematicLoad.width, guiSchematicLoad.height, 16, guiSchematicLoad.height - 40, 24); + super(Minecraft.getMinecraft(), guiSchematicLoad.width, guiSchematicLoad.height, 16, guiSchematicLoad.height - 40, 24); this.guiSchematicLoad = guiSchematicLoad; } @@ -64,8 +60,8 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); } - GuiHelper.drawItemStack(this.renderEngine, this.fontRenderer, x, y, schematic.getItemStack()); + GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, schematic.getItemStack()); - this.guiSchematicLoad.drawString(this.settings.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); + this.guiSchematicLoad.drawString(this.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index 29b19f91..3ec9d878 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -1,16 +1,12 @@ package com.github.lunatrius.schematica.client.gui; -import com.github.lunatrius.schematica.Settings; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; class GuiSchematicMaterialsSlot extends GuiSlot { - private final FontRenderer fontRenderer = Settings.instance.minecraft.fontRenderer; - private final TextureManager renderEngine = Settings.instance.minecraft.renderEngine; + private final Minecraft minecraft = Minecraft.getMinecraft(); private final GuiSchematicMaterials guiSchematicMaterials; @@ -58,9 +54,9 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat itemName = "Unknown"; } - GuiHelper.drawItemStack(this.renderEngine, this.fontRenderer, x, y, itemStack); + GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, itemStack); - this.guiSchematicMaterials.drawString(this.fontRenderer, itemName, x + 24, y + 6, 16777215); - this.guiSchematicMaterials.drawString(this.fontRenderer, amount, x + 215 - this.fontRenderer.getStringWidth(amount), y + 6, 16777215); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 16777215); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 6, 16777215); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 3b1f92bc..8822c184 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.gui; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import net.minecraft.client.gui.GuiButton; @@ -212,7 +213,7 @@ protected void actionPerformed(GuiButton guiButton) { this.incrementBZ = (this.incrementBZ + 1) % this.settings.increments.length; this.btnAmountBZ.displayString = Integer.toString(this.settings.increments[this.incrementBZ]); } else if (guiButton.id == this.btnEnable.id) { - this.settings.isRenderingGuide = !this.settings.isRenderingGuide && this.settings.isSaveEnabled; + this.settings.isRenderingGuide = !this.settings.isRenderingGuide && Schematica.proxy.isSaveEnabled; this.btnEnable.displayString = I18n.format(this.settings.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable"); this.btnSave.enabled = this.settings.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 372f27dd..28402561 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.handler.client; import com.github.lunatrius.schematica.SchematicPrinter; -import com.github.lunatrius.schematica.Settings; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.lib.Reference; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -11,13 +11,11 @@ public class ChatEventHandler { public static final String SBC_DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; public static final String SBC_DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; - private final Settings settings = Settings.instance; + public static int chatLines = 0; @SubscribeEvent public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { - this.settings.chatLines++; - - if (this.settings.chatLines < 10) { + if (chatLines++ < 10) { String message = event.message.getFormattedText(); if (message.contains(SBC_DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); @@ -25,11 +23,11 @@ public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { } if (message.contains(SBC_DISABLE_SAVE)) { Reference.logger.info("Saving is disabled on this server."); - this.settings.isSaveEnabled = false; + Schematica.proxy.isSaveEnabled = false; } if (message.contains(SBC_DISABLE_LOAD)) { Reference.logger.info("Loading is disabled on this server."); - this.settings.isLoadEnabled = false; + Schematica.proxy.isLoadEnabled = false; } } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index a929c75a..2dbe3e33 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -28,7 +28,7 @@ public class KeyInputHandler { private final Minecraft minecraft = Minecraft.getMinecraft(); @SubscribeEvent - public void keyInput(KeyInputEvent event) { + public void onKeyInput(KeyInputEvent event) { for (KeyBinding keyBinding : KEY_BINDINGS) { if (keyBinding.isPressed()) { if (this.minecraft.currentScreen == null) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index b778ec8c..d11356d8 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; @@ -23,19 +24,19 @@ public TickHandler() { } @SubscribeEvent - public void clientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { + public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { Reference.logger.info("Scheduling client settings reset."); - Settings.instance.isPendingReset = true; + ClientProxy.isPendingReset = true; } @SubscribeEvent - public void clientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { + public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { Reference.logger.info("Scheduling client settings reset."); - Settings.instance.isPendingReset = true; + ClientProxy.isPendingReset = true; } @SubscribeEvent - public void clientTick(TickEvent.ClientTickEvent event) { + public void onClientTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.minecraft.mcProfiler.startSection("schematica"); SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); @@ -57,9 +58,9 @@ public void clientTick(TickEvent.ClientTickEvent event) { this.minecraft.mcProfiler.endSection(); } - if (Settings.instance.isPendingReset) { - Settings.instance.reset(); - Settings.instance.isPendingReset = false; + if (ClientProxy.isPendingReset) { + Schematica.proxy.resetSettings(); + ClientProxy.isPendingReset = false; } this.minecraft.mcProfiler.endSection(); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 8b9d3c18..a6bb4da2 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; @@ -17,8 +18,9 @@ import java.io.File; public class ClientProxy extends CommonProxy { - private RendererSchematicGlobal rendererSchematicGlobal = null; private SchematicWorld schematicWorld = null; + public static boolean isPendingReset = false; + public static RendererSchematicGlobal rendererSchematicGlobal = null; @Override public void setConfigEntryClasses() { @@ -41,8 +43,8 @@ public void registerEvents() { FMLCommonHandler.instance().bus().register(new TickHandler()); FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); - this.rendererSchematicGlobal = new RendererSchematicGlobal(); - MinecraftForge.EVENT_BUS.register(this.rendererSchematicGlobal); + rendererSchematicGlobal = new RendererSchematicGlobal(); + MinecraftForge.EVENT_BUS.register(rendererSchematicGlobal); MinecraftForge.EVENT_BUS.register(new ChatEventHandler()); } @@ -51,6 +53,18 @@ public File getDataDirectory() { return Minecraft.getMinecraft().mcDataDir; } + @Override + public void resetSettings() { + super.resetSettings(); + + ChatEventHandler.chatLines = 0; + + SchematicPrinter.INSTANCE.setEnabled(true); + SchematicPrinter.INSTANCE.setSchematic(null); + + setActiveSchematic(null); + } + @Override public void setActiveSchematic(SchematicWorld world) { this.schematicWorld = world; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 97d5bef6..73ab4d09 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -9,6 +9,9 @@ import java.io.File; public abstract class CommonProxy { + public boolean isSaveEnabled = true; + public boolean isLoadEnabled = true; + public abstract void setConfigEntryClasses(); public abstract void registerKeybindings(); @@ -27,6 +30,11 @@ public File getDataDirectory() { return MinecraftServer.getServer().getFile("."); } + public void resetSettings() { + this.isSaveEnabled = true; + this.isLoadEnabled = true; + } + public abstract void setActiveSchematic(SchematicWorld world); public abstract void setActiveSchematic(SchematicWorld world, EntityPlayer player); From ebaf20a2196f79ce952f0ba9356f5b1dea2017b7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 16 Jul 2014 20:32:05 +0200 Subject: [PATCH 034/314] This is not really a success variable... --- .../lunatrius/schematica/client/gui/GuiSchematicLoad.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index c5474740..21ebaa6a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -60,17 +60,17 @@ public void initGui() { protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnOpenDir.id) { - boolean success = false; + boolean retry = false; try { Class c = Class.forName("java.awt.Desktop"); Object m = c.getMethod("getDesktop").invoke(null); c.getMethod("browse", URI.class).invoke(m, ConfigurationHandler.schematicDirectory.toURI()); } catch (Throwable e) { - success = true; + retry = true; } - if (success) { + if (retry) { Reference.logger.info("Opening via Sys class!"); Sys.openURL("file://" + ConfigurationHandler.schematicDirectory.getAbsolutePath()); } From c9505653023c696dba2494a48e2d1a3e47140048 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 16 Jul 2014 22:11:38 +0200 Subject: [PATCH 035/314] Moved render related fields and methods into RendererSchematicGlobal. Moved schematic loading/saving into the proxies. --- .../github/lunatrius/schematica/Settings.java | 155 ------------------ .../client/gui/GuiSchematicControl.java | 23 +-- .../client/gui/GuiSchematicLoad.java | 2 +- .../client/gui/GuiSchematicSave.java | 2 +- .../renderer/RendererSchematicChunk.java | 3 +- .../RendererSchematicChunkSorter.java | 14 +- .../renderer/RendererSchematicGlobal.java | 43 ++++- .../handler/client/TickHandler.java | 2 +- .../schematica/proxy/ClientProxy.java | 50 ++++++ .../schematica/proxy/CommonProxy.java | 63 +++++++ .../schematica/proxy/ServerProxy.java | 12 ++ .../schematica/world/SchematicWorld.java | 4 + .../world/schematic/SchematicFormat.java | 2 +- 13 files changed, 193 insertions(+), 182 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index 47906b55..a2a01ce6 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -1,25 +1,10 @@ package com.github.lunatrius.schematica; import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; -import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import com.github.lunatrius.schematica.world.schematic.SchematicFormat; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - @Deprecated public class Settings { @Deprecated @@ -32,10 +17,6 @@ public class Settings { @Deprecated public Vector3f playerPosition = new Vector3f(); @Deprecated - public final List sortedRendererSchematicChunk = new ArrayList(); - @Deprecated - public RenderBlocks renderBlocks = null; - @Deprecated public Vector3f pointA = new Vector3f(); @Deprecated public Vector3f pointB = new Vector3f(); @@ -60,135 +41,6 @@ public class Settings { private Settings() { } - @Deprecated - public void reset() { - Schematica.proxy.resetSettings(); - this.isRenderingGuide = false; - this.renderBlocks = null; - while (this.sortedRendererSchematicChunk.size() > 0) { - this.sortedRendererSchematicChunk.remove(0).delete(); - } - } - - @Deprecated - public void createRendererSchematicChunk() { - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - int width = (schematic.getWidth() - 1) / RendererSchematicChunk.CHUNK_WIDTH + 1; - int height = (schematic.getHeight() - 1) / RendererSchematicChunk.CHUNK_HEIGHT + 1; - int length = (schematic.getLength() - 1) / RendererSchematicChunk.CHUNK_LENGTH + 1; - - while (this.sortedRendererSchematicChunk.size() > 0) { - this.sortedRendererSchematicChunk.remove(0).delete(); - } - - int x, y, z; - for (x = 0; x < width; x++) { - for (y = 0; y < height; y++) { - for (z = 0; z < length; z++) { - this.sortedRendererSchematicChunk.add(new RendererSchematicChunk(schematic, x, y, z)); - } - } - } - } - - @Deprecated - public boolean loadSchematic(String filename) { - try { - InputStream stream = new FileInputStream(filename); - NBTTagCompound tagCompound = CompressedStreamTools.readCompressed(stream); - - if (tagCompound != null) { - Reference.logger.info(tagCompound); - - SchematicWorld schematic = SchematicFormat.readFromFile(new File(filename)); - Schematica.proxy.setActiveSchematic(schematic); - - Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, schematic.getWidth(), schematic.getHeight(), schematic.getLength())); - - this.renderBlocks = new RenderBlocks(schematic); - - createRendererSchematicChunk(); - - schematic.setRendering(true); - - SchematicPrinter.INSTANCE.setSchematic(schematic); - } - } catch (Exception e) { - Reference.logger.fatal("Failed to load schematic!", e); - reset(); - return false; - } - - return true; - } - - @Deprecated - public boolean saveSchematic(File directory, String filename, Vector3f from, Vector3f to) { - try { - int minX = (int) Math.min(from.x, to.x); - int maxX = (int) Math.max(from.x, to.x); - int minY = (int) Math.min(from.y, to.y); - int maxY = (int) Math.max(from.y, to.y); - int minZ = (int) Math.min(from.z, to.z); - int maxZ = (int) Math.max(from.z, to.z); - short width = (short) (Math.abs(maxX - minX) + 1); - short height = (short) (Math.abs(maxY - minY) + 1); - short length = (short) (Math.abs(maxZ - minZ) + 1); - - short[][][] blocks = new short[width][height][length]; - byte[][][] metadata = new byte[width][height][length]; - List tileEntities = new ArrayList(); - TileEntity tileEntity = null; - NBTTagCompound tileEntityNBT = null; - - for (int x = minX; x <= maxX; x++) { - for (int y = minY; y <= maxY; y++) { - for (int z = minZ; z <= maxZ; z++) { - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(this.minecraft.theWorld.getBlock(x, y, z)); - metadata[x - minX][y - minY][z - minZ] = (byte) this.minecraft.theWorld.getBlockMetadata(x, y, z); - tileEntity = this.minecraft.theWorld.getTileEntity(x, y, z); - if (tileEntity != null) { - try { - tileEntityNBT = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityNBT); - - tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); - tileEntity.xCoord -= minX; - tileEntity.yCoord -= minY; - tileEntity.zCoord -= minZ; - tileEntities.add(tileEntity); - } catch (Exception e) { - Reference.logger.error("Error while trying to save tile entity " + tileEntity + "!", e); - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); - metadata[x - minX][y - minY][z - minZ] = 0; - } - } - } - } - } - - String iconName = ""; - - try { - String[] parts = filename.split(";"); - if (parts.length == 2) { - iconName = parts[0]; - filename = parts[1]; - } - } catch (Exception e) { - Reference.logger.error("Failed to parse icon data!", e); - } - - SchematicWorld schematicOut = new SchematicWorld(iconName, blocks, metadata, tileEntities, width, height, length); - - SchematicFormat.writeToFile(directory, filename, schematicOut); - } catch (Exception e) { - Reference.logger.error("Failed to save schematic!", e); - return false; - } - return true; - } - @Deprecated public Vector3f getTranslationVector() { this.translationVector.set(this.playerPosition).sub(this.offset); @@ -210,13 +62,6 @@ public float getTranslationZ() { return this.playerPosition.z - this.offset.z; } - @Deprecated - public void refreshSchematic() { - for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { - renderer.setDirty(); - } - } - @Deprecated public void updatePoints() { this.pointMin.x = Math.min(this.pointA.x, this.pointB.x); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 607775a9..e5759f95 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -3,6 +3,7 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -138,28 +139,28 @@ protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDecX.id) { this.settings.offset.x -= this.settings.increments[this.incrementX]; - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncX.id) { this.settings.offset.x += this.settings.increments[this.incrementX]; - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountX.id) { this.incrementX = (this.incrementX + 1) % this.settings.increments.length; this.btnAmountX.displayString = Integer.toString(this.settings.increments[this.incrementX]); } else if (guiButton.id == this.btnDecY.id) { this.settings.offset.y -= this.settings.increments[this.incrementY]; - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncY.id) { this.settings.offset.y += this.settings.increments[this.incrementY]; - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountY.id) { this.incrementY = (this.incrementY + 1) % this.settings.increments.length; this.btnAmountY.displayString = Integer.toString(this.settings.increments[this.incrementY]); } else if (guiButton.id == this.btnDecZ.id) { this.settings.offset.z -= this.settings.increments[this.incrementZ]; - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncZ.id) { this.settings.offset.z += this.settings.increments[this.incrementZ]; - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountZ.id) { this.incrementZ = (this.incrementZ + 1) % this.settings.increments.length; this.btnAmountZ.displayString = Integer.toString(this.settings.increments[this.incrementZ]); @@ -167,27 +168,27 @@ protected void actionPerformed(GuiButton guiButton) { if (this.schematic != null) { this.schematic.decrementRenderingLayer(); } - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncLayer.id) { if (this.schematic != null) { this.schematic.incrementRenderingLayer(); } - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnHide.id) { this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); } else if (guiButton.id == this.btnMove.id) { this.settings.moveHere(); - this.settings.refreshSchematic(); + ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnFlip.id) { if (this.schematic != null) { this.schematic.flip(); - this.settings.createRendererSchematicChunk(); + ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); SchematicPrinter.INSTANCE.refresh(); } } else if (guiButton.id == this.btnRotate.id) { if (this.schematic != null) { this.schematic.rotate(); - this.settings.createRendererSchematicChunk(); + ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); SchematicPrinter.INSTANCE.refresh(); } } else if (guiButton.id == this.btnMaterials.id) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 21ebaa6a..524161fb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -156,7 +156,7 @@ private void loadSchematic() { try { if (selectedIndex >= 0 && selectedIndex < this.schematicFiles.size()) { GuiSchematicEntry schematic = this.schematicFiles.get(selectedIndex); - this.settings.loadSchematic((new File(this.currentDirectory, schematic.getName())).getCanonicalPath()); + Schematica.proxy.loadSchematic(null, this.currentDirectory, schematic.getName()); } } catch (Exception e) { Reference.logger.error("Failed to load schematic!", e); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 8822c184..a7fbfea5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -218,7 +218,7 @@ protected void actionPerformed(GuiButton guiButton) { this.btnSave.enabled = this.settings.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; - if (this.settings.saveSchematic(ConfigurationHandler.schematicDirectory, path, this.settings.pointMin, this.settings.pointMax)) { + if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, this.settings.pointMin, this.settings.pointMax)) { this.filename = ""; this.tfFilename.setText(this.filename); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index c8f9c68a..353e3a06 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -4,6 +4,7 @@ import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.block.Block; @@ -221,7 +222,7 @@ public void render(int renderPass) { public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { IBlockAccess mcWorld = this.minecraft.theWorld; - RenderBlocks renderBlocks = this.settings.renderBlocks; + RenderBlocks renderBlocks = ClientProxy.rendererSchematicGlobal.renderBlocks; int x, y, z, wx, wy, wz; int sides; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java index b106c60e..c6120afe 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java @@ -8,21 +8,21 @@ public class RendererSchematicChunkSorter implements Comparator { private final Settings settings = Settings.instance; - public int doCompare(RendererSchematicChunk par1RendererSchematicChunk, RendererSchematicChunk par2RendererSchematicChunk) { - if (par1RendererSchematicChunk.isInFrustrum && !par2RendererSchematicChunk.isInFrustrum) { + public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { + if (rendererSchematicChunk1.isInFrustrum && !rendererSchematicChunk2.isInFrustrum) { return -1; - } else if (!par1RendererSchematicChunk.isInFrustrum && par2RendererSchematicChunk.isInFrustrum) { + } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { return 1; } else { Vector3f position = this.settings.playerPosition.clone().sub(this.settings.offset); - double dist1 = par1RendererSchematicChunk.distanceToPoint(position); - double dist2 = par2RendererSchematicChunk.distanceToPoint(position); + double dist1 = rendererSchematicChunk1.distanceToPoint(position); + double dist2 = rendererSchematicChunk2.distanceToPoint(position); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } } @Override - public int compare(Object par1Obj, Object par2Obj) { - return doCompare((RendererSchematicChunk) par1Obj, (RendererSchematicChunk) par2Obj); + public int compare(Object obj1, Object obj2) { + return doCompare((RendererSchematicChunk) obj1, (RendererSchematicChunk) obj2); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 87b3f101..cff9c5c5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -7,6 +7,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.culling.Frustrum; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.profiler.Profiler; @@ -15,7 +16,9 @@ import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; +import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class RendererSchematicGlobal { private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -23,6 +26,8 @@ public class RendererSchematicGlobal { private final Profiler profiler = this.minecraft.mcProfiler; private final Frustrum frustrum = new Frustrum(); + public RenderBlocks renderBlocks = null; + public final List sortedRendererSchematicChunk = new ArrayList(); private final RendererSchematicChunkSorter rendererSchematicChunkSorter = new RendererSchematicChunkSorter(); @SubscribeEvent @@ -88,7 +93,7 @@ public void render(SchematicWorld schematic) { this.profiler.endStartSection("render"); int pass; for (pass = 0; pass < 3; pass++) { - for (RendererSchematicChunk renderer : this.settings.sortedRendererSchematicChunk) { + for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { renderer.render(pass); } } @@ -166,19 +171,49 @@ public void render(SchematicWorld schematic) { private void updateFrustrum() { this.frustrum.setPosition(this.settings.getTranslationX(), this.settings.getTranslationY(), this.settings.getTranslationZ()); - for (RendererSchematicChunk rendererSchematicChunk : this.settings.sortedRendererSchematicChunk) { + for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { rendererSchematicChunk.isInFrustrum = this.frustrum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); } } private void sortAndUpdate() { - Collections.sort(this.settings.sortedRendererSchematicChunk, this.rendererSchematicChunkSorter); + Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkSorter); - for (RendererSchematicChunk rendererSchematicChunk : this.settings.sortedRendererSchematicChunk) { + for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { if (rendererSchematicChunk.getDirty()) { rendererSchematicChunk.updateRenderer(); break; } } } + + public void createRendererSchematicChunks(SchematicWorld schematic) { + int width = (schematic.getWidth() - 1) / RendererSchematicChunk.CHUNK_WIDTH + 1; + int height = (schematic.getHeight() - 1) / RendererSchematicChunk.CHUNK_HEIGHT + 1; + int length = (schematic.getLength() - 1) / RendererSchematicChunk.CHUNK_LENGTH + 1; + + destroyRendererSchematicChunks(); + + this.renderBlocks = new RenderBlocks(schematic); + for (int y = 0; y < height; y++) { + for (int z = 0; z < length; z++) { + for (int x = 0; x < width; x++) { + this.sortedRendererSchematicChunk.add(new RendererSchematicChunk(schematic, x, y, z)); + } + } + } + } + + public void destroyRendererSchematicChunks() { + this.renderBlocks = null; + while (this.sortedRendererSchematicChunk.size() > 0) { + this.sortedRendererSchematicChunk.remove(0).delete(); + } + } + + public void refresh() { + for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { + renderer.setDirty(); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index d11356d8..b0dcabe7 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -74,7 +74,7 @@ private void checkDirty() { for (WorldRenderer worldRenderer : renderers) { if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-Settings.instance.offset.x, -Settings.instance.offset.y, -Settings.instance.offset.z); - for (RendererSchematicChunk renderer : Settings.instance.sortedRendererSchematicChunk) { + for (RendererSchematicChunk renderer : ClientProxy.rendererSchematicGlobal.sortedRendererSchematicChunk) { if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { renderer.setDirty(); } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index a6bb4da2..4ec9acce 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,18 +1,23 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.SchematicPrinter; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.KeyInputHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; +import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import cpw.mods.fml.client.config.GuiConfigEntries; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import java.io.File; @@ -62,9 +67,54 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setEnabled(true); SchematicPrinter.INSTANCE.setSchematic(null); + ClientProxy.rendererSchematicGlobal.destroyRendererSchematicChunks(); + setActiveSchematic(null); } + @Override + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3f from, Vector3f to) { + try { + String iconName = ""; + + try { + String[] parts = filename.split(";"); + if (parts.length == 2) { + iconName = parts[0]; + filename = parts[1]; + } + } catch (Exception e) { + Reference.logger.error("Failed to parse icon data!", e); + } + + SchematicWorld schematic = getSchematicFromWorld(world, from, to); + schematic.setIcon(SchematicWorld.getIconFromName(iconName)); + SchematicFormat.writeToFile(directory, filename, schematic); + + return true; + } catch (Exception e) { + Reference.logger.error("Failed to save schematic!", e); + } + return false; + } + + @Override + public boolean loadSchematic(EntityPlayer player, File directory, String filename) { + SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); + if (schematic == null) { + return false; + } + + Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, schematic.getWidth(), schematic.getHeight(), schematic.getLength())); + + Schematica.proxy.setActiveSchematic(schematic); + rendererSchematicGlobal.createRendererSchematicChunks(schematic); + SchematicPrinter.INSTANCE.setSchematic(schematic); + schematic.setRendering(true); + + return true; + } + @Override public void setActiveSchematic(SchematicWorld world) { this.schematicWorld = world; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 73ab4d09..10fbf5a0 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,12 +1,20 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.registry.GameData; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; import java.io.File; +import java.util.ArrayList; +import java.util.List; public abstract class CommonProxy { public boolean isSaveEnabled = true; @@ -35,6 +43,61 @@ public void resetSettings() { this.isLoadEnabled = true; } + public SchematicWorld getSchematicFromWorld(World world, Vector3f from, Vector3f to) { + try { + int minX = (int) Math.min(from.x, to.x); + int maxX = (int) Math.max(from.x, to.x); + int minY = (int) Math.min(from.y, to.y); + int maxY = (int) Math.max(from.y, to.y); + int minZ = (int) Math.min(from.z, to.z); + int maxZ = (int) Math.max(from.z, to.z); + short width = (short) (Math.abs(maxX - minX) + 1); + short height = (short) (Math.abs(maxY - minY) + 1); + short length = (short) (Math.abs(maxZ - minZ) + 1); + + short[][][] blocks = new short[width][height][length]; + byte[][][] metadata = new byte[width][height][length]; + List tileEntities = new ArrayList(); + + for (int x = minX; x <= maxX; x++) { + for (int y = minY; y <= maxY; y++) { + for (int z = minZ; z <= maxZ; z++) { + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(world.getBlock(x, y, z)); + metadata[x - minX][y - minY][z - minZ] = (byte) world.getBlockMetadata(x, y, z); + + TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + try { + NBTTagCompound tileEntityNBT = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityNBT); + + tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); + tileEntity.xCoord -= minX; + tileEntity.yCoord -= minY; + tileEntity.zCoord -= minZ; + tileEntities.add(tileEntity); + } catch (Exception e) { + Reference.logger.error(String.format("Error while trying to save tile entity %s!", tileEntity), e); + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); + metadata[x - minX][y - minY][z - minZ] = 0; + } + } + } + } + } + + return new SchematicWorld("", blocks, metadata, tileEntities, width, height, length); + } catch (Exception e) { + Reference.logger.error("Failed to extract schematic!", e); + } + + return null; + } + + public abstract boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3f from, Vector3f to); + + public abstract boolean loadSchematic(EntityPlayer player, File directory, String filename); + public abstract void setActiveSchematic(SchematicWorld world); public abstract void setActiveSchematic(SchematicWorld world, EntityPlayer player); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 46856e5e..239f12a8 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,8 +1,10 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; import java.io.File; @@ -24,6 +26,16 @@ public File getDataDirectory() { return MinecraftServer.getServer().getFile("."); } + @Override + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3f from, Vector3f to) { + return false; + } + + @Override + public boolean loadSchematic(EntityPlayer player, File directory, String filename) { + return false; + } + @Override public void setActiveSchematic(SchematicWorld world) { } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 79339b64..2882e943 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -386,6 +386,10 @@ public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _de return block.isSideSolid(this, x, y, z, side); } + public void setIcon(ItemStack icon) { + this.icon = icon; + } + public ItemStack getIcon() { return this.icon; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 092558cd..bb78e29d 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -44,7 +44,7 @@ public static SchematicWorld readFromFile(File file) { return null; } - public static SchematicWorld readFromFile(String directory, String filename) { + public static SchematicWorld readFromFile(File directory, String filename) { return readFromFile(new File(directory, filename)); } From 22ff61818b44304801c69645d98febfcab6b7f26 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 17 Jul 2014 10:42:43 +0200 Subject: [PATCH 036/314] Updated minimum forge required. --- build.properties | 2 +- src/main/java/com/github/lunatrius/schematica/Schematica.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index ff6c7a31..421009cd 100644 --- a/build.properties +++ b/build.properties @@ -3,7 +3,7 @@ version.minor=7 version.micro=0 version.minecraft=1.7.10 version.forge=10.13.0.1180 -version.minforge=10.13.0.1180 +version.minforge=10.13.0.1185 version.lunatriuscore=1.1.0.8 extra.fmlat=schematica_at.cfg diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 7c22df38..b388d497 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -22,7 +22,7 @@ public class Schematica { @EventHandler public void preInit(FMLPreInitializationEvent event) { - VersionChecker.registerMod(event.getModMetadata()); + VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); Reference.logger = event.getModLog(); From 4470c490b1cd75a3e201de10c5cd3fde7fc135ce Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 17 Jul 2014 12:07:58 +0200 Subject: [PATCH 037/314] Moved over more stuff from the Settings class. On the control GUI buttons are no longer clickable if a schematic is not loaded, values default to 0/0/0. Exposed a few fields for some performance gains, no use encapsulating those anyway. --- .../schematica/SchematicPrinter.java | 30 +++---- .../github/lunatrius/schematica/Settings.java | 86 ++++++------------- .../client/gui/GuiSchematicControl.java | 40 ++++++--- .../client/gui/GuiSchematicLoad.java | 2 +- .../client/gui/GuiSchematicSave.java | 11 +-- .../renderer/RendererSchematicChunk.java | 17 ++-- .../RendererSchematicChunkSorter.java | 18 ++-- .../renderer/RendererSchematicGlobal.java | 72 ++++++---------- .../handler/client/TickHandler.java | 9 +- .../schematica/proxy/ClientProxy.java | 48 ++++++++++- .../schematica/proxy/CommonProxy.java | 18 ++-- .../schematica/proxy/ServerProxy.java | 4 +- .../schematica/world/SchematicWorld.java | 24 ++---- 13 files changed, 186 insertions(+), 193 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 57dd7cd0..1142047a 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -1,8 +1,10 @@ package com.github.lunatrius.schematica; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.config.PlacementData; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -30,7 +32,6 @@ public class SchematicPrinter { public static final SchematicPrinter INSTANCE = new SchematicPrinter(); private final Minecraft minecraft = Minecraft.getMinecraft(); - private final Settings settings = Settings.instance; private boolean isEnabled; private boolean isPrinting; @@ -85,17 +86,18 @@ public boolean print() { syncSneaking(player, true); - minX = Math.max(0, (int) this.settings.getTranslationX() - 3); - maxX = Math.min(this.schematic.getWidth(), (int) this.settings.getTranslationX() + 3); - minY = Math.max(0, (int) this.settings.getTranslationY() - 3); - maxY = Math.min(this.schematic.getHeight(), (int) this.settings.getTranslationY() + 3); - minZ = Math.max(0, (int) this.settings.getTranslationZ() - 3); - maxZ = Math.min(this.schematic.getLength(), (int) this.settings.getTranslationZ() + 3); + Vector3i trans = ClientProxy.playerPosition.sub(this.schematic.position.toVector3f()).toVector3i(); + minX = Math.max(0, trans.x - 3); + maxX = Math.min(this.schematic.getWidth(), trans.x + 4); + minY = Math.max(0, trans.y - 3); + maxY = Math.min(this.schematic.getHeight(), trans.y + 4); + minZ = Math.max(0, trans.z - 3); + maxZ = Math.min(this.schematic.getLength(), trans.z + 4); slot = player.inventory.currentItem; isSneaking = player.isSneaking(); - int renderingLayer = this.schematic.getRenderingLayer(); + int renderingLayer = this.schematic.renderingLayer; for (y = minY; y < maxY; y++) { if (renderingLayer >= 0) { if (y != renderingLayer) { @@ -116,9 +118,9 @@ public boolean print() { continue; } - wx = (int) this.settings.offset.x + x; - wy = (int) this.settings.offset.y + y; - wz = (int) this.settings.offset.z + z; + wx = this.schematic.position.x + x; + wy = this.schematic.position.y + y; + wz = this.schematic.position.z + z; Block realBlock = world.getBlock(wx, wy, wz); if (!world.isAirBlock(wx, wy, wz) && realBlock != null && !realBlock.canPlaceBlockAt(world, wx, wy, wz)) { @@ -232,8 +234,6 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player } private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, PlacementData data, int metadata) { - ForgeDirection orientation = this.settings.orientation; - if (data != null) { switch (data.type) { case BLOCK: { @@ -241,7 +241,7 @@ private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, Pla } case PLAYER: { - Integer integer = data.mapping.get(orientation); + Integer integer = data.mapping.get(ClientProxy.orientation); if (integer != null) { return integer == (metadata & data.maskMeta); } @@ -249,7 +249,7 @@ private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, Pla } case PISTON: { - Integer integer = data.mapping.get(orientation); + Integer integer = data.mapping.get(ClientProxy.orientation); if (integer != null) { return BlockPistonBase.determineOrientation(null, x, y, z, player) == BlockPistonBase.getPistonOrientation(metadata); } diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java index a2a01ce6..e5cb8e22 100644 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ b/src/main/java/com/github/lunatrius/schematica/Settings.java @@ -1,9 +1,8 @@ package com.github.lunatrius.schematica; -import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; -import net.minecraft.client.Minecraft; -import net.minecraftforge.common.util.ForgeDirection; @Deprecated public class Settings { @@ -11,27 +10,13 @@ public class Settings { public static final Settings instance = new Settings(); @Deprecated - private final Vector3f translationVector = new Vector3f(); + public Vector3i pointA = new Vector3i(); @Deprecated - public Minecraft minecraft = Minecraft.getMinecraft(); + public Vector3i pointB = new Vector3i(); @Deprecated - public Vector3f playerPosition = new Vector3f(); + public Vector3i pointMin = new Vector3i(); @Deprecated - public Vector3f pointA = new Vector3f(); - @Deprecated - public Vector3f pointB = new Vector3f(); - @Deprecated - public Vector3f pointMin = new Vector3f(); - @Deprecated - public Vector3f pointMax = new Vector3f(); - @Deprecated - public int rotationRender = 0; - @Deprecated - public ForgeDirection orientation = ForgeDirection.UNKNOWN; - @Deprecated - public Vector3f offset = new Vector3f(); - @Deprecated - public boolean isRenderingGuide = false; + public Vector3i pointMax = new Vector3i(); @Deprecated public int[] increments = { 1, 5, 15, 50, 250 @@ -41,27 +26,6 @@ public class Settings { private Settings() { } - @Deprecated - public Vector3f getTranslationVector() { - this.translationVector.set(this.playerPosition).sub(this.offset); - return this.translationVector; - } - - @Deprecated - public float getTranslationX() { - return this.playerPosition.x - this.offset.x; - } - - @Deprecated - public float getTranslationY() { - return this.playerPosition.y - this.offset.y; - } - - @Deprecated - public float getTranslationZ() { - return this.playerPosition.z - this.offset.z; - } - @Deprecated public void updatePoints() { this.pointMin.x = Math.min(this.pointA.x, this.pointB.x); @@ -74,12 +38,12 @@ public void updatePoints() { } @Deprecated - public void moveHere(Vector3f point) { - point.x = (int) Math.floor(this.playerPosition.x); - point.y = (int) Math.floor(this.playerPosition.y - 1); - point.z = (int) Math.floor(this.playerPosition.z); + public void moveHere(Vector3i point) { + point.x = (int) Math.floor(ClientProxy.playerPosition.x); + point.y = (int) Math.floor(ClientProxy.playerPosition.y - 1); + point.z = (int) Math.floor(ClientProxy.playerPosition.z); - switch (this.rotationRender) { + switch (ClientProxy.rotationRender) { case 0: point.x -= 1; point.z += 1; @@ -100,29 +64,29 @@ public void moveHere(Vector3f point) { } @Deprecated - public void moveHere() { - this.offset.x = (int) Math.floor(this.playerPosition.x); - this.offset.y = (int) Math.floor(this.playerPosition.y) - 1; - this.offset.z = (int) Math.floor(this.playerPosition.z); + public void moveHere(SchematicWorld schematic) { + Vector3i position = schematic.position; + position.x = (int) Math.floor(ClientProxy.playerPosition.x); + position.y = (int) Math.floor(ClientProxy.playerPosition.y) - 1; + position.z = (int) Math.floor(ClientProxy.playerPosition.z); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null) { - switch (this.rotationRender) { + switch (ClientProxy.rotationRender) { case 0: - this.offset.x -= schematic.getWidth(); - this.offset.z += 1; + position.x -= schematic.getWidth(); + position.z += 1; break; case 1: - this.offset.x -= schematic.getWidth(); - this.offset.z -= schematic.getLength(); + position.x -= schematic.getWidth(); + position.z -= schematic.getLength(); break; case 2: - this.offset.x += 1; - this.offset.z -= schematic.getLength(); + position.x += 1; + position.z -= schematic.getLength(); break; case 3: - this.offset.x += 1; - this.offset.z += 1; + position.x += 1; + position.z += 1; break; } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index e5759f95..841d3155 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.gui; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; @@ -10,6 +11,8 @@ import net.minecraft.client.resources.I18n; public class GuiSchematicControl extends GuiScreen { + private static final Vector3i ZERO = new Vector3i(); + private final Settings settings = Settings.instance; @SuppressWarnings("unused") private final GuiScreen prevGuiScreen; @@ -105,7 +108,7 @@ public void initGui() { this.btnIncLayer = new GuiButton(id++, this.width - 35, this.height - 150, 25, 20, I18n.format("schematica.gui.increase")); this.buttonList.add(this.btnIncLayer); - this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, I18n.format(this.schematic != null && this.schematic.isRendering() ? "schematica.gui.hide" : "schematica.gui.show")); + this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, I18n.format(this.schematic != null && this.schematic.isRendering ? "schematica.gui.hide" : "schematica.gui.show")); this.buttonList.add(this.btnHide); this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format("schematica.gui.movehere")); @@ -123,6 +126,18 @@ public void initGui() { this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, I18n.format(this.printer.isPrinting() ? "schematica.gui.disable" : "schematica.gui.enable")); this.buttonList.add(this.btnPrint); + this.btnDecX.enabled = this.schematic != null; + this.btnAmountX.enabled = this.schematic != null; + this.btnIncX.enabled = this.schematic != null; + + this.btnDecY.enabled = this.schematic != null; + this.btnAmountY.enabled = this.schematic != null; + this.btnIncY.enabled = this.schematic != null; + + this.btnDecZ.enabled = this.schematic != null; + this.btnAmountZ.enabled = this.schematic != null; + this.btnIncZ.enabled = this.schematic != null; + this.btnDecLayer.enabled = this.schematic != null; this.btnIncLayer.enabled = this.schematic != null; this.btnHide.enabled = this.schematic != null; @@ -138,28 +153,28 @@ public void initGui() { protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDecX.id) { - this.settings.offset.x -= this.settings.increments[this.incrementX]; + this.schematic.position.x -= this.settings.increments[this.incrementX]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncX.id) { - this.settings.offset.x += this.settings.increments[this.incrementX]; + this.schematic.position.x += this.settings.increments[this.incrementX]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountX.id) { this.incrementX = (this.incrementX + 1) % this.settings.increments.length; this.btnAmountX.displayString = Integer.toString(this.settings.increments[this.incrementX]); } else if (guiButton.id == this.btnDecY.id) { - this.settings.offset.y -= this.settings.increments[this.incrementY]; + this.schematic.position.y -= this.settings.increments[this.incrementY]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncY.id) { - this.settings.offset.y += this.settings.increments[this.incrementY]; + this.schematic.position.y += this.settings.increments[this.incrementY]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountY.id) { this.incrementY = (this.incrementY + 1) % this.settings.increments.length; this.btnAmountY.displayString = Integer.toString(this.settings.increments[this.incrementY]); } else if (guiButton.id == this.btnDecZ.id) { - this.settings.offset.z -= this.settings.increments[this.incrementZ]; + this.schematic.position.z -= this.settings.increments[this.incrementZ]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncZ.id) { - this.settings.offset.z += this.settings.increments[this.incrementZ]; + this.schematic.position.z += this.settings.increments[this.incrementZ]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountZ.id) { this.incrementZ = (this.incrementZ + 1) % this.settings.increments.length; @@ -177,7 +192,7 @@ protected void actionPerformed(GuiButton guiButton) { } else if (guiButton.id == this.btnHide.id) { this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); } else if (guiButton.id == this.btnMove.id) { - this.settings.moveHere(); + this.settings.moveHere(this.schematic); ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnFlip.id) { if (this.schematic != null) { @@ -210,17 +225,18 @@ public void drawScreen(int par1, int par2, float par3) { drawCenteredString(this.fontRendererObj, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); drawCenteredString(this.fontRendererObj, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); - int renderingLayer = this.schematic != null ? this.schematic.getRenderingLayer() : -1; + int renderingLayer = this.schematic != null ? this.schematic.renderingLayer : -1; drawCenteredString(this.fontRendererObj, renderingLayer < 0 ? this.strAll : Integer.toString(renderingLayer + 1), this.width - 50, this.height - 145, 0xFFFFFF); + Vector3i position = this.schematic != null ? this.schematic.position : ZERO; drawString(this.fontRendererObj, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.offset.x), this.centerX + 55, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(position.x), this.centerX + 55, this.centerY - 24, 0xFFFFFF); drawString(this.fontRendererObj, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.offset.y), this.centerX + 55, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(position.y), this.centerX + 55, this.centerY + 1, 0xFFFFFF); drawString(this.fontRendererObj, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.offset.z), this.centerX + 55, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(position.z), this.centerX + 55, this.centerY + 26, 0xFFFFFF); super.drawScreen(par1, par2, par3); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 524161fb..38f8fd98 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -161,6 +161,6 @@ private void loadSchematic() { } catch (Exception e) { Reference.logger.error("Failed to load schematic!", e); } - this.settings.moveHere(); + this.settings.moveHere(Schematica.proxy.getActiveSchematic()); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index a7fbfea5..b4c45131 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -3,6 +3,7 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; @@ -136,13 +137,13 @@ public void initGui() { this.btnIncBZ = new GuiButton(id++, this.centerX + 100, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); this.buttonList.add(this.btnIncBZ); - this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(this.settings.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable")); + this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable")); this.buttonList.add(this.btnEnable); this.tfFilename = new GuiTextField(this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format("schematica.gui.save")); - this.btnSave.enabled = this.settings.isRenderingGuide; + this.btnSave.enabled = ClientProxy.isRenderingGuide; this.buttonList.add(this.btnSave); this.tfFilename.setMaxStringLength(1024); @@ -213,9 +214,9 @@ protected void actionPerformed(GuiButton guiButton) { this.incrementBZ = (this.incrementBZ + 1) % this.settings.increments.length; this.btnAmountBZ.displayString = Integer.toString(this.settings.increments[this.incrementBZ]); } else if (guiButton.id == this.btnEnable.id) { - this.settings.isRenderingGuide = !this.settings.isRenderingGuide && Schematica.proxy.isSaveEnabled; - this.btnEnable.displayString = I18n.format(this.settings.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable"); - this.btnSave.enabled = this.settings.isRenderingGuide; + ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; + this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable"); + this.btnSave.enabled = ClientProxy.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, this.settings.pointMin, this.settings.pointMax)) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 353e3a06..e3144f49 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -41,10 +41,11 @@ public class RendererSchematicChunk { public final Vector3f centerPosition = new Vector3f(); private final Settings settings = Settings.instance; - private final Minecraft minecraft = this.settings.minecraft; + private final Minecraft minecraft = Minecraft.getMinecraft(); private final Profiler profiler = this.minecraft.mcProfiler; private final SchematicWorld schematic; private final List tileEntities = new ArrayList(); + private final Vector3f distance = new Vector3f(); private final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); @@ -141,7 +142,7 @@ public void updateRenderer() { minZ = (int) this.boundingBox.minZ; maxZ = Math.min((int) this.boundingBox.maxZ, this.schematic.getLength()); - int renderingLayer = this.schematic.getRenderingLayer(); + int renderingLayer = this.schematic.renderingLayer; if (renderingLayer >= 0) { if (renderingLayer >= minY && renderingLayer < maxY) { minY = renderingLayer; @@ -195,7 +196,7 @@ public void render(int renderPass) { return; } - if (distanceToPoint(this.settings.getTranslationVector()) > 25600) { + if (distanceToPoint(this.distance.set(ClientProxy.playerPosition).sub(this.schematic.position.toVector3f())) > 25600) { return; } @@ -241,9 +242,9 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, try { block = this.schematic.getBlock(x, y, z); - wx = (int) this.settings.offset.x + x; - wy = (int) this.settings.offset.y + y; - wz = (int) this.settings.offset.z + z; + wx = this.schematic.position.x + x; + wy = this.schematic.position.y + y; + wz = this.schematic.position.z + z; mcBlock = mcWorld.getBlock(wx, wy, wz); @@ -353,14 +354,14 @@ public void renderTileEntities(int renderPass) { y = tileEntity.yCoord; z = tileEntity.zCoord; - int renderingLayer = this.schematic.getRenderingLayer(); + int renderingLayer = this.schematic.renderingLayer; if (renderingLayer >= 0) { if (renderingLayer != y) { continue; } } - mcBlock = mcWorld.getBlock(x + (int) this.settings.offset.x, y + (int) this.settings.offset.y, z + (int) this.settings.offset.z); + mcBlock = mcWorld.getBlock(x + this.schematic.position.x, y + this.schematic.position.y, z + this.schematic.position.z); if (mcBlock == Blocks.air) { TileEntitySpecialRenderer tileEntitySpecialRenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntity); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java index c6120afe..b46717ab 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java @@ -1,12 +1,15 @@ package com.github.lunatrius.schematica.client.renderer; import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.schematica.Settings; +import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.world.SchematicWorld; import java.util.Comparator; public class RendererSchematicChunkSorter implements Comparator { - private final Settings settings = Settings.instance; + private final Vector3f position = new Vector3f(); + private final Vector3f schematicPosition = new Vector3f(); + private SchematicWorld schematic = null; public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { if (rendererSchematicChunk1.isInFrustrum && !rendererSchematicChunk2.isInFrustrum) { @@ -14,9 +17,9 @@ public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSch } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { return 1; } else { - Vector3f position = this.settings.playerPosition.clone().sub(this.settings.offset); - double dist1 = rendererSchematicChunk1.distanceToPoint(position); - double dist2 = rendererSchematicChunk2.distanceToPoint(position); + this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); + double dist1 = rendererSchematicChunk1.distanceToPoint(this.position); + double dist2 = rendererSchematicChunk2.distanceToPoint(this.position); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } } @@ -25,4 +28,9 @@ public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSch public int compare(Object obj1, Object obj2) { return doCompare((RendererSchematicChunk) obj1, (RendererSchematicChunk) obj2); } + + public void setSchematic(SchematicWorld schematic) { + this.schematic = schematic; + this.schematicPosition.set(schematic.position.toVector3f()); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index cff9c5c5..7b26c46c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -3,17 +3,15 @@ import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.Settings; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.culling.Frustrum; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.profiler.Profiler; -import net.minecraft.util.MathHelper; import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; import java.util.ArrayList; @@ -34,17 +32,11 @@ public class RendererSchematicGlobal { public void onRender(RenderWorldLastEvent event) { EntityPlayerSP player = this.minecraft.thePlayer; if (player != null) { - this.settings.playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.partialTicks); - this.settings.playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * event.partialTicks); - this.settings.playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.partialTicks); - - this.settings.rotationRender = MathHelper.floor_double(player.rotationYaw / 90) & 3; - - this.settings.orientation = getOrientation(player); + ClientProxy.setPlayerData(player, event.partialTicks); this.profiler.startSection("schematica"); SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if ((schematic != null && schematic.isRendering()) || this.settings.isRenderingGuide) { + if ((schematic != null && schematic.isRendering) || ClientProxy.isRenderingGuide) { render(schematic); } @@ -52,42 +44,28 @@ public void onRender(RenderWorldLastEvent event) { } } - private ForgeDirection getOrientation(EntityPlayer player) { - if (player.rotationPitch > 45) { - return ForgeDirection.DOWN; - } else if (player.rotationPitch < -45) { - return ForgeDirection.UP; - } else { - switch (MathHelper.floor_double(player.rotationYaw / 90.0 + 0.5) & 3) { - case 0: - return ForgeDirection.SOUTH; - case 1: - return ForgeDirection.WEST; - case 2: - return ForgeDirection.NORTH; - case 3: - return ForgeDirection.EAST; - } - } - - return ForgeDirection.UNKNOWN; - } - public void render(SchematicWorld schematic) { GL11.glPushMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); - GL11.glTranslatef(-this.settings.getTranslationX(), -this.settings.getTranslationY(), -this.settings.getTranslationZ()); + Vector3f playerPosition = ClientProxy.playerPosition.clone(); + Vector3f extra = new Vector3f(); + if (schematic != null) { + extra.add(schematic.position.toVector3f()); + playerPosition.sub(extra); + } + + GL11.glTranslatef(-playerPosition.x, -playerPosition.y, -playerPosition.z); this.profiler.startSection("schematic"); - if (schematic != null && schematic.isRendering()) { + if (schematic != null && schematic.isRendering) { this.profiler.startSection("updateFrustrum"); - updateFrustrum(); + updateFrustrum(schematic); this.profiler.endStartSection("sortAndUpdate"); if (RendererSchematicChunk.getCanUpdate()) { - sortAndUpdate(); + sortAndUpdate(schematic); } this.profiler.endStartSection("render"); @@ -105,25 +83,24 @@ public void render(SchematicWorld schematic) { RenderHelper.createBuffers(); this.profiler.startSection("dataPrep"); - if (schematic != null && schematic.isRendering()) { - RenderHelper.drawCuboidOutline(RenderHelper.VEC_ZERO, Schematica.proxy.getActiveSchematic().dimensions(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); + if (schematic != null && schematic.isRendering) { + RenderHelper.drawCuboidOutline(RenderHelper.VEC_ZERO, schematic.dimensions(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); } - if (this.settings.isRenderingGuide) { + if (ClientProxy.isRenderingGuide) { Vector3f start; Vector3f end; - start = this.settings.pointMin.clone().sub(this.settings.offset); - end = this.settings.pointMax.clone().sub(this.settings.offset); - end.add(1, 1, 1); + start = this.settings.pointMin.toVector3f().sub(extra); + end = this.settings.pointMax.toVector3f().sub(extra).add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); - start = this.settings.pointA.clone().sub(this.settings.offset); + start = this.settings.pointA.toVector3f().sub(extra); end = start.clone().add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - start = this.settings.pointB.clone().sub(this.settings.offset); + start = this.settings.pointB.toVector3f().sub(extra); end = start.clone().add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); @@ -169,14 +146,15 @@ public void render(SchematicWorld schematic) { GL11.glPopMatrix(); } - private void updateFrustrum() { - this.frustrum.setPosition(this.settings.getTranslationX(), this.settings.getTranslationY(), this.settings.getTranslationZ()); + private void updateFrustrum(SchematicWorld schematic) { + this.frustrum.setPosition(ClientProxy.playerPosition.x - schematic.position.x, ClientProxy.playerPosition.y - schematic.position.y, ClientProxy.playerPosition.z - schematic.position.z); for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { rendererSchematicChunk.isInFrustrum = this.frustrum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); } } - private void sortAndUpdate() { + private void sortAndUpdate(SchematicWorld schematic) { + this.rendererSchematicChunkSorter.setSchematic(schematic); Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkSorter); for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index b0dcabe7..80a0fd99 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -2,7 +2,6 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; @@ -40,7 +39,7 @@ public void onClientTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.minecraft.mcProfiler.startSection("schematica"); SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (this.minecraft.thePlayer != null && schematic != null && schematic.isRendering()) { + if (this.minecraft.thePlayer != null && schematic != null && schematic.isRendering) { this.minecraft.mcProfiler.startSection("printer"); SchematicPrinter printer = SchematicPrinter.INSTANCE; if (printer.isEnabled() && printer.isPrinting() && this.ticks-- < 0) { @@ -50,7 +49,7 @@ public void onClientTick(TickEvent.ClientTickEvent event) { } this.minecraft.mcProfiler.endStartSection("checkDirty"); - checkDirty(); + checkDirty(schematic); this.minecraft.mcProfiler.endStartSection("canUpdate"); RendererSchematicChunk.setCanUpdate(true); @@ -67,13 +66,13 @@ public void onClientTick(TickEvent.ClientTickEvent event) { } } - private void checkDirty() { + private void checkDirty(SchematicWorld schematic) { WorldRenderer[] renderers = this.minecraft.renderGlobal.sortedWorldRenderers; if (renderers != null) { int count = 0; for (WorldRenderer worldRenderer : renderers) { if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { - AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-Settings.instance.offset.x, -Settings.instance.offset.y, -Settings.instance.offset.z); + AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-schematic.position.x, -schematic.position.y, -schematic.position.z); for (RendererSchematicChunk renderer : ClientProxy.rendererSchematicGlobal.sortedRendererSchematicChunk) { if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { renderer.setDirty(); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 4ec9acce..297a68c0 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; @@ -17,15 +18,54 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; import java.io.File; public class ClientProxy extends CommonProxy { - private SchematicWorld schematicWorld = null; - public static boolean isPendingReset = false; public static RendererSchematicGlobal rendererSchematicGlobal = null; + public static boolean isRenderingGuide = false; + public static boolean isPendingReset = false; + + public static final Vector3f playerPosition = new Vector3f(); + public static ForgeDirection orientation = ForgeDirection.UNKNOWN; + public static int rotationRender = 0; + + private SchematicWorld schematicWorld = null; + + public static void setPlayerData(EntityPlayer player, float partialTicks) { + playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks); + playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks); + playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks); + + orientation = getOrientation(player); + + rotationRender = MathHelper.floor_double(player.rotationYaw / 90) & 3; + } + + private static ForgeDirection getOrientation(EntityPlayer player) { + if (player.rotationPitch > 45) { + return ForgeDirection.DOWN; + } else if (player.rotationPitch < -45) { + return ForgeDirection.UP; + } else { + switch (MathHelper.floor_double(player.rotationYaw / 90.0 + 0.5) & 3) { + case 0: + return ForgeDirection.SOUTH; + case 1: + return ForgeDirection.WEST; + case 2: + return ForgeDirection.NORTH; + case 3: + return ForgeDirection.EAST; + } + } + + return ForgeDirection.UNKNOWN; + } @Override public void setConfigEntryClasses() { @@ -73,7 +113,7 @@ public void resetSettings() { } @Override - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3f from, Vector3f to) { + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { try { String iconName = ""; @@ -110,7 +150,7 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam Schematica.proxy.setActiveSchematic(schematic); rendererSchematicGlobal.createRendererSchematicChunks(schematic); SchematicPrinter.INSTANCE.setSchematic(schematic); - schematic.setRendering(true); + schematic.isRendering = true; return true; } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 10fbf5a0..c0f008f0 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -43,14 +43,14 @@ public void resetSettings() { this.isLoadEnabled = true; } - public SchematicWorld getSchematicFromWorld(World world, Vector3f from, Vector3f to) { + public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i to) { try { - int minX = (int) Math.min(from.x, to.x); - int maxX = (int) Math.max(from.x, to.x); - int minY = (int) Math.min(from.y, to.y); - int maxY = (int) Math.max(from.y, to.y); - int minZ = (int) Math.min(from.z, to.z); - int maxZ = (int) Math.max(from.z, to.z); + int minX = Math.min(from.x, to.x); + int maxX = Math.max(from.x, to.x); + int minY = Math.min(from.y, to.y); + int maxY = Math.max(from.y, to.y); + int minZ = Math.min(from.z, to.z); + int maxZ = Math.max(from.z, to.z); short width = (short) (Math.abs(maxX - minX) + 1); short height = (short) (Math.abs(maxY - minY) + 1); short length = (short) (Math.abs(maxZ - minZ) + 1); @@ -94,7 +94,7 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3f from, Vector3f return null; } - public abstract boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3f from, Vector3f to); + public abstract boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to); public abstract boolean loadSchematic(EntityPlayer player, File directory, String filename); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 239f12a8..b009bdb8 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; @@ -27,7 +27,7 @@ public File getDataDirectory() { } @Override - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3f from, Vector3f to) { + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { return false; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 2882e943..19ac537f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.world; import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.lib.Reference; import cpw.mods.fml.common.registry.GameData; @@ -61,8 +62,9 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { private short length; private short height; - private boolean isRendering; - private int renderingLayer; + public final Vector3i position = new Vector3i(); + public boolean isRendering; + public int renderingLayer; public SchematicWorld() { // TODO: revert if any issues arise @@ -257,7 +259,7 @@ public int getBlockIdRaw(int x, int y, int z) { } private int getBlockId(int x, int y, int z) { - if (getRenderingLayer() != -1 && getRenderingLayer() != y) { + if (this.renderingLayer != -1 && this.renderingLayer != y) { return 0; } return getBlockIdRaw(x, y, z); @@ -420,22 +422,6 @@ public boolean toggleRendering() { return this.isRendering; } - public boolean isRendering() { - return this.isRendering; - } - - public void setRendering(boolean isRendering) { - this.isRendering = isRendering; - } - - public int getRenderingLayer() { - return this.renderingLayer; - } - - public void setRenderingLayer(int renderingLayer) { - this.renderingLayer = renderingLayer; - } - public void decrementRenderingLayer() { this.renderingLayer = MathHelper.clamp_int(this.renderingLayer - 1, -1, getHeight() - 1); } From 7e232cc10d040dafcd00392fdfcc7886eb7abd6a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 17 Jul 2014 13:30:31 +0200 Subject: [PATCH 038/314] Moved the remainder of fields and methods in the settings class and removed it. --- .../github/lunatrius/schematica/Settings.java | 94 --------------- .../client/gui/GuiSchematicControl.java | 34 +++--- .../client/gui/GuiSchematicLoad.java | 5 +- .../client/gui/GuiSchematicSave.java | 108 +++++++++--------- .../renderer/RendererSchematicChunk.java | 3 - .../renderer/RendererSchematicGlobal.java | 10 +- .../schematica/proxy/ClientProxy.java | 83 +++++++++++++- 7 files changed, 157 insertions(+), 180 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/Settings.java diff --git a/src/main/java/com/github/lunatrius/schematica/Settings.java b/src/main/java/com/github/lunatrius/schematica/Settings.java deleted file mode 100644 index e5cb8e22..00000000 --- a/src/main/java/com/github/lunatrius/schematica/Settings.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.github.lunatrius.schematica; - -import com.github.lunatrius.core.util.vector.Vector3i; -import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.world.SchematicWorld; - -@Deprecated -public class Settings { - @Deprecated - public static final Settings instance = new Settings(); - - @Deprecated - public Vector3i pointA = new Vector3i(); - @Deprecated - public Vector3i pointB = new Vector3i(); - @Deprecated - public Vector3i pointMin = new Vector3i(); - @Deprecated - public Vector3i pointMax = new Vector3i(); - @Deprecated - public int[] increments = { - 1, 5, 15, 50, 250 - }; - - @Deprecated - private Settings() { - } - - @Deprecated - public void updatePoints() { - this.pointMin.x = Math.min(this.pointA.x, this.pointB.x); - this.pointMin.y = Math.min(this.pointA.y, this.pointB.y); - this.pointMin.z = Math.min(this.pointA.z, this.pointB.z); - - this.pointMax.x = Math.max(this.pointA.x, this.pointB.x); - this.pointMax.y = Math.max(this.pointA.y, this.pointB.y); - this.pointMax.z = Math.max(this.pointA.z, this.pointB.z); - } - - @Deprecated - public void moveHere(Vector3i point) { - point.x = (int) Math.floor(ClientProxy.playerPosition.x); - point.y = (int) Math.floor(ClientProxy.playerPosition.y - 1); - point.z = (int) Math.floor(ClientProxy.playerPosition.z); - - switch (ClientProxy.rotationRender) { - case 0: - point.x -= 1; - point.z += 1; - break; - case 1: - point.x -= 1; - point.z -= 1; - break; - case 2: - point.x += 1; - point.z -= 1; - break; - case 3: - point.x += 1; - point.z += 1; - break; - } - } - - @Deprecated - public void moveHere(SchematicWorld schematic) { - Vector3i position = schematic.position; - position.x = (int) Math.floor(ClientProxy.playerPosition.x); - position.y = (int) Math.floor(ClientProxy.playerPosition.y) - 1; - position.z = (int) Math.floor(ClientProxy.playerPosition.z); - - if (schematic != null) { - switch (ClientProxy.rotationRender) { - case 0: - position.x -= schematic.getWidth(); - position.z += 1; - break; - case 1: - position.x -= schematic.getWidth(); - position.z -= schematic.getLength(); - break; - case 2: - position.x += 1; - position.z -= schematic.getLength(); - break; - case 3: - position.x += 1; - position.z += 1; - break; - } - } - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 841d3155..b0b2d86e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -3,7 +3,6 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; @@ -13,7 +12,6 @@ public class GuiSchematicControl extends GuiScreen { private static final Vector3i ZERO = new Vector3i(); - private final Settings settings = Settings.instance; @SuppressWarnings("unused") private final GuiScreen prevGuiScreen; @@ -78,7 +76,7 @@ public void initGui() { this.btnDecX = new GuiButton(id++, this.centerX - 50, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecX); - this.btnAmountX = new GuiButton(id++, this.centerX - 15, this.centerY - 30, 30, 20, Integer.toString(this.settings.increments[this.incrementX])); + this.btnAmountX = new GuiButton(id++, this.centerX - 15, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementX])); this.buttonList.add(this.btnAmountX); this.btnIncX = new GuiButton(id++, this.centerX + 20, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); @@ -87,7 +85,7 @@ public void initGui() { this.btnDecY = new GuiButton(id++, this.centerX - 50, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecY); - this.btnAmountY = new GuiButton(id++, this.centerX - 15, this.centerY - 5, 30, 20, Integer.toString(this.settings.increments[this.incrementY])); + this.btnAmountY = new GuiButton(id++, this.centerX - 15, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementY])); this.buttonList.add(this.btnAmountY); this.btnIncY = new GuiButton(id++, this.centerX + 20, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); @@ -96,7 +94,7 @@ public void initGui() { this.btnDecZ = new GuiButton(id++, this.centerX - 50, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecZ); - this.btnAmountZ = new GuiButton(id++, this.centerX - 15, this.centerY + 20, 30, 20, Integer.toString(this.settings.increments[this.incrementZ])); + this.btnAmountZ = new GuiButton(id++, this.centerX - 15, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementZ])); this.buttonList.add(this.btnAmountZ); this.btnIncZ = new GuiButton(id++, this.centerX + 20, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); @@ -153,32 +151,32 @@ public void initGui() { protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDecX.id) { - this.schematic.position.x -= this.settings.increments[this.incrementX]; + this.schematic.position.x -= ClientProxy.INCREMENTS[this.incrementX]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncX.id) { - this.schematic.position.x += this.settings.increments[this.incrementX]; + this.schematic.position.x += ClientProxy.INCREMENTS[this.incrementX]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountX.id) { - this.incrementX = (this.incrementX + 1) % this.settings.increments.length; - this.btnAmountX.displayString = Integer.toString(this.settings.increments[this.incrementX]); + this.incrementX = (this.incrementX + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementX]); } else if (guiButton.id == this.btnDecY.id) { - this.schematic.position.y -= this.settings.increments[this.incrementY]; + this.schematic.position.y -= ClientProxy.INCREMENTS[this.incrementY]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncY.id) { - this.schematic.position.y += this.settings.increments[this.incrementY]; + this.schematic.position.y += ClientProxy.INCREMENTS[this.incrementY]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountY.id) { - this.incrementY = (this.incrementY + 1) % this.settings.increments.length; - this.btnAmountY.displayString = Integer.toString(this.settings.increments[this.incrementY]); + this.incrementY = (this.incrementY + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementY]); } else if (guiButton.id == this.btnDecZ.id) { - this.schematic.position.z -= this.settings.increments[this.incrementZ]; + this.schematic.position.z -= ClientProxy.INCREMENTS[this.incrementZ]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnIncZ.id) { - this.schematic.position.z += this.settings.increments[this.incrementZ]; + this.schematic.position.z += ClientProxy.INCREMENTS[this.incrementZ]; ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnAmountZ.id) { - this.incrementZ = (this.incrementZ + 1) % this.settings.increments.length; - this.btnAmountZ.displayString = Integer.toString(this.settings.increments[this.incrementZ]); + this.incrementZ = (this.incrementZ + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementZ]); } else if (guiButton.id == this.btnDecLayer.id) { if (this.schematic != null) { this.schematic.decrementRenderingLayer(); @@ -192,7 +190,7 @@ protected void actionPerformed(GuiButton guiButton) { } else if (guiButton.id == this.btnHide.id) { this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); } else if (guiButton.id == this.btnMove.id) { - this.settings.moveHere(this.schematic); + ClientProxy.moveSchematicToPlayer(this.schematic); ClientProxy.rendererSchematicGlobal.refresh(); } else if (guiButton.id == this.btnFlip.id) { if (this.schematic != null) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 38f8fd98..8d3bfc5f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -2,9 +2,9 @@ import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -24,7 +24,6 @@ public class GuiSchematicLoad extends GuiScreen { private static final FileFilterSchematic FILE_FILTER_FOLDER = new FileFilterSchematic(true); private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); - private final Settings settings = Settings.instance; private final GuiScreen prevGuiScreen; private GuiSchematicLoadSlot guiSchematicLoadSlot; @@ -161,6 +160,6 @@ private void loadSchematic() { } catch (Exception e) { Reference.logger.error("Failed to load schematic!", e); } - this.settings.moveHere(Schematica.proxy.getActiveSchematic()); + ClientProxy.moveSchematicToPlayer(Schematica.proxy.getActiveSchematic()); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index b4c45131..b85c597d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -1,7 +1,6 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.client.gui.GuiButton; @@ -10,7 +9,6 @@ import net.minecraft.client.resources.I18n; public class GuiSchematicSave extends GuiScreen { - private final Settings settings = Settings.instance; @SuppressWarnings("unused") private final GuiScreen prevGuiScreen; @@ -83,7 +81,7 @@ public void initGui() { this.btnDecAX = new GuiButton(id++, this.centerX - 130, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecAX); - this.btnAmountAX = new GuiButton(id++, this.centerX - 95, this.centerY - 30, 30, 20, Integer.toString(this.settings.increments[this.incrementAX])); + this.btnAmountAX = new GuiButton(id++, this.centerX - 95, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAX])); this.buttonList.add(this.btnAmountAX); this.btnIncAX = new GuiButton(id++, this.centerX - 60, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); @@ -92,7 +90,7 @@ public void initGui() { this.btnDecAY = new GuiButton(id++, this.centerX - 130, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecAY); - this.btnAmountAY = new GuiButton(id++, this.centerX - 95, this.centerY - 5, 30, 20, Integer.toString(this.settings.increments[this.incrementAY])); + this.btnAmountAY = new GuiButton(id++, this.centerX - 95, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAY])); this.buttonList.add(this.btnAmountAY); this.btnIncAY = new GuiButton(id++, this.centerX - 60, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); @@ -101,7 +99,7 @@ public void initGui() { this.btnDecAZ = new GuiButton(id++, this.centerX - 130, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecAZ); - this.btnAmountAZ = new GuiButton(id++, this.centerX - 95, this.centerY + 20, 30, 20, Integer.toString(this.settings.increments[this.incrementAZ])); + this.btnAmountAZ = new GuiButton(id++, this.centerX - 95, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ])); this.buttonList.add(this.btnAmountAZ); this.btnIncAZ = new GuiButton(id++, this.centerX - 60, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); @@ -113,7 +111,7 @@ public void initGui() { this.btnDecBX = new GuiButton(id++, this.centerX + 30, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecBX); - this.btnAmountBX = new GuiButton(id++, this.centerX + 65, this.centerY - 30, 30, 20, Integer.toString(this.settings.increments[this.incrementBX])); + this.btnAmountBX = new GuiButton(id++, this.centerX + 65, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBX])); this.buttonList.add(this.btnAmountBX); this.btnIncBX = new GuiButton(id++, this.centerX + 100, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); @@ -122,7 +120,7 @@ public void initGui() { this.btnDecBY = new GuiButton(id++, this.centerX + 30, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecBY); - this.btnAmountBY = new GuiButton(id++, this.centerX + 65, this.centerY - 5, 30, 20, Integer.toString(this.settings.increments[this.incrementBY])); + this.btnAmountBY = new GuiButton(id++, this.centerX + 65, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBY])); this.buttonList.add(this.btnAmountBY); this.btnIncBY = new GuiButton(id++, this.centerX + 100, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); @@ -131,7 +129,7 @@ public void initGui() { this.btnDecBZ = new GuiButton(id++, this.centerX + 30, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); this.buttonList.add(this.btnDecBZ); - this.btnAmountBZ = new GuiButton(id++, this.centerX + 65, this.centerY + 20, 30, 20, Integer.toString(this.settings.increments[this.incrementBZ])); + this.btnAmountBZ = new GuiButton(id++, this.centerX + 65, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ])); this.buttonList.add(this.btnAmountBZ); this.btnIncBZ = new GuiButton(id++, this.centerX + 100, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); @@ -154,72 +152,72 @@ public void initGui() { protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnPointA.id) { - this.settings.moveHere(this.settings.pointA); - this.settings.updatePoints(); + ClientProxy.movePointToPlayer(ClientProxy.pointA); + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnDecAX.id) { - this.settings.pointA.x -= this.settings.increments[this.incrementAX]; - this.settings.updatePoints(); + ClientProxy.pointA.x -= ClientProxy.INCREMENTS[this.incrementAX]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnIncAX.id) { - this.settings.pointA.x += this.settings.increments[this.incrementAX]; - this.settings.updatePoints(); + ClientProxy.pointA.x += ClientProxy.INCREMENTS[this.incrementAX]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnAmountAX.id) { - this.incrementAX = (this.incrementAX + 1) % this.settings.increments.length; - this.btnAmountAX.displayString = Integer.toString(this.settings.increments[this.incrementAX]); + this.incrementAX = (this.incrementAX + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountAX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAX]); } else if (guiButton.id == this.btnDecAY.id) { - this.settings.pointA.y -= this.settings.increments[this.incrementAY]; - this.settings.updatePoints(); + ClientProxy.pointA.y -= ClientProxy.INCREMENTS[this.incrementAY]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnIncAY.id) { - this.settings.pointA.y += this.settings.increments[this.incrementAY]; - this.settings.updatePoints(); + ClientProxy.pointA.y += ClientProxy.INCREMENTS[this.incrementAY]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnAmountAY.id) { - this.incrementAY = (this.incrementAY + 1) % this.settings.increments.length; - this.btnAmountAY.displayString = Integer.toString(this.settings.increments[this.incrementAY]); + this.incrementAY = (this.incrementAY + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountAY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAY]); } else if (guiButton.id == this.btnDecAZ.id) { - this.settings.pointA.z -= this.settings.increments[this.incrementAZ]; - this.settings.updatePoints(); + ClientProxy.pointA.z -= ClientProxy.INCREMENTS[this.incrementAZ]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnIncAZ.id) { - this.settings.pointA.z += this.settings.increments[this.incrementAZ]; - this.settings.updatePoints(); + ClientProxy.pointA.z += ClientProxy.INCREMENTS[this.incrementAZ]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnAmountAZ.id) { - this.incrementAZ = (this.incrementAZ + 1) % this.settings.increments.length; - this.btnAmountAZ.displayString = Integer.toString(this.settings.increments[this.incrementAZ]); + this.incrementAZ = (this.incrementAZ + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountAZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ]); } else if (guiButton.id == this.btnPointB.id) { - this.settings.moveHere(this.settings.pointB); - this.settings.updatePoints(); + ClientProxy.movePointToPlayer(ClientProxy.pointB); + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnDecBX.id) { - this.settings.pointB.x -= this.settings.increments[this.incrementBX]; - this.settings.updatePoints(); + ClientProxy.pointB.x -= ClientProxy.INCREMENTS[this.incrementBX]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnIncBX.id) { - this.settings.pointB.x += this.settings.increments[this.incrementBX]; - this.settings.updatePoints(); + ClientProxy.pointB.x += ClientProxy.INCREMENTS[this.incrementBX]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnAmountBX.id) { - this.incrementBX = (this.incrementBX + 1) % this.settings.increments.length; - this.btnAmountBX.displayString = Integer.toString(this.settings.increments[this.incrementBX]); + this.incrementBX = (this.incrementBX + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountBX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBX]); } else if (guiButton.id == this.btnDecBY.id) { - this.settings.pointB.y -= this.settings.increments[this.incrementBY]; - this.settings.updatePoints(); + ClientProxy.pointB.y -= ClientProxy.INCREMENTS[this.incrementBY]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnIncBY.id) { - this.settings.pointB.y += this.settings.increments[this.incrementBY]; - this.settings.updatePoints(); + ClientProxy.pointB.y += ClientProxy.INCREMENTS[this.incrementBY]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnAmountBY.id) { - this.incrementBY = (this.incrementBY + 1) % this.settings.increments.length; - this.btnAmountBY.displayString = Integer.toString(this.settings.increments[this.incrementBY]); + this.incrementBY = (this.incrementBY + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountBY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBY]); } else if (guiButton.id == this.btnDecBZ.id) { - this.settings.pointB.z -= this.settings.increments[this.incrementBZ]; - this.settings.updatePoints(); + ClientProxy.pointB.z -= ClientProxy.INCREMENTS[this.incrementBZ]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnIncBZ.id) { - this.settings.pointB.z += this.settings.increments[this.incrementBZ]; - this.settings.updatePoints(); + ClientProxy.pointB.z += ClientProxy.INCREMENTS[this.incrementBZ]; + ClientProxy.updatePoints(); } else if (guiButton.id == this.btnAmountBZ.id) { - this.incrementBZ = (this.incrementBZ + 1) % this.settings.increments.length; - this.btnAmountBZ.displayString = Integer.toString(this.settings.increments[this.incrementBZ]); + this.incrementBZ = (this.incrementBZ + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountBZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ]); } else if (guiButton.id == this.btnEnable.id) { ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable"); this.btnSave.enabled = ClientProxy.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; - if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, this.settings.pointMin, this.settings.pointMax)) { + if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { this.filename = ""; this.tfFilename.setText(this.filename); } @@ -253,22 +251,22 @@ public void drawScreen(int par1, int par2, float par3) { drawString(this.fontRendererObj, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); drawString(this.fontRendererObj, this.strX, this.centerX - 145, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); drawString(this.fontRendererObj, this.strY, this.centerX - 145, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.pointA.y), this.centerX - 25, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.y), this.centerX - 25, this.centerY + 1, 0xFFFFFF); drawString(this.fontRendererObj, this.strZ, this.centerX - 145, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.pointA.z), this.centerX - 25, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.z), this.centerX - 25, this.centerY + 26, 0xFFFFFF); drawString(this.fontRendererObj, this.strX, this.centerX + 15, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.pointB.x), this.centerX + 135, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.x), this.centerX + 135, this.centerY - 24, 0xFFFFFF); drawString(this.fontRendererObj, this.strY, this.centerX + 15, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.pointB.y), this.centerX + 135, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.y), this.centerX + 135, this.centerY + 1, 0xFFFFFF); drawString(this.fontRendererObj, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString((int) this.settings.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); this.tfFilename.drawTextBox(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index e3144f49..f318cabe 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -1,7 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.proxy.ClientProxy; @@ -40,7 +39,6 @@ public class RendererSchematicChunk { public final Vector3f centerPosition = new Vector3f(); - private final Settings settings = Settings.instance; private final Minecraft minecraft = Minecraft.getMinecraft(); private final Profiler profiler = this.minecraft.mcProfiler; private final SchematicWorld schematic; @@ -414,7 +412,6 @@ private void bindTexture() { Map map = (Map) this.fieldMapTexturesStiched.get(this.minecraft.renderEngine.getTexture(TextureMap.locationBlocksTexture)); if (map == null) { - Settings.logger.logSevere("mapTexturesStiched is null!"); resourcePacks.put(resourcePackName, TextureMap.locationBlocksTexture); return; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 7b26c46c..632476ba 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -2,7 +2,6 @@ import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.Settings; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -20,7 +19,6 @@ public class RendererSchematicGlobal { private final Minecraft minecraft = Minecraft.getMinecraft(); - private final Settings settings = Settings.instance; private final Profiler profiler = this.minecraft.mcProfiler; private final Frustrum frustrum = new Frustrum(); @@ -91,16 +89,16 @@ public void render(SchematicWorld schematic) { Vector3f start; Vector3f end; - start = this.settings.pointMin.toVector3f().sub(extra); - end = this.settings.pointMax.toVector3f().sub(extra).add(1, 1, 1); + start = ClientProxy.pointMin.toVector3f().sub(extra); + end = ClientProxy.pointMax.toVector3f().sub(extra).add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); - start = this.settings.pointA.toVector3f().sub(extra); + start = ClientProxy.pointA.toVector3f().sub(extra); end = start.clone().add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - start = this.settings.pointB.toVector3f().sub(extra); + start = ClientProxy.pointB.toVector3f().sub(extra); end = start.clone().add(1, 1, 1); RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 297a68c0..e0f5b5f7 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -26,6 +26,11 @@ import java.io.File; public class ClientProxy extends CommonProxy { + // TODO: remove this and replace the 3 sepparate buttons with a single control + public static final int[] INCREMENTS = { + 1, 5, 15, 50, 250 + }; + public static RendererSchematicGlobal rendererSchematicGlobal = null; public static boolean isRenderingGuide = false; public static boolean isPendingReset = false; @@ -34,6 +39,11 @@ public class ClientProxy extends CommonProxy { public static ForgeDirection orientation = ForgeDirection.UNKNOWN; public static int rotationRender = 0; + public static final Vector3i pointA = new Vector3i(); + public static final Vector3i pointB = new Vector3i(); + public static final Vector3i pointMin = new Vector3i(); + public static final Vector3i pointMax = new Vector3i(); + private SchematicWorld schematicWorld = null; public static void setPlayerData(EntityPlayer player, float partialTicks) { @@ -67,6 +77,69 @@ private static ForgeDirection getOrientation(EntityPlayer player) { return ForgeDirection.UNKNOWN; } + public static void updatePoints() { + pointMin.x = Math.min(pointA.x, pointB.x); + pointMin.y = Math.min(pointA.y, pointB.y); + pointMin.z = Math.min(pointA.z, pointB.z); + + pointMax.x = Math.max(pointA.x, pointB.x); + pointMax.y = Math.max(pointA.y, pointB.y); + pointMax.z = Math.max(pointA.z, pointB.z); + } + + public static void movePointToPlayer(Vector3i point) { + point.x = (int) Math.floor(playerPosition.x); + point.y = (int) Math.floor(playerPosition.y - 1); + point.z = (int) Math.floor(playerPosition.z); + + switch (rotationRender) { + case 0: + point.x -= 1; + point.z += 1; + break; + case 1: + point.x -= 1; + point.z -= 1; + break; + case 2: + point.x += 1; + point.z -= 1; + break; + case 3: + point.x += 1; + point.z += 1; + break; + } + } + + public static void moveSchematicToPlayer(SchematicWorld schematic) { + Vector3i position = schematic.position; + position.x = (int) Math.floor(playerPosition.x); + position.y = (int) Math.floor(playerPosition.y) - 1; + position.z = (int) Math.floor(playerPosition.z); + + if (schematic != null) { + switch (rotationRender) { + case 0: + position.x -= schematic.getWidth(); + position.z += 1; + break; + case 1: + position.x -= schematic.getWidth(); + position.z -= schematic.getLength(); + break; + case 2: + position.x += 1; + position.z -= schematic.getLength(); + break; + case 3: + position.x += 1; + position.z += 1; + break; + } + } + } + @Override public void setConfigEntryClasses() { ConfigurationHandler.propAlpha.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); @@ -107,9 +180,17 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setEnabled(true); SchematicPrinter.INSTANCE.setSchematic(null); - ClientProxy.rendererSchematicGlobal.destroyRendererSchematicChunks(); + rendererSchematicGlobal.destroyRendererSchematicChunks(); setActiveSchematic(null); + + playerPosition.set(0, 0, 0); + orientation = ForgeDirection.UNKNOWN; + rotationRender = 0; + + pointA.set(0, 0, 0); + pointB.set(0, 0, 0); + updatePoints(); } @Override From d7a280af105e66801d241370dc41fafa59114215 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 18 Jul 2014 10:09:54 +0200 Subject: [PATCH 039/314] Compile Java using UTF-8. --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 4d5e26ba..0b260506 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,8 @@ ext.modversion = "${config.version.major}.${config.version.minor}.${config.versi group = 'com.github.lunatrius' version = "${config.version.minecraft}-${modversion}" +compileJava.options.encoding = 'UTF-8' + repositories { ivy { name = 'lunatrius\' ivy repo' From 0d5bec3c051e504f60a8db5a6af7c5ba12ef0ef7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 18 Jul 2014 10:19:54 +0200 Subject: [PATCH 040/314] Made gradlew executable. --- gradlew | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 8e501e1fd250c78d59e9620581418186820b821e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 18 Jul 2014 10:37:28 +0200 Subject: [PATCH 041/314] Added .gitattributes --- .gitattributes | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..a8e787ce --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +# default +* text eol=auto + +# git +.gitattributes text eol=lf +.gitignore text eol=lf + +# sources +*.java text eol=lf + +# resources +*.lang text eol=lf +*.cfg text eol=lf +*.info text eol=lf +*.mcmeta text eol=lf +*.md text eol=lf +*.xml text eol=lf + +# scripts +*.bat text eol=crlf +*.gradle text eol=lf +*.properties text eol=lf + +# binaries +*.png binary +*.jar binary From 60bb7d9d0bd412c4785156b96a0054902ee3a4dd Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 21 Jul 2014 15:56:09 +0200 Subject: [PATCH 042/314] Move the version checker registration to the end of preInit, make sure the logger is initialized first. --- .../java/com/github/lunatrius/schematica/Schematica.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index b388d497..16828146 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -22,15 +22,14 @@ public class Schematica { @EventHandler public void preInit(FMLPreInitializationEvent event) { - VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); - Reference.logger = event.getModLog(); - ConfigurationHandler.init(event.getSuggestedConfigurationFile()); proxy.setConfigEntryClasses(); proxy.registerKeybindings(); proxy.createFolders(); + + VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); } @EventHandler From f4066afa29e730e0c849b0b87b3acb5e554174d8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 21 Jul 2014 16:02:07 +0200 Subject: [PATCH 043/314] This was a useless change... --- .../java/com/github/lunatrius/schematica/lib/Reference.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/lib/Reference.java b/src/main/java/com/github/lunatrius/schematica/lib/Reference.java index a494d283..c324f4ed 100644 --- a/src/main/java/com/github/lunatrius/schematica/lib/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/lib/Reference.java @@ -15,7 +15,7 @@ public class Reference { prop.load(stream); stream.close(); } catch (Exception e) { - throw Throwables.propagate(e); + Throwables.propagate(e); } VERSION = prop.getProperty("version.mod"); From 41920b14c4045d937d504b4214c71f566041b4a4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 21 Jul 2014 22:39:49 +0200 Subject: [PATCH 044/314] Changing the license from CC BY-NC-SA 3.0 to MIT. --- LICENSE | 21 +++++++++++++++++++++ src/main/resources/LICENSE | 25 ------------------------- 2 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 LICENSE delete mode 100644 src/main/resources/LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..f8a21387 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jadran "Lunatrius" Kotnik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/main/resources/LICENSE b/src/main/resources/LICENSE deleted file mode 100644 index 5bed503b..00000000 --- a/src/main/resources/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) -https://creativecommons.org/licenses/by-nc-sa/3.0/ - -You are free: - - to Share - to copy, distribute and transmit the work - to Remix - to adapt the work - -Under the following conditions: - - Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). - - Noncommercial - You may not use this work for commercial purposes. - - Share Alike - If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. - -With the understanding that: - - Waiver - Any of the above conditions can be waived if you get permission from the copyright holder. - Public Domain - Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. - Other Rights - In no way are any of the following rights affected by the license: - Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; - The author's moral rights; - Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. - Notice - For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. From 8a6fa41d87118db55731549b74e3b0b387b205e4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 22 Jul 2014 00:25:27 +0200 Subject: [PATCH 045/314] Make the configuration defaults proper, final defaults. --- .../handler/ConfigurationHandler.java | 83 +++++++++++-------- 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index f72653ca..3926d301 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -46,18 +46,31 @@ public class ConfigurationHandler { public static Configuration configuration; - public static boolean enableAlpha = false; - public static float alpha = 1.0f; - public static boolean highlight = true; - public static boolean highlightAir = true; - public static float blockDelta = 0.005f; - public static int placeDelay = 1; - public static int timeout = 10; - public static boolean placeInstantly = false; - public static boolean placeAdjacent = true; - public static boolean drawQuads = true; - public static boolean drawLines = true; - public static File schematicDirectory = new File(Schematica.proxy.getDataDirectory(), "schematics"); + public static final boolean ENABLEALPHA_DEFAULT = false; + public static final double ALPHA_DEFAULT = 1.0; + public static final boolean HIGHLIGHT_DEFAULT = true; + public static final boolean HIGHLIGHTAIR_DEFAULT = true; + public static final double BLOCKDELTA_DEFAULT = 0.005; + public static final int PLACEDELAY_DEFAULT = 1; + public static final int TIMEOUT_DEFAULT = 10; + public static final boolean PLACEINSTANTLY_DEFAULT = false; + public static final boolean PLACEADJACENT_DEFAULT = true; + public static final boolean DRAWQUADS_DEFAULT = true; + public static final boolean DRAWLINES_DEFAULT = true; + public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), "schematics"); + + public static boolean enableAlpha = ENABLEALPHA_DEFAULT; + public static float alpha = (float) ALPHA_DEFAULT; + public static boolean highlight = HIGHLIGHT_DEFAULT; + public static boolean highlightAir = HIGHLIGHTAIR_DEFAULT; + public static float blockDelta = (float) BLOCKDELTA_DEFAULT; + public static int placeDelay = PLACEDELAY_DEFAULT; + public static int timeout = TIMEOUT_DEFAULT; + public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; + public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; + public static boolean drawQuads = DRAWQUADS_DEFAULT; + public static boolean drawLines = DRAWLINES_DEFAULT; + public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; public static Property propEnableAlpha = null; public static Property propAlpha = null; @@ -80,54 +93,54 @@ public static void init(File configFile) { } private static void loadConfiguration() { - propEnableAlpha = configuration.get(CATEGORY_RENDER, ALPHA_ENABLED, enableAlpha, ALPHA_ENABLED_DESC); + propEnableAlpha = configuration.get(CATEGORY_RENDER, ALPHA_ENABLED, ENABLEALPHA_DEFAULT, ALPHA_ENABLED_DESC); propEnableAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA_ENABLED)); propEnableAlpha.setShowInGui(false); - enableAlpha = propEnableAlpha.getBoolean(enableAlpha); + enableAlpha = propEnableAlpha.getBoolean(ENABLEALPHA_DEFAULT); - propAlpha = configuration.get(CATEGORY_RENDER, ALPHA, alpha, ALPHA_DESC, 0.0, 1.0); + propAlpha = configuration.get(CATEGORY_RENDER, ALPHA, ALPHA_DEFAULT, ALPHA_DESC, 0.0, 1.0); propAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA)); propAlpha.setShowInGui(false); - alpha = (float) propAlpha.getDouble(alpha); + alpha = (float) propAlpha.getDouble(ALPHA_DEFAULT); - propHighlight = configuration.get(CATEGORY_RENDER, HIGHLIGHT, highlight, HIGHLIGHT_DESC); + propHighlight = configuration.get(CATEGORY_RENDER, HIGHLIGHT, HIGHLIGHT_DEFAULT, HIGHLIGHT_DESC); propHighlight.setLanguageKey(String.format("%s.%s", LANG_PREFIX, HIGHLIGHT)); - highlight = propHighlight.getBoolean(highlight); + highlight = propHighlight.getBoolean(HIGHLIGHT_DEFAULT); - propHighlightAir = configuration.get(CATEGORY_RENDER, HIGHLIGHT_AIR, highlightAir, HIGHLIGHT_AIR_DESC); + propHighlightAir = configuration.get(CATEGORY_RENDER, HIGHLIGHT_AIR, HIGHLIGHTAIR_DEFAULT, HIGHLIGHT_AIR_DESC); propHighlightAir.setLanguageKey(String.format("%s.%s", LANG_PREFIX, HIGHLIGHT_AIR)); - highlightAir = propHighlightAir.getBoolean(highlightAir); + highlightAir = propHighlightAir.getBoolean(HIGHLIGHTAIR_DEFAULT); - propBlockDelta = configuration.get(CATEGORY_RENDER, BLOCK_DELTA, blockDelta, BLOCK_DELTA_DESC, 0.0, 0.2); + propBlockDelta = configuration.get(CATEGORY_RENDER, BLOCK_DELTA, BLOCKDELTA_DEFAULT, BLOCK_DELTA_DESC, 0.0, 0.2); propBlockDelta.setLanguageKey(String.format("%s.%s", LANG_PREFIX, BLOCK_DELTA)); - blockDelta = (float) propBlockDelta.getDouble(blockDelta); + blockDelta = (float) propBlockDelta.getDouble(BLOCKDELTA_DEFAULT); - propDrawQuads = configuration.get(CATEGORY_RENDER, DRAW_QUADS, drawQuads, DRAW_QUADS_DESC); + propDrawQuads = configuration.get(CATEGORY_RENDER, DRAW_QUADS, DRAWQUADS_DEFAULT, DRAW_QUADS_DESC); propDrawQuads.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DRAW_QUADS)); - drawQuads = propDrawQuads.getBoolean(drawQuads); + drawQuads = propDrawQuads.getBoolean(DRAWQUADS_DEFAULT); - propDrawLines = configuration.get(CATEGORY_RENDER, DRAW_LINES, drawLines, DRAW_LINES_DESC); + propDrawLines = configuration.get(CATEGORY_RENDER, DRAW_LINES, DRAWLINES_DEFAULT, DRAW_LINES_DESC); propDrawLines.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DRAW_LINES)); - drawLines = propDrawLines.getBoolean(drawLines); + drawLines = propDrawLines.getBoolean(DRAWLINES_DEFAULT); - propPlaceDelay = configuration.get(CATEGORY_PRINTER, PLACE_DELAY, placeDelay, PLACE_DELAY_DESC, 0, 20); + propPlaceDelay = configuration.get(CATEGORY_PRINTER, PLACE_DELAY, PLACEDELAY_DEFAULT, PLACE_DELAY_DESC, 0, 20); propPlaceDelay.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_DELAY)); - placeDelay = propPlaceDelay.getInt(placeDelay); + placeDelay = propPlaceDelay.getInt(PLACEDELAY_DEFAULT); - propTimeout = configuration.get(CATEGORY_PRINTER, TIMEOUT, timeout, TIMEOUT_DESC, 0, 100); + propTimeout = configuration.get(CATEGORY_PRINTER, TIMEOUT, TIMEOUT_DEFAULT, TIMEOUT_DESC, 0, 100); propTimeout.setLanguageKey(String.format("%s.%s", LANG_PREFIX, TIMEOUT)); - timeout = propTimeout.getInt(timeout); + timeout = propTimeout.getInt(TIMEOUT_DEFAULT); - propPlaceInstantly = configuration.get(CATEGORY_PRINTER, PLACE_INSTANTLY, placeInstantly, PLACE_INSTANTLY_DESC); + propPlaceInstantly = configuration.get(CATEGORY_PRINTER, PLACE_INSTANTLY, PLACEINSTANTLY_DEFAULT, PLACE_INSTANTLY_DESC); propPlaceInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_INSTANTLY)); - placeInstantly = propPlaceInstantly.getBoolean(placeInstantly); + placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); - propPlaceAdjacent = configuration.get(CATEGORY_PRINTER, PLACE_ADJACENT, placeAdjacent, PLACE_ADJACENT_DESC); + propPlaceAdjacent = configuration.get(CATEGORY_PRINTER, PLACE_ADJACENT, PLACEADJACENT_DEFAULT, PLACE_ADJACENT_DESC); propPlaceAdjacent.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_ADJACENT)); - placeAdjacent = propPlaceAdjacent.getBoolean(placeAdjacent); + placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); try { - schematicDirectory = schematicDirectory.getCanonicalFile(); + schematicDirectory = SCHEMATICDIRECTORY_DEFAULT.getCanonicalFile(); } catch (IOException e) { Reference.logger.warn("Could not canonize file path!", e); } From fe65eaa5dcc18a180b2111939c011683ff02e040 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 22 Jul 2014 00:50:38 +0200 Subject: [PATCH 046/314] Make sure to clone playerPosition before subtracting the schematic position. --- .../java/com/github/lunatrius/schematica/SchematicPrinter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 1142047a..431ce0c9 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -86,7 +86,7 @@ public boolean print() { syncSneaking(player, true); - Vector3i trans = ClientProxy.playerPosition.sub(this.schematic.position.toVector3f()).toVector3i(); + Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); minX = Math.max(0, trans.x - 3); maxX = Math.min(this.schematic.getWidth(), trans.x + 4); minY = Math.max(0, trans.y - 3); From eca8bd7bcccf4dd8c0480fe3268ca2851b2eb809 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 22 Jul 2014 00:56:51 +0200 Subject: [PATCH 047/314] Inlined a rather useless method. --- .../client/renderer/RendererSchematicChunk.java | 9 +-------- .../client/renderer/RendererSchematicChunkSorter.java | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index f318cabe..6375cb09 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -114,13 +114,6 @@ public boolean getDirty() { return this.needsUpdate; } - public float distanceToPoint(Vector3f vector) { - float x = vector.x - this.centerPosition.x; - float y = vector.y - this.centerPosition.y; - float z = vector.z - this.centerPosition.z; - return x * x + y * y + z * z; - } - public void updateRenderer() { if (this.needsUpdate) { this.needsUpdate = false; @@ -194,7 +187,7 @@ public void render(int renderPass) { return; } - if (distanceToPoint(this.distance.set(ClientProxy.playerPosition).sub(this.schematic.position.toVector3f())) > 25600) { + if (this.distance.set(ClientProxy.playerPosition).sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).sub(this.centerPosition).lengthSquared() > 25600) { return; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java index b46717ab..0f072152 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java @@ -18,8 +18,8 @@ public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSch return 1; } else { this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); - double dist1 = rendererSchematicChunk1.distanceToPoint(this.position); - double dist2 = rendererSchematicChunk2.distanceToPoint(this.position); + double dist1 = this.position.sub(rendererSchematicChunk1.centerPosition).lengthSquared(); + double dist2 = this.position.sub(rendererSchematicChunk2.centerPosition).lengthSquared(); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } } From 369c2952c519aeca6a37afd38f1c42d859d680d7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 22 Jul 2014 15:13:37 +0200 Subject: [PATCH 048/314] Fixed a sorting issue. Might have to optimize the method at some time. --- .../client/renderer/RendererSchematicChunkSorter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java index 0f072152..d920a204 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java @@ -18,7 +18,7 @@ public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSch return 1; } else { this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); - double dist1 = this.position.sub(rendererSchematicChunk1.centerPosition).lengthSquared(); + double dist1 = this.position.clone().sub(rendererSchematicChunk1.centerPosition).lengthSquared(); double dist2 = this.position.sub(rendererSchematicChunk2.centerPosition).lengthSquared(); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } From baecc8d54dcec94eb9dfa655b0968a26f58d72ba Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 23 Jul 2014 01:22:27 +0200 Subject: [PATCH 049/314] Updated forge and core versions. --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 421009cd..0bc96a0b 100644 --- a/build.properties +++ b/build.properties @@ -2,8 +2,8 @@ version.major=1 version.minor=7 version.micro=0 version.minecraft=1.7.10 -version.forge=10.13.0.1180 +version.forge=10.13.0.1187 version.minforge=10.13.0.1185 -version.lunatriuscore=1.1.0.8 +version.lunatriuscore=1.1.2.10 extra.fmlat=schematica_at.cfg From 3c398c7c6a309ee7d11acfbc724cbf0745075bc7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 23 Jul 2014 03:09:28 +0200 Subject: [PATCH 050/314] Removed version.properties and made gradle replace the tokens in the source instead. --- build.gradle | 7 ++-- .../lunatrius/schematica/Schematica.java | 4 +-- .../schematica/client/gui/GuiModConfig.java | 2 +- .../client/gui/GuiSchematicLoad.java | 2 +- .../renderer/RendererSchematicChunk.java | 2 +- .../handler/ConfigurationHandler.java | 2 +- .../handler/client/ChatEventHandler.java | 2 +- .../handler/client/TickHandler.java | 2 +- .../lunatrius/schematica/lib/Reference.java | 36 ------------------- .../schematica/proxy/ClientProxy.java | 2 +- .../schematica/proxy/CommonProxy.java | 2 +- .../schematica/reference/Reference.java | 16 +++++++++ .../schematica/world/SchematicWorld.java | 2 +- .../world/schematic/SchematicAlpha.java | 2 +- .../world/schematic/SchematicFormat.java | 2 +- src/main/resources/version.properties | 3 -- 16 files changed, 34 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/lib/Reference.java create mode 100644 src/main/java/com/github/lunatrius/schematica/reference/Reference.java delete mode 100644 src/main/resources/version.properties diff --git a/build.gradle b/build.gradle index 0b260506..2e4532b9 100644 --- a/build.gradle +++ b/build.gradle @@ -63,6 +63,11 @@ minecraft { runDir = 'run' else runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', config.version.minecraft) + + replaceIn 'reference/Reference.java' + replace '${version}', modversion + replace '${mcversion}', config.version.minecraft + replace '${forgeversion}', config.version.forge } jar { @@ -77,7 +82,6 @@ processResources { from (sourceSets.main.resources.srcDirs) { include 'mcmod.info' - include 'version.properties' expand (['modid': project.name, 'version': modversion, @@ -90,7 +94,6 @@ processResources { from (sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' - exclude 'version.properties' } } diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 16828146..d63be3ee 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -2,8 +2,8 @@ import com.github.lunatrius.core.version.VersionChecker; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.proxy.CommonProxy; +import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -12,7 +12,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -@Mod(modid = Reference.MODID, name = Reference.NAME, guiFactory = Reference.GUI_FACTORY) +@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY) public class Schematica { @Instance(Reference.MODID) public static Schematica instance; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java index 91c4b848..ceb95234 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.client.config.GuiConfig; import cpw.mods.fml.client.config.IConfigElement; import net.minecraft.client.gui.GuiScreen; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 8d3bfc5f..c0f1bfe7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -3,8 +3,8 @@ import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 6375cb09..ef389121 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -2,8 +2,8 @@ import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.block.Block; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 3926d301..8e75cb56 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.handler; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.config.Configuration; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 28402561..fb4301d0 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -2,7 +2,7 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 80a0fd99..f8f47f6b 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -4,8 +4,8 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.lib.Reference; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; diff --git a/src/main/java/com/github/lunatrius/schematica/lib/Reference.java b/src/main/java/com/github/lunatrius/schematica/lib/Reference.java deleted file mode 100644 index c324f4ed..00000000 --- a/src/main/java/com/github/lunatrius/schematica/lib/Reference.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.github.lunatrius.schematica.lib; - -import com.google.common.base.Throwables; -import org.apache.logging.log4j.Logger; - -import java.io.InputStream; -import java.util.Properties; - -public class Reference { - static { - Properties prop = new Properties(); - - try { - InputStream stream = Reference.class.getClassLoader().getResourceAsStream("version.properties"); - prop.load(stream); - stream.close(); - } catch (Exception e) { - Throwables.propagate(e); - } - - VERSION = prop.getProperty("version.mod"); - FORGE = prop.getProperty("version.forge"); - MINECRAFT = prop.getProperty("version.minecraft"); - } - - public static final String MODID = "Schematica"; - public static final String NAME = "Schematica"; - public static final String VERSION; - public static final String FORGE; - public static final String MINECRAFT; - public static final String PROXY_SERVER = "com.github.lunatrius.schematica.proxy.ServerProxy"; - public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; - public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; - - public static Logger logger = null; -} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index e0f5b5f7..510c689a 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -9,7 +9,7 @@ import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.KeyInputHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import cpw.mods.fml.client.config.GuiConfigEntries; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index c0f008f0..cb78e3f1 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -2,7 +2,7 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.registry.GameData; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java new file mode 100644 index 00000000..b77dda9c --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java @@ -0,0 +1,16 @@ +package com.github.lunatrius.schematica.reference; + +import org.apache.logging.log4j.Logger; + +public class Reference { + public static final String MODID = "Schematica"; + public static final String NAME = "Schematica"; + public static final String VERSION = "${version}"; + public static final String FORGE = "${forgeversion}"; + public static final String MINECRAFT = "${mcversion}"; + public static final String PROXY_SERVER = "com.github.lunatrius.schematica.proxy.ServerProxy"; + public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; + public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; + + public static Logger logger = null; +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 19ac537f..93165504 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -3,7 +3,7 @@ import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.config.BlockInfo; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index addf02b5..5a757ebb 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index bb78e29d..76a1fdc0 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; -import com.github.lunatrius.schematica.lib.Reference; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/main/resources/version.properties b/src/main/resources/version.properties deleted file mode 100644 index ca9bedd0..00000000 --- a/src/main/resources/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -version.mod=${version} -version.forge=${forgeversion} -version.minecraft=${mcversion} From a2ca2e64d07bbc44f7ca8b894c150e7b5c2b9d08 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 23 Jul 2014 03:21:20 +0200 Subject: [PATCH 051/314] Updating core version, again. --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 0bc96a0b..cb7cec9a 100644 --- a/build.properties +++ b/build.properties @@ -4,6 +4,6 @@ version.micro=0 version.minecraft=1.7.10 version.forge=10.13.0.1187 version.minforge=10.13.0.1185 -version.lunatriuscore=1.1.2.10 +version.lunatriuscore=1.1.2.11 extra.fmlat=schematica_at.cfg From 52bdbfa26bc0b0ebe5a4abbded4b0f61fcf68511 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 23 Jul 2014 04:00:36 +0200 Subject: [PATCH 052/314] Fixed a possible NPE (why was this outside anyway...). --- .../schematica/client/gui/GuiSchematicLoad.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index c0f1bfe7..aeb70d82 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -154,12 +154,16 @@ private void loadSchematic() { try { if (selectedIndex >= 0 && selectedIndex < this.schematicFiles.size()) { - GuiSchematicEntry schematic = this.schematicFiles.get(selectedIndex); - Schematica.proxy.loadSchematic(null, this.currentDirectory, schematic.getName()); + GuiSchematicEntry schematicEntry = this.schematicFiles.get(selectedIndex); + if (Schematica.proxy.loadSchematic(null, this.currentDirectory, schematicEntry.getName())) { + SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null) { + ClientProxy.moveSchematicToPlayer(schematic); + } + } } } catch (Exception e) { Reference.logger.error("Failed to load schematic!", e); } - ClientProxy.moveSchematicToPlayer(Schematica.proxy.getActiveSchematic()); } } From 73db7306306af97c09a6e3128418f3c7fd721e2e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 23 Jul 2014 04:06:20 +0200 Subject: [PATCH 053/314] Fixes an incompatibility with rotateableblocks and possibly other mods. --- .../github/lunatrius/schematica/world/SchematicWorld.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 93165504..b8dd08bd 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -492,7 +492,11 @@ public void rotate() { for (int y = 0; y < this.height; y++) { for (int z = 0; z < this.length; z++) { for (int x = 0; x < this.width; x++) { - getBlock(x, y, this.length - 1 - z).rotateBlock(this, x, y, this.length - 1 - z, ForgeDirection.UP); + try { + getBlock(x, y, this.length - 1 - z).rotateBlock(this, x, y, this.length - 1 - z, ForgeDirection.UP); + } catch (Exception e) { + Reference.logger.debug("Failed to rotate block!", e); + } localBlocks[z][y][x] = this.blocks[x][y][this.length - 1 - z]; localMetadata[z][y][x] = this.metadata[x][y][this.length - 1 - z]; } From f591635a9c813735122259c28548baeb639a9d6c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 23 Jul 2014 16:01:14 +0200 Subject: [PATCH 054/314] Do not crash the client if a TileEntity fails to loads. --- .../schematica/world/schematic/SchematicAlpha.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 5a757ebb..86d6a16e 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -88,9 +88,13 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { NBTTagList tileEntitiesList = tagCompound.getTagList(TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tileEntitiesList.tagCount(); i++) { - TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); - if (tileEntity != null) { - tileEntities.add(tileEntity); + try { + TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); + if (tileEntity != null) { + tileEntities.add(tileEntity); + } + } catch (Exception e) { + Reference.logger.error("TileEntity failed to load properly!", e); } } From 3921ef2850c6cbd79cad8f0174161df6bce23202 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 25 Jul 2014 02:40:32 +0200 Subject: [PATCH 055/314] Added default logger. --- .../com/github/lunatrius/schematica/reference/Reference.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java index b77dda9c..559138c2 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.reference; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Reference { @@ -12,5 +13,5 @@ public class Reference { public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; - public static Logger logger = null; + public static Logger logger = LogManager.getLogger(Reference.MODID); } From bdc84c6799a1a490c551814dc1d63fef92ba9aac Mon Sep 17 00:00:00 2001 From: bilde2910 Date: Wed, 30 Jul 2014 22:14:49 +0200 Subject: [PATCH 056/314] Updated Norwegian localization file --- .../assets/schematica/lang/no_NO.lang | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 9c59cbb8..a76ce3cc 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -1,74 +1,74 @@ # gui - general -# schematica.gui.openFolder=Open schematic folder -# schematica.gui.done=Done -# schematica.gui.title=Select schematic file -# schematica.gui.folderInfo=(Place schematic files here) -# schematica.gui.noschematic=-- No schematic -- +# schematica.gui.openFolder=Åpne tegningsmappen +# schematica.gui.done=Ferdig +# schematica.gui.title=Velg tegningsfil +# schematica.gui.folderInfo=(Plasser tegningsfiler her) +# schematica.gui.noschematic=-- Ingen tegninger -- schematica.gui.increase=+ schematica.gui.decrease=- -# schematica.gui.hide=Hide +# schematica.gui.hide=Skjul schematica.gui.all=ALLE schematica.gui.show=Vis schematica.gui.movehere=Flytt hit -# schematica.gui.flip=Flip -# schematica.gui.rotate=Rotate +# schematica.gui.flip=Vend +# schematica.gui.rotate=Roter schematica.gui.save=Lagre -# schematica.gui.moveschematic=Move schematic -# schematica.gui.layers=Layers -# schematica.gui.operations=Operations -# schematica.gui.point.red=Red point -# schematica.gui.point.blue=Blue point -# schematica.gui.saveselection=Save the selection as a schematic +# schematica.gui.moveschematic=Flytt tegning +# schematica.gui.layers=Lag +# schematica.gui.operations=Operasjoner +# schematica.gui.point.red=Rødt punkt +# schematica.gui.point.blue=Blått punkt +# schematica.gui.saveselection=Lagre utvalget som en tegning schematica.gui.enable=Aktiver schematica.gui.disable=Deaktiver schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: -# schematica.gui.materials=Materials -# schematica.gui.materialname=Material -# schematica.gui.materialamount=Amount +# schematica.gui.materials=Materialer +# schematica.gui.materialname=Materiale +# schematica.gui.materialamount=Mengde # schematica.gui.printer=Printer # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. +# schematica.config.category.render=Gjengivelse +# schematica.config.category.render.tooltip=Gjengivelsesrelaterte innstillinger. # schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. +# schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. +# schematica.config.category.general=Generelt +# schematica.config.category.general.tooltip=Generelle innstillinger. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alphaEnabled=Alpha aktivert +# schematica.config.alphaEnabled.tooltip=Aktiver gjennomsiktige teksturer. # schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +# schematica.config.alpha.tooltip=Alpha-verdi brukt ved gjengivelse av tegningen (1.0 = ugjennomsiktig, 0.5 = halvgjennomsiktig, 0.0 = gjennomsiktig). +# schematica.config.highlight=Marker blokker +# schematica.config.highlight.tooltip=Marker ugyldig plasserte blokker og blokker som skal plasseres. +# schematica.config.highlightAir=Marker luft +# schematica.config.highlightAir.tooltip=Marker blokker som bør være luft. # schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. +# schematica.config.blockDelta.tooltip=Delta-verdi brukt for markering (hvis du opplever z-kollisjoner, øk dette). +# schematica.config.drawQuads=Tegn overflater +# schematica.config.drawQuads.tooltip=Tegn overflateområder. +# schematica.config.drawLines=Tegn linjer +# schematica.config.drawLines.tooltip=Tegn kantlinjer. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.placeDelay=Plasseringsforsinkelse +# schematica.config.placeDelay.tooltip=Forsinkelse mellom plasseringsforsøk (i ticks). +# schematica.config.timeout=Tidsavbrudd +# schematica.config.timeout.tooltip=Tidsavbrudd før nytt forsøk på å plassere blokker. +# schematica.config.placeInstantly=Plasser umiddelbart +# schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. +# schematica.config.placeAdjacent=Plasser kun tilstøtende +# schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. +# schematica.config.schematicDirectory=Tegningskatalog +# schematica.config.schematicDirectory.tooltip=Tegningskatalog. # keys # schematica.key.category=Schematica -# schematica.key.load=Load schematic -# schematica.key.save=Save schematic -# schematica.key.control=Manipulate schematic +# schematica.key.load=Last tegning +# schematica.key.save=Lagre tegning +# schematica.key.control=Manipuler tegning From f7f66eb52ab1af9d8306f9f45d9bc9c72be15d58 Mon Sep 17 00:00:00 2001 From: bilde2910 Date: Wed, 30 Jul 2014 23:39:44 +0200 Subject: [PATCH 057/314] Fixed comments preceding a majority of the translations --- .../assets/schematica/lang/no_NO.lang | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index a76ce3cc..d13d832b 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -1,74 +1,74 @@ # gui - general -# schematica.gui.openFolder=Åpne tegningsmappen -# schematica.gui.done=Ferdig -# schematica.gui.title=Velg tegningsfil -# schematica.gui.folderInfo=(Plasser tegningsfiler her) -# schematica.gui.noschematic=-- Ingen tegninger -- +schematica.gui.openFolder=Åpne tegningsmappen +schematica.gui.done=Ferdig +schematica.gui.title=Velg tegningsfil +schematica.gui.folderInfo=(Plasser tegningsfiler her) +schematica.gui.noschematic=-- Ingen tegninger -- schematica.gui.increase=+ schematica.gui.decrease=- -# schematica.gui.hide=Skjul +schematica.gui.hide=Skjul schematica.gui.all=ALLE schematica.gui.show=Vis schematica.gui.movehere=Flytt hit -# schematica.gui.flip=Vend -# schematica.gui.rotate=Roter +schematica.gui.flip=Vend +schematica.gui.rotate=Roter schematica.gui.save=Lagre -# schematica.gui.moveschematic=Flytt tegning -# schematica.gui.layers=Lag -# schematica.gui.operations=Operasjoner -# schematica.gui.point.red=Rødt punkt -# schematica.gui.point.blue=Blått punkt -# schematica.gui.saveselection=Lagre utvalget som en tegning +schematica.gui.moveschematic=Flytt tegning +schematica.gui.layers=Lag +schematica.gui.operations=Operasjoner +schematica.gui.point.red=Rødt punkt +schematica.gui.point.blue=Blått punkt +schematica.gui.saveselection=Lagre utvalget som en tegning schematica.gui.enable=Aktiver schematica.gui.disable=Deaktiver schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: -# schematica.gui.materials=Materialer -# schematica.gui.materialname=Materiale -# schematica.gui.materialamount=Mengde -# schematica.gui.printer=Printer +schematica.gui.materials=Materialer +schematica.gui.materialname=Materiale +schematica.gui.materialamount=Mengde +schematica.gui.printer=Printer # gui - config - categories -# schematica.config.category.render=Gjengivelse -# schematica.config.category.render.tooltip=Gjengivelsesrelaterte innstillinger. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. -# schematica.config.category.general=Generelt -# schematica.config.category.general.tooltip=Generelle innstillinger. +schematica.config.category.render=Gjengivelse +schematica.config.category.render.tooltip=Gjengivelsesrelaterte innstillinger. +schematica.config.category.printer=Printer +schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. +schematica.config.category.general=Generelt +schematica.config.category.general.tooltip=Generelle innstillinger. # gui - config - render -# schematica.config.alphaEnabled=Alpha aktivert -# schematica.config.alphaEnabled.tooltip=Aktiver gjennomsiktige teksturer. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha-verdi brukt ved gjengivelse av tegningen (1.0 = ugjennomsiktig, 0.5 = halvgjennomsiktig, 0.0 = gjennomsiktig). -# schematica.config.highlight=Marker blokker -# schematica.config.highlight.tooltip=Marker ugyldig plasserte blokker og blokker som skal plasseres. -# schematica.config.highlightAir=Marker luft -# schematica.config.highlightAir.tooltip=Marker blokker som bør være luft. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta-verdi brukt for markering (hvis du opplever z-kollisjoner, øk dette). -# schematica.config.drawQuads=Tegn overflater -# schematica.config.drawQuads.tooltip=Tegn overflateområder. -# schematica.config.drawLines=Tegn linjer -# schematica.config.drawLines.tooltip=Tegn kantlinjer. +schematica.config.alphaEnabled=Alpha aktivert +schematica.config.alphaEnabled.tooltip=Aktiver gjennomsiktige teksturer. +schematica.config.alpha=Alpha +schematica.config.alpha.tooltip=Alpha-verdi brukt ved gjengivelse av tegningen (1.0 = ugjennomsiktig, 0.5 = halvgjennomsiktig, 0.0 = gjennomsiktig). +schematica.config.highlight=Marker blokker +schematica.config.highlight.tooltip=Marker ugyldig plasserte blokker og blokker som skal plasseres. +schematica.config.highlightAir=Marker luft +schematica.config.highlightAir.tooltip=Marker blokker som bør være luft. +schematica.config.blockDelta=Block Delta +schematica.config.blockDelta.tooltip=Delta-verdi brukt for markering (hvis du opplever z-kollisjoner, øk dette). +schematica.config.drawQuads=Tegn overflater +schematica.config.drawQuads.tooltip=Tegn overflateområder. +schematica.config.drawLines=Tegn linjer +schematica.config.drawLines.tooltip=Tegn kantlinjer. # gui - config - printer -# schematica.config.placeDelay=Plasseringsforsinkelse -# schematica.config.placeDelay.tooltip=Forsinkelse mellom plasseringsforsøk (i ticks). -# schematica.config.timeout=Tidsavbrudd -# schematica.config.timeout.tooltip=Tidsavbrudd før nytt forsøk på å plassere blokker. -# schematica.config.placeInstantly=Plasser umiddelbart -# schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. -# schematica.config.placeAdjacent=Plasser kun tilstøtende -# schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. +schematica.config.placeDelay=Plasseringsforsinkelse +schematica.config.placeDelay.tooltip=Forsinkelse mellom plasseringsforsøk (i ticks). +schematica.config.timeout=Tidsavbrudd +schematica.config.timeout.tooltip=Tidsavbrudd før nytt forsøk på å plassere blokker. +schematica.config.placeInstantly=Plasser umiddelbart +schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. +schematica.config.placeAdjacent=Plasser kun tilstøtende +schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. # gui - config - general -# schematica.config.schematicDirectory=Tegningskatalog -# schematica.config.schematicDirectory.tooltip=Tegningskatalog. +schematica.config.schematicDirectory=Tegningskatalog +schematica.config.schematicDirectory.tooltip=Tegningskatalog. # keys -# schematica.key.category=Schematica -# schematica.key.load=Last tegning -# schematica.key.save=Lagre tegning -# schematica.key.control=Manipuler tegning +schematica.key.category=Schematica +schematica.key.load=Last tegning +schematica.key.save=Lagre tegning +schematica.key.control=Manipuler tegning From 748170942619ab7aa758594587f6f32f9c7ffe2e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 1 Aug 2014 02:06:58 +0200 Subject: [PATCH 058/314] HashMap optimizations. --- .../com/github/lunatrius/schematica/config/BlockInfo.java | 5 +++-- .../github/lunatrius/schematica/world/SchematicWorld.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 98156de6..676054a6 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -239,8 +239,9 @@ private static Item addBlockItemMapping(Object blockObj, Object itemObj) { } public static Item getItemFromBlock(Block block) { - if (BLOCK_ITEM_MAP.containsKey(block)) { - return BLOCK_ITEM_MAP.get(block); + Item item = BLOCK_ITEM_MAP.get(block); + if (item != null) { + return item; } return Item.getItemFromBlock(block); diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index b8dd08bd..59d7d95b 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -195,8 +195,9 @@ private void generateBlockList() { itemDamage = 0; } - if (BlockInfo.BLOCK_ITEM_MAP.containsKey(block)) { - item = BlockInfo.BLOCK_ITEM_MAP.get(block); + Item tmp = BlockInfo.BLOCK_ITEM_MAP.get(block); + if (tmp != null) { + item = tmp; Block blockFromItem = Block.getBlockFromItem(item); if (blockFromItem != Blocks.air) { block = blockFromItem; From 97f9e881b0009cf4faef6c5b91259e9f63a31039 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 1 Aug 2014 02:16:06 +0200 Subject: [PATCH 059/314] Added comparator placement mapping. Closes #42 --- .../java/com/github/lunatrius/schematica/config/BlockInfo.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 676054a6..06b232e8 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -281,6 +281,7 @@ public static void populatePlacementMaps() { addPlacementMapping(Blocks.stained_hardened_clay, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.stained_glass_pane, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Items.repeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); + addPlacementMapping(Items.comparator, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); } public static PlacementData addPlacementMapping(Class clazz, PlacementData data) { From 6a9c831f0854563b0b1354588bf33944ae97e7c0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 9 Aug 2014 01:59:55 +0200 Subject: [PATCH 060/314] Merged metadata sensitive and insensitive methods by using a wildcard value. Correctly detect air blocks in schematics and replaceable blocks in the client world. --- .../schematica/SchematicPrinter.java | 43 +++++-------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 431ce0c9..90417039 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -12,7 +12,6 @@ import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBucket; @@ -29,6 +28,8 @@ import java.util.List; public class SchematicPrinter { + public static final int WILDCARD_METADATA = -1; + public static final SchematicPrinter INSTANCE = new SchematicPrinter(); private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -109,7 +110,7 @@ public boolean print() { for (z = minZ; z < maxZ; z++) { Block block = this.schematic.getBlock(x, y, z); - if (block == Blocks.air) { + if (this.schematic.isAirBlock(x, y, z)) { continue; } @@ -123,7 +124,7 @@ public boolean print() { wz = this.schematic.position.z + z; Block realBlock = world.getBlock(wx, wy, wz); - if (!world.isAirBlock(wx, wy, wz) && realBlock != null && !realBlock.canPlaceBlockAt(world, wx, wy, wz)) { + if (!realBlock.isReplaceable(world, wx, wy, wz)) { continue; } @@ -200,6 +201,8 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player float offsetY = 0.0f; if (solidSides.length > 0) { + int metadata = WILDCARD_METADATA; + if (data != null) { ForgeDirection[] validDirections = data.getValidDirections(solidSides, itemDamage); if (validDirections.length > 0) { @@ -209,20 +212,14 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player offsetY = data.getOffsetFromMetadata(itemDamage); if (data.maskMetaInHand != -1) { - if (!swapToItem(player.inventory, item, data.getMetaInHand(itemDamage))) { - return false; - } - } else { - if (!swapToItem(player.inventory, item)) { - return false; - } + metadata = data.getMetaInHand(itemDamage); } } else { direction = solidSides[0]; + } - if (!swapToItem(player.inventory, item)) { - return false; - } + if (!swapToItem(player.inventory, item, metadata)) { + return false; } } @@ -304,27 +301,9 @@ private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) return false; } - private boolean swapToItem(InventoryPlayer inventory, Item item) { - int slot = getInventorySlotWithItem(inventory, item); - if (slot > -1 && slot < 9) { - inventory.currentItem = slot; - return true; - } - return false; - } - private int getInventorySlotWithItem(InventoryPlayer inventory, Item item, int itemDamage) { for (int i = 0; i < inventory.mainInventory.length; i++) { - if (inventory.mainInventory[i] != null && inventory.mainInventory[i].getItem() == item && inventory.mainInventory[i].getItemDamage() == itemDamage) { - return i; - } - } - return -1; - } - - private int getInventorySlotWithItem(InventoryPlayer inventory, Item item) { - for (int i = 0; i < inventory.mainInventory.length; i++) { - if (inventory.mainInventory[i] != null && inventory.mainInventory[i].getItem() == item) { + if (inventory.mainInventory[i] != null && inventory.mainInventory[i].getItem() == item && (itemDamage == WILDCARD_METADATA || inventory.mainInventory[i].getItemDamage() == itemDamage)) { return i; } } From c028ed836bd8f7c7763aa66badb6ed5a0af5ca51 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 9 Aug 2014 03:38:36 +0200 Subject: [PATCH 061/314] The printer can now place blocks from the inventory by moving them onto configurable slots. --- .../schematica/SchematicPrinter.java | 67 ++++++++++++++++++- .../handler/ConfigurationHandler.java | 14 ++++ .../assets/schematica/lang/en_US.lang | 2 + 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 90417039..b753768b 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -29,6 +29,20 @@ public class SchematicPrinter { public static final int WILDCARD_METADATA = -1; + public static final int SIZE_CRAFTING_OUT = 1; + public static final int SIZE_CRAFTING_IN = 4; + public static final int SIZE_ARMOR = 4; + public static final int SIZE_INVENTORY = 3 * 9; + public static final int SIZE_HOTBAR = 9; + + public static final int SLOT_OFFSET_CRAFTING_OUT = 0; + public static final int SLOT_OFFSET_CRAFTING_IN = SLOT_OFFSET_CRAFTING_OUT + SIZE_CRAFTING_OUT; + public static final int SLOT_OFFSET_ARMOR = SLOT_OFFSET_CRAFTING_IN + SIZE_CRAFTING_IN; + public static final int SLOT_OFFSET_INVENTORY = SLOT_OFFSET_ARMOR + SIZE_ARMOR; + public static final int SLOT_OFFSET_HOTBAR = SLOT_OFFSET_INVENTORY + SIZE_INVENTORY; + + public static final int INV_OFFSET_HOTBAR = 0; + public static final int INV_OFFSET_INVENTORY = INV_OFFSET_HOTBAR + 9; public static final SchematicPrinter INSTANCE = new SchematicPrinter(); @@ -293,10 +307,18 @@ private void syncSneaking(EntityClientPlayerMP player, boolean isSneaking) { } private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) { + return swapToItem(inventory, item, itemDamage, true); + } + + private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage, boolean swapSlots) { int slot = getInventorySlotWithItem(inventory, item, itemDamage); - if (slot > -1 && slot < 9) { + if (slot >= INV_OFFSET_HOTBAR && slot < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { inventory.currentItem = slot; return true; + } else if (swapSlots && slot >= INV_OFFSET_INVENTORY && slot < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + if (swapSlots(inventory, slot)) { + return swapToItem(inventory, item, itemDamage, false); + } } return false; } @@ -309,4 +331,47 @@ private int getInventorySlotWithItem(InventoryPlayer inventory, Item item, int i } return -1; } + + private boolean swapSlots(InventoryPlayer inventory, int from) { + if (ConfigurationHandler.swapSlotsQueue.size() > 0) { + int slot = ConfigurationHandler.swapSlotsQueue.poll() % SIZE_HOTBAR; + ConfigurationHandler.swapSlotsQueue.offer(slot); + + ItemStack itemStack = inventory.mainInventory[slot + INV_OFFSET_HOTBAR]; + swapSlots(from, slot, itemStack == null || itemStack.stackSize == 0); + return true; + } + + return false; + } + + private boolean swapSlots(int from, int to, boolean targetEmpty) { + if (from >= INV_OFFSET_HOTBAR && from < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { + from = SLOT_OFFSET_HOTBAR + (from - INV_OFFSET_HOTBAR); + } else if (from >= INV_OFFSET_INVENTORY && from < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + from = SLOT_OFFSET_INVENTORY + (from - INV_OFFSET_INVENTORY); + } else { + return false; + } + + if (to >= INV_OFFSET_HOTBAR && to < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { + to = SLOT_OFFSET_HOTBAR + (to - INV_OFFSET_HOTBAR); + } else if (to >= INV_OFFSET_INVENTORY && to < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + to = SLOT_OFFSET_INVENTORY + (to - INV_OFFSET_INVENTORY); + } else { + return false; + } + + clickSlot(from); + clickSlot(to); + if (!targetEmpty) { + clickSlot(from); + } + + return true; + } + + private ItemStack clickSlot(int slot) { + return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, slot, 0, 0, this.minecraft.thePlayer); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 8e75cb56..d8a8aa63 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -2,6 +2,7 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Reference; +import com.google.common.primitives.Ints; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.config.Configuration; @@ -9,6 +10,8 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayDeque; +import java.util.Queue; public class ConfigurationHandler { public static final String CATEGORY_RENDER = "render"; @@ -38,6 +41,8 @@ public class ConfigurationHandler { public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; public static final String PLACE_ADJACENT = "placeAdjacent"; public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; + public static final String SWAP_SLOTS = "swapSlots"; + public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; @@ -55,6 +60,7 @@ public class ConfigurationHandler { public static final int TIMEOUT_DEFAULT = 10; public static final boolean PLACEINSTANTLY_DEFAULT = false; public static final boolean PLACEADJACENT_DEFAULT = true; + public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; public static final boolean DRAWQUADS_DEFAULT = true; public static final boolean DRAWLINES_DEFAULT = true; public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), "schematics"); @@ -68,6 +74,8 @@ public class ConfigurationHandler { public static int timeout = TIMEOUT_DEFAULT; public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; + public static int[] swapSlots = SWAPSLOTS_DEFAULT; + public static Queue swapSlotsQueue = new ArrayDeque(); public static boolean drawQuads = DRAWQUADS_DEFAULT; public static boolean drawLines = DRAWLINES_DEFAULT; public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; @@ -81,6 +89,7 @@ public class ConfigurationHandler { public static Property propTimeout = null; public static Property propPlaceInstantly = null; public static Property propPlaceAdjacent = null; + public static Property propSwapSlots = null; public static Property propDrawQuads = null; public static Property propDrawLines = null; public static Property propSchematicDirectory = null; @@ -139,6 +148,11 @@ private static void loadConfiguration() { propPlaceAdjacent.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_ADJACENT)); placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); + propSwapSlots = configuration.get(CATEGORY_PRINTER, SWAP_SLOTS, SWAPSLOTS_DEFAULT, SWAP_SLOTS_DESC, 0, 8); + propSwapSlots.setLanguageKey(String.format("%s.%s", LANG_PREFIX, SWAP_SLOTS)); + swapSlots = propSwapSlots.getIntList(); + swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); + try { schematicDirectory = SCHEMATICDIRECTORY_DEFAULT.getCanonicalFile(); } catch (IOException e) { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 8d052e87..78c3c4bb 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -62,6 +62,8 @@ schematica.config.placeInstantly=Place Instantly schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. schematica.config.placeAdjacent=Place Only Adjacent schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +schematica.config.swapSlots=Swap Slots +schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general schematica.config.schematicDirectory=Schematic Directory From 04e29f65cf7635e43bda635a313624a94d0802a4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 9 Aug 2014 03:39:11 +0200 Subject: [PATCH 062/314] Localization update. --- src/main/resources/assets/schematica/lang/ca_ES.lang | 2 ++ src/main/resources/assets/schematica/lang/cs_CZ.lang | 2 ++ src/main/resources/assets/schematica/lang/da_DK.lang | 2 ++ src/main/resources/assets/schematica/lang/de_DE.lang | 2 ++ src/main/resources/assets/schematica/lang/en_GB.lang | 2 ++ src/main/resources/assets/schematica/lang/en_PT.lang | 2 ++ src/main/resources/assets/schematica/lang/es_ES.lang | 2 ++ src/main/resources/assets/schematica/lang/es_MX.lang | 2 ++ src/main/resources/assets/schematica/lang/fi_FI.lang | 2 ++ src/main/resources/assets/schematica/lang/fr_FR.lang | 2 ++ src/main/resources/assets/schematica/lang/hu_HU.lang | 2 ++ src/main/resources/assets/schematica/lang/it_IT.lang | 2 ++ src/main/resources/assets/schematica/lang/la_LA.lang | 2 ++ src/main/resources/assets/schematica/lang/lt_LT.lang | 2 ++ src/main/resources/assets/schematica/lang/nl_NL.lang | 2 ++ src/main/resources/assets/schematica/lang/no_NO.lang | 2 ++ src/main/resources/assets/schematica/lang/pl_PL.lang | 2 ++ src/main/resources/assets/schematica/lang/pt_PT.lang | 2 ++ src/main/resources/assets/schematica/lang/ru_RU.lang | 2 ++ src/main/resources/assets/schematica/lang/sk_SK.lang | 2 ++ src/main/resources/assets/schematica/lang/sl_SI.lang | 2 ++ src/main/resources/assets/schematica/lang/th_TH.lang | 2 ++ src/main/resources/assets/schematica/lang/tr_TR.lang | 2 ++ src/main/resources/assets/schematica/lang/uk_UA.lang | 2 ++ src/main/resources/assets/schematica/lang/zh_CN.lang | 2 ++ 25 files changed, 50 insertions(+) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 65f0e4bf..aa71dfa1 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Imprimir # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index ec3b7026..a3e49f67 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Tiskárna # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 0965d073..8a219225 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -62,6 +62,8 @@ schematica.gui.materialamount=Antal # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 1f73d2d5..296e3b6f 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Drucker # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 66e0bf73..70e8f09f 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Printer # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 02ac6202..9c7935cf 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Printing thing # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index e196f9e0..056a7da2 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Impresora # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index af064012..9588bd35 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -62,6 +62,8 @@ schematica.gui.materialamount=Cantidad # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 76c5fe71..e7f9cfd1 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Tulostin # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index f16c7b29..f6cd0158 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Mode imprimante # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 51bf092b..7e29baac 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Nyomtató # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 39f58069..a19ae783 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -62,6 +62,8 @@ schematica.gui.materialamount=Quantità # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index b709c0a5..3b85abc1 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -62,6 +62,8 @@ schematica.gui.materialamount=Numerus # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index f5156070..0f0987c0 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -62,6 +62,8 @@ schematica.gui.materialamount=Kiekis # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 03b8ceac..03f82400 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -62,6 +62,8 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index d13d832b..d9ca9c20 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -62,6 +62,8 @@ schematica.config.placeInstantly=Plasser umiddelbart schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. schematica.config.placeAdjacent=Plasser kun tilstøtende schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general schematica.config.schematicDirectory=Tegningskatalog diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 944eef68..5d867da3 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Drukarka # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index e7a89aab..d0554517 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 092a0cdd..8d38f6b4 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Принтер # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 8de35745..a30b802b 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Tlačiareň # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index f1dfc874..c86acafc 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Tiskalnik # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index e17134e2..98598907 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -62,6 +62,8 @@ schematica.gui.printer=การปริ๊น # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index fdd436ff..fdcc299e 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Yazıcı # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 6926ff24..3adccc7d 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -62,6 +62,8 @@ schematica.gui.printer=Принтер # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 406dd19d..b60d3559 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -62,6 +62,8 @@ schematica.gui.printer=投影 # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +# schematica.config.swapSlots=Swap Slots +# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - general # schematica.config.schematicDirectory=Schematic Directory From 59df55c67ad5bc6096a1af0d1ec3b51846ded663 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 9 Aug 2014 03:41:46 +0200 Subject: [PATCH 063/314] Bumped version number. --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index cb7cec9a..651db73a 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ version.major=1 version.minor=7 -version.micro=0 +version.micro=1 version.minecraft=1.7.10 version.forge=10.13.0.1187 version.minforge=10.13.0.1185 From e21e589c21fa8124867b8a9366ee2ff0f5f60c61 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 11 Aug 2014 03:20:02 +0200 Subject: [PATCH 064/314] Added pick block from a schematic. --- .../handler/client/KeyInputHandler.java | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 2dbe3e33..abec6565 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -1,15 +1,25 @@ package com.github.lunatrius.schematica.handler.client; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraftforge.common.ForgeHooks; import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; import static cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; +import static cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent; public class KeyInputHandler { public static final String CATEGORY = "schematica.key.category"; @@ -48,4 +58,71 @@ public void onKeyInput(KeyInputEvent event) { } } } + + @SubscribeEvent + public void onMouseInput(MouseInputEvent event) { + if (this.minecraft.gameSettings.keyBindPickBlock.isPressed()) { + try { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + + if (schematic != null) { + final boolean revert = pickBlock(schematic, 1.0f); + if (revert) { + final int eventButton = Mouse.getEventButton(); + KeyBinding.onTick(eventButton - 100); + } + } + } catch (Exception e) { + Reference.logger.error("Could not pick block!", e); + } + } + } + + private boolean pickBlock(final SchematicWorld schematic, final float partialTicks) { + final MovingObjectPosition objectMouseOver = rayTrace(schematic, partialTicks); + boolean revert = false; + + // Minecraft.func_147112_ai + if (objectMouseOver != null) { + final EntityClientPlayerMP player = this.minecraft.thePlayer; + + if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { + revert = true; + } + + if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { + return revert; + } + + if (player.capabilities.isCreativeMode) { + final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; + this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); + } + } + + return revert; + } + + private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { + final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; + final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance(); + + final double posX = renderViewEntity.posX; + final double posY = renderViewEntity.posY; + final double posZ = renderViewEntity.posZ; + + renderViewEntity.posX -= schematic.position.x; + renderViewEntity.posY -= schematic.position.y; + renderViewEntity.posZ -= schematic.position.z; + + final Vec3 vecPosition = renderViewEntity.getPosition(partialTicks); + final Vec3 vecLook = renderViewEntity.getLook(partialTicks); + final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); + + renderViewEntity.posX = posX; + renderViewEntity.posY = posY; + renderViewEntity.posZ = posZ; + + return schematic.func_147447_a(vecPosition, vecExtendedLook, false, false, true); + } } From cda1989d328b25ed8e51282e15c3f33a53f7bba8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 11 Aug 2014 03:51:49 +0200 Subject: [PATCH 065/314] Make sure to revert the key press if there is no schematic loaded. --- .../schematica/handler/client/KeyInputHandler.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index abec6565..3f206ccf 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -64,13 +64,15 @@ public void onMouseInput(MouseInputEvent event) { if (this.minecraft.gameSettings.keyBindPickBlock.isPressed()) { try { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + boolean revert = true; if (schematic != null) { - final boolean revert = pickBlock(schematic, 1.0f); - if (revert) { - final int eventButton = Mouse.getEventButton(); - KeyBinding.onTick(eventButton - 100); - } + revert = pickBlock(schematic, 1.0f); + } + + if (revert) { + final int eventButton = Mouse.getEventButton(); + KeyBinding.onTick(eventButton - 100); } } catch (Exception e) { Reference.logger.error("Could not pick block!", e); From 7bba683e3547e8e9d370a5ae7913c0b5741dfb69 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 11 Aug 2014 04:18:22 +0200 Subject: [PATCH 066/314] Creative mode no longer requires items in the survival inventory. --- .../lunatrius/schematica/SchematicPrinter.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index b753768b..8c8dc8dc 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -312,6 +312,14 @@ private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage, boolean swapSlots) { int slot = getInventorySlotWithItem(inventory, item, itemDamage); + + if (this.minecraft.playerController.isInCreativeMode() && (slot < INV_OFFSET_HOTBAR || slot >= INV_OFFSET_HOTBAR + SIZE_HOTBAR) && ConfigurationHandler.swapSlotsQueue.size() > 0) { + inventory.currentItem = getNextSlot(); + inventory.setInventorySlotContents(inventory.currentItem, new ItemStack(item, 1, itemDamage)); + this.minecraft.playerController.sendSlotPacket(inventory.getStackInSlot(inventory.currentItem), SLOT_OFFSET_HOTBAR + inventory.currentItem); + return true; + } + if (slot >= INV_OFFSET_HOTBAR && slot < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { inventory.currentItem = slot; return true; @@ -334,8 +342,7 @@ private int getInventorySlotWithItem(InventoryPlayer inventory, Item item, int i private boolean swapSlots(InventoryPlayer inventory, int from) { if (ConfigurationHandler.swapSlotsQueue.size() > 0) { - int slot = ConfigurationHandler.swapSlotsQueue.poll() % SIZE_HOTBAR; - ConfigurationHandler.swapSlotsQueue.offer(slot); + int slot = getNextSlot(); ItemStack itemStack = inventory.mainInventory[slot + INV_OFFSET_HOTBAR]; swapSlots(from, slot, itemStack == null || itemStack.stackSize == 0); @@ -345,6 +352,12 @@ private boolean swapSlots(InventoryPlayer inventory, int from) { return false; } + private int getNextSlot() { + int slot = ConfigurationHandler.swapSlotsQueue.poll() % SIZE_HOTBAR; + ConfigurationHandler.swapSlotsQueue.offer(slot); + return slot; + } + private boolean swapSlots(int from, int to, boolean targetEmpty) { if (from >= INV_OFFSET_HOTBAR && from < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { from = SLOT_OFFSET_HOTBAR + (from - INV_OFFSET_HOTBAR); From 572cc1a992c0e0b086239607ecdca49dd8bf3490 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 12 Aug 2014 18:51:11 +0200 Subject: [PATCH 067/314] Added *.ipr and *.iws files to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e8ef9988..8b1a36e7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ /out /.idea /*.iml +/*.ipr +/*.iws From a5563676c9775d236c763fb2872a03dfe2b51f89 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 12 Aug 2014 20:06:22 +0200 Subject: [PATCH 068/314] Updated the gradle wrapper to 2.0. --- gradle/wrapper/gradle-wrapper.jar | Bin 50557 -> 51017 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5838598129719e795cc5633f411468bdec311016..b7612167031001b7b84baf2a959e8ea8ad03c011 100644 GIT binary patch delta 23511 zcmZ6yb984-(={C1HYTj8z?Wp zZ?;f}o2~B&K49Un-xIX*49mybYO-GZ9GCYio01WXJqv~`vQRqXhQl&sa|$;E1JfJ8 zX*@uURZaEb!nli{1|KXuZeO9f#72#=!q*|%HLYV^azwz|+HtYyHf}GQ?rh=Rx{hp$ z6-Dtummb}0t(nPqueoO7T6CCMtaWVQN4y@vLKUwf%qXDE=Uy)ndWbAQ+NoFK1^G{)}XjdYb(%y3h!q-ZX~NS*UP}a9ylPeuS-Xi$R2YaK(dkzU>iz zyG>2$ik82w+`GdW&`a{fULnT0i6qA8@g_s*vKez@Aj-0jJ#F=t3^tppW~AK?tLFu> z=g&R}!MYytTpXs|dQCtdTLz1cx`cmG$qJs8a=WOc&D5)Tz~p|1o6j}LUacPq{MOy^}j%9 zq^<=05Qh7q8tMWUBQZ@B+;-8AfUwRnpZ<_HG} zp?&JNxg-;GC{}TKV)z%$82>-?@%D8#hQNV<-u|8jmVcm`;MPI}NK%!uLp8?xwoWHE zZ?`7qCziJY3Tl-1r^HzBPhK@J)69i00!MEdW7lclipr3Y@+RUte|Nq;%_?9fp;Lz( z#ugJB3E)2PyXzmqX2`~3AQ;?f$w=K_z61}1c#uHUoYw$?TsSy? zB<6~wi}!pWjKt>z2%nI!KZnj$yEGTzB1`Tjk}cSY@dKI$Qy>Xt* zn0e0wW28i50X7Os#}TFrrj8r1L&BL>GXQHREbzhdNkv&MjHck8aVAx|I`NQmb|QTz z3sgKwVj?T15v5>cZRDnisW-m_%h;&pC2}nwoPG_`dvsx|T zC^-o{HdzFl5GKnL$dKc{k-DLpB!{z6P04pe6aG^T*kfXW)eoIb1esd=MkIm;-kV{oA6AU4=v1(8kxdk^mpL^N;MG`E*2*Dz@m$6W){<(@h~bp>GZ^53auheO`oTiO zpufc|iltto(a2oHyj-*C>={%aNqNsq&@YSKQLE(7^Ggz&p*OzP{>})W%ECjn$p}qv zg3=%oa8;)^6FG{78AwS#n%W!T(@A<@-1$R)K~f}Tw{F;2d$7VsJN^zwHzlrD$)}U} zKt{U$_x0;F6^?<|Nj-5M^HsFtAYM2Wo~`}kkK}Tr;3X>~?KvxhD7Z9Lqv|%2>r4?V z7G~jR`|_?UL7$NrSL4o*=g$}Z;gHeyyST_0K%8lI3RO^G@q4;G!oYrZygUXvTg`ac z6ST;qoVi6ld_>5MT%3(@;^d#X;3ER=oLgI?FzWWiF69Dcex|DCvv|@=_2wZ=EEIfh z?)arjf6%W<|56VMm}c(rUvNI zIO(;RcC!6ZhnaySh%-!=1!!At=P!9Fz+)_+H@(+Xi8H+%jPSo={HT-z{k4nbx!~J6 z!ZxXtvy%69sdRndm!|lr2%sRl#UL4)x`!F|(v0li{IKM-YIX_eBP~~n$+%nS3p)WtRU~r{aWuwoCt?rE0&(I2W6~klt1boQHz}2_ z;(3_r;}&u=T@O?d2JghyLF1`wsYU1Cc%dE4;T&Yd0A5jg+-yM?1xg`tMb;IQ$-2?B z16`QRytKK2UAj>yhE2^xbk@rAMEKtnreP4an_=n;|_b1-|_!~olFcN0D zSO9LQBj{g{6T0qQ5G1%(0=4LjyP&kF7qQ9JMMJ8wjnR$!;t9oS z9wn{|$7bp5<_jI9*2Ww*f-{9OH}BmykKH$o-Uhs?cJBVtBb2>{y?Xtg$Aq_nYs5vdj3c||h{muzk;_4p**@{Qz zgZXn0-E4RKuD|4e+Y*!*h_NC!xxgegHAX|bc}zkf(!+|N4(oCAnUf-(CNK%zvkZ7x zNy~{I@pPQl6&FzX!4tD^p=U~-$E70kWG|YUL>k$(@Z!6gyg!=x-@EUBzyK<(xRj~8 zrgY?Fk!zNXwfLugAf8J26(NW$!s+5iVQ=biC$P4ei$o=ABg@AZoBt7&&|)f}P=Wwd z(j~IsML>8?x@pS^7uFB3!~0PWnCxTu9r{@hL5j*1(~|IInyLWJCj1nI8_KN9cM5`) z%8)DE#T&C!6scv6EBL)0J`C`Oy-<{cydVnNG8`_ds5d$LsUNtIEK!!RwaL_-D!JZp zBfL5~rcojGV`vC|KPxX9V;B3<2I5 zA#YmkBdWWf#6c7j!O@Kut&v1gRK3-3q|tbB>BJqSWQrkzAL=O@nK__v(uvv1sYKlH z)ZP!>eeDgE#e72JSizbZKT1S2vKBe3?%s&qD=!hVDRbkS?7X6&8A%qahIXs~L84k8 z?f}OLZy`3gh!`XsnN!Wn@`b%yNF*XkAmib8l%tbldSXV&nIino&@-CX?*YVHA-{<4 z7^~S^k`MI(xmzXhUkiX+#}9w~TBHrn$HhlJZ_xpUyTIVzdn-8mZqdOPeF;5%w&)+S z12=b&ek$|=TMQLCwB)tx#tkbx*`aA3foG?ecq_MXo0N3VBSXdGSy;55U?^EQ}+Lk_C8Su};Jup&j}8DxvnFynktJ=2(M@l;hJgIN^&VSXaK1*I}< z95%Z_X^8rL2z5XYs93xS50Xhm+M<%E-oe}AaI}a57pr>~ax-h4_6zBVrp%&*%U5oe zOGbk1HhQ{PB@)fqk^qZd0$4q%pSGk@pwkaQdS{y;71TfZ0;oQ9lDmoqMzBIe`f9=a z7Q;|tF~U*eMCqKMJ|RC;E%!kp8K|HEQq#rg7V2=P+@kcAfNje3gqB5*uKn-%* zrJ+sf>LIx3bF@kaskBRVsqPQ?&Lcb6eDtm7FPUPrD8La7PyF8sU@j z7@ZcHa?TVb^Y$eASyGKW)mEKi`ATP`N+#YCTeK>o%{dMoO*u8})m<&SsXEiE7{zcE zwL)x%?P36P4%PY;a6g?Bg)>-r^@n!Nh~xX>_~v$F-iIc%1;sUH7Hf2uLVb(2*|_EG zjx!~6@_jdZM3?eKU(1>n_yw6aVPV}@jE%=h*N7;(qHDXJdpd@07Q3pFp(rUpb*^jM z6@B>@d$_^sy?m39&D`F2{~1NKr_G=3d+|!xVUZE8to`ckoc8Fd5nHdPCj( zV>PaVBF#Bkj^@E}4Gi8=K4pcK&U|vv$-Pg!xYhpk^>zFTq{&LZN^IFf%wgQB&V!}G zQ|6?#KQl0$W2)d}#k{wO+rq^kn=lXDL)gabq1iN6*T&O*_zm>0Q#Huz#2BB;i>uYjVTNeSblxdHOZ;O~XcwK9HO`lQzIs6C}(?KAY=gtm$ zCLvi4JFEH=@QuseX4fe&7V}iW8MbyP-72si^aoZSB^bhLgXAf-13inNhXT}i^M(q5wH?O%`{*=qq$JuzKFN=rFUCTV?uzy~MXKG{M@|cZEeqXI zeY@-hy;^m0KrDV8?wnbD?__#hwq~cp9pO&~f$#v{M^@6;c(Z$Ddg{nI^bWYAI!nZ` zJFCn~R|C}Ke!qJqS${iRI;PV`5Dp;vVpo8rNh79cHPoX~4_?zAdfgtJJr5HfYOe6T zE{UNc!X9nog|rQhW7lC*N=T{$&)#W7pC{`#;`N@TReW>#U>4NF3d)b2;e`ZBlCLU8 zw|=2Vs;{(SUZF;Pw3WH#_p{uBP=USHtdvfP^*<1e#J~w=EbQ&Qy7vbSlox_;blJNba79!npD@$LbGag~r*-uWj6Q=_UU0iV?wow? z4R)>zdWzS6npR_amJpc6cJ=^>l*=x{r95|S?m51Q3E6~^qwXtgr)@uow$qDyo=ALD zW9tIPRs)Qma;8CT4j5`#_3lfv>>Ks*tnrYHqfMXM_=5Ps*pwu2NeY)nCP$TOVq*9s z(AhNt6teT)xu~z3ljCn-I_lFmSjK;xO=~S}Hw;UgkIw7^PmOb*g4O|4V@p@vTiBOt zEmUH23{>p!4wiZkWwL1$pguEaT~E59VI4QDa~ZQDpi(5ytG~|;sYnxe=JFp5t;bywvH0RFMMzAGWG1;{^GyPzEyLWBwv{%wN+$i)DJ(Tqm6pjAz$ zPkLaEZbf@aVbB(dbWXOXZL8Uq23#U(H-g?%wiug$EY0#YKz8WiliDMw>BDi~eUoP7 zwQ{y49wuqWnBqmTGT8tW?g<}Ir1*Mci_mgHuIFu%SsTBmxcyOFSnH+02^9ePck&rn=LQLPW0j+w?T&7{pU_?=B_#o%LL;3YxUR99?2^TM$S7wPXrwlOjcVb z|1^E)+?*&DS@F z`d3TLThcG_(vC(w(*c-v{q-$%dnfyLAeqp*P7{-`E2)Amxcr(a&5am!z3be6w|8^Q z){WRzoN;H9h4@!r>Y20Wk3%{UQdb?+hFf5@3rd&5iY^esWc0YG5H_g&vHraz(cfzw zJn6iWBn6v%REF9(p#5QNV|{y5|o5OQ%` znely_H|U#W?9}FLe07f}YG4r(as47!rp9Ype6-Yfqao!NJl#PimYT|Aljy+F5M@_w z1$q~dMRPTag4DyIX(S&3Ru>7s+>#Pcr!APSQpnDK7gZ(cc!iCN!3@ntlO!<9ljE}1cId&U!SMVtv z+yPJgP+PhzZ3m|afC25b`ii0QDVk#4O{S>*bd?Hw1u9&@=TGuz{$#50aALS;i~+%B zLVlYB;(8Mm${Ydn)^4?p<*O2}jlzVz`lf*?85>+hL^%r=Xt9YfS5x4QOXB8L%Ozd1a7sA%|sg=AegbGg1Lu;0Xsg~Ou)*S z-^urBb-egcy44Xo{HHB^d z<~u~JX09$9KnhOGMa+%;?6-)0XuO5+8!nB~9 zOEwNnE?!-9#XJ&xwg{;F5Y}0^o6Qa8P!V9YPYE9l@Mqz?us4$enHCC{!zN1m_OrtW z4JzYKys>VTBcQ*+Ww#pxq998uL>j|nB=EI`fF34Gb%<;h`o(dCWy^mMg}2a(mW#o| z%dZeU^VK4kbbSeHa9I(u;3Y(u0wSaT!*`Q-qIRbiwDz;vNS8xpb+dLt_n^oLJV94P zV}?bHmJJkJ*o>3R4EYt6Mjz}RQ?*}Yp5;-P`U&yBq1#z0!<^8eBL$d|L;ag%F=;o} zx6ZpS&};J7%#$~wA`+JjEewOMLq>%Q+b+H;hSP8vyH0+o=^e{}^t=NJBOh)6B;HNA zR0&#Ia5`;gJa@a_Y}jr;j?6IZ0HNJY_97j_V_D4AcU29q_Vawn^#TPci$N2>(; z(VdOzWe_Ll{L-5pw*hP!V3moFcr5W$Yi{EzG*K~Y+FSPXA!RGSQYSFOo3SPSv-fEsqr<3U?fGw#`@50Eob#L2F zl7#c1+f-O+^EwjGgjv9l9k3#i+KPMC;XVjn3J>?j%uUcGMh1Kct-wN!Y=3T7YFjp{ z@zz@il>N-dxqF^a^AzSvA}(6NLQ1}Pe;tZ%58V6)!VZ2i9zYgQ3akIaP(H=KeoRQ# z(jK&0tT^1g@o2FOTV}(ywPYiKFG=KQ1R_^gZ5XiU{yW-uPpc!^ma7}?uxyE!V8I)y z{Gb4gJk~^9=L9fSYd>J#u2@NjG2q6~ghlYw1D%ew;egYp{}OD5WAc{O$IL4jAi9si zs{yYKE!CmFo@QjOiS)Y_>{}XP1gZ*@dQ?d~F2@Yi4);LbQRH4Y z2zB&90__z|)t#KQaoGk3S#g`RSTO!)s}KQ&L&fMW{oKTl5YI#NGW;LeQK3DB(vemU zdAIm)KR)RhSI=MnuvqJrXv9;>hD^mLW~efXMH(ha|PGwsdFNRXyvV);;_rQ3N{|b!+qgEa%I8Ke@m0c)#uBRPmacxHM#J z)rS3gKgoE=y4mb@e4oA^`pyOb^Z(pVssnee&Ltx*Ks7{>#s(0pM@rn^yX#u%;^}G^ z%Sm7%8VdF!W3TL%!hyRoJq9s$tNStRO-MVnNbmRbZ+Mb=sSJB~@kV+YTMc+Kcl+7i zkF^+i;qK`7-vrt{2d;|7pRzto_ z1{OBsrxEmFIJ-uCy#qIs<+5kEcL zr>(Hip#G@a-!G#}&*$L$EZl%>6oT#-eydDP##*!rcm`%3+(uD%O)!^9?N;HM+tl6k z?XNu4S_3e5T*WP>+O&gooIeaK)ov<7TVlJ%dD(+htUjk-Jza=tE7HxX_E_Oph&s8( z98YTLYVO!oxMJ^1lRG_0rlr(_kcme1u2*(mIy-AQ(oI*wOyDnFc?)1uOE5H^S?ksx ziSUggLC3)I@9umfo@r#ZZ%OUNlUR2)KFs$`U;uQv-Pgvw^`H$X^*~j}qt7_7GLJ9r z%``d9V4iZ-`rupR@+iQTCqwEtnwttXO11>m4r z>1~v_6I=+x&IDdsz(%H^xz#>ZtCp9zoh>%!@s}F4mzJ&**-@% z(f$V*-QEZopOL=P^$f{Yh$Rcr_5#_{W18;-TuqxX=ssKdYbx?d7{{A3-TA;OvD<*wHvE3C#o~IfF|kKRiHd#NCwo zv}ix9KUDg6z!nXX%6Cz=kz1cYpDg^M$(p0_ikHCcrY6n>Kx8J&i5`nF8NB`4_W@nZ zW~__r=5!@iSPP{KwhXtT_?KGh&W~2;ZXV?@UADA5c^M?vr6m<9x+$C3!Lyn?-M&Ao zf_1Z?cty9u0@>o+V@~Um;Y>L&UyV@*dP;ix$T&&9?{v#SX&Tj~T{F|4rr9mlc%_z; zuz_IQ9QKOtb@6dv$IQ=49-Bd;83136M^WGryuHfZ(e{{Uo1Lr>%+UtySdoo!Z^0jV zE{5c#XM9QMo3+T1NRMVmjHXc-abC2>L#4;Jn?ev7+osmuLOzQ2qx*NSd&S{aZG2_| zMxU`J8M->h%%%njVb7}3&rf7!^&J*_ctWdWreKvDUerGHBeD#|xH{jH0pYHIm1`Je-BA(2U~>phXcYs=#nXWj zHZECA_b=|K@Q_+_gmF6~<5Txa9Qvs2AXYmBwaMK3p<(k%SwgY<7yvZAZRSuq3S3-n zQwdAU>L>w{oB)bk!k>~ljZA?QH;k_RO4k7A?x#ukw>xvVSZfeSJ4d|(Bn`O(b_)q9 zHyo9OQWNh6bqdC?BuDjMlha#v+-iTQySw$uALNG|v$=;b(MnNy$RH%Sd5Ut)UL><8 zN2yFZ-KZjdW$yKmSpy2)eDNe?F^n%qB^He}PCcvIb5~Svzwp@KG&%mfS`p^YIpYvM z`OXB%7TWq4bAza%NB7chp?YSR+##!KiS#b{o77mo;bxR5IG%q3UJWc5aszVX9anim zxFtv4#0OaOX{~Xh;>Zb21pSKzI_bW;oiVI6VAu=M8=oI!LIKqWi|^m0^4W;}&S(&! zu<9hb#g$#+bpZ61h!sX+-4Xjc2=bu}H}%e-gnesml$6_SH^^_~8%5f$Yp%|SO+coD zOKN>S+Or<2&5%I+Cjs~#i*E3D0QJyF+(SUG(;U`|#wLUUbh#KERGmycDS|;`U0EBq zvJN|_y@^07q48bg_1zh>M%gaXQp;_wy1YKjzCaMwYygasU5J`KT$JA81!Qo^9wXm5 znFd$$9#(ZwWX!@dD)ATYC6=)_v`q;E^?Z00WaTjrh(Gdy4i#@<}y&B>%8SN-i9i<`k1d6VtdR*N8 zJDRS9`oXO;vB{1h?5r+9x?G{1{r5RiG zW)(#sc_V`c*LwFu31yp_au476Xi5;kWHl5_YhJC}ti9y`Kf^iq(=cX;2rY7#cfd`1 znbRgQ&+ewJ)uk@i0ZvGvr~o6z7M5B^=h>f#we+*iOAA-oc{{#klT1$^%O=J)-Kp4@ zULZigd`2bzat>Z?QY>nyX%6P3S}B3S(68IJit4}1svQ|z9iou2q=+NE@P2)6L0 z+tWsvC%|hxd^rLPlZkRR3#>1u9gi_Yq3sbW<};yk7g}QTfh*e}(yQdu;D9tN&6<0w z;ns<8Ot4d2Zbm!bG&!4vvLwz}4G+<`O3z#xiR+Ct{;@Kxv}Y1hTkBXojQo!)vz1!2|G>P&sDtGcrHku0(icr&fzxo82-$?_eV-E^1DL z&?FiPxVz?`iEy|&N29I_62Co0@@(mEuK4N$cpvY9$Rc9?z}4>|*oIxNdXk1*@zksUMRR1I zz$5F*Xb;KwPdv;( z_`{zzCQ+{SSOVG*S??WR+%0IXd`-Zc%eJB{WlblXJ~-^ZJ!@op;U5v##}y=auEf z1^Fl7WIJtAnx6b=B*t?(^Y5L>>*Cw%GK_X?jAi+=Isa~%56UPz<@}6t7UABPhcL@kPD?y$Ta?Iq3 zf_CgoL7O~Zi5ZV*32rN8uc32#?*S`8&4LjExSRh6p9&vpkU_kx+T9_LTwI*NYbH5~ z5-1P6;{7Ag%y;;E zCRWaG*z~+H@WfoZYJoYs<_;tZ^Sm+B(y9DNM6gl)fQ&nfL{+_f!JWAwFvZ*}Sr!v& zK$DN8cVdXznc30B*JYfZ=Fl;E`sChyUaRcx^|djZ0qT}I>Y@m+L8MiUaElY?Y3<99 zxD$m_vv9_&?}dyhZrjzGukCS!V+(aVl&_W`Tjdq@$PVF_pl;eQopO(n#bC(Nt0jW+ zQlN2y(G0RlonVdA!h)Po$Bfgo?~Ke6SBoNTsOCyOP-kYyOc33?G{nt4)tVML#D>5k zQ^tb2JZ{z>PTmg~yOpI$2`%f@&1$p3U3iJe-zcclQSfw#!j@CN8!k+1WZjO&XW$&u z4m59^u!B@m@aBx`U4F8%?v#-cNLgPlL~jv8#Su#zE{${SzZ0&nv!ppZXDp!8tKGDS z8mh{)k1{j|UA$&KP+jiMl77_y6^A2P(3CEz)NQaiIu8cW!8iS(X|62OX|Wj!f|t%y z*_g~SQBh;YD+|}MUcN48GeJ=l!DNaGU+bs8k-fu8640@A@h4x!vWZ9^tL9|Yj^piE z{laD{uvTFY5UDV@Yc6kYT|=oWPbb-<7Hd)2D>a7gFr#vdW+#bTt$w?;sTg9yMEwl{ zzv!0S!>9yUHEEL%;o!$P4SD`3`yRQ!y@P}%FEOFoBY;7;Fjm@BM|7&Q^ zjI%9qOi8gldrS+{vQAhdbZK^}ZYjJ5RnV%5df7^JIpePO!v&&i?1^zO^$ogxEj#W? zYTkkC$CwXzTYz-8tVTa;kI{i1P4cl#(MyYw6%+#Cbqe%XT^%fL?qT@WlqxlmeiJwu zwlWQIm>Fm16&zXZ0YfoMNaOIMz#1sM56!xNq+f^Hk4A&PdC7^6PzLjwHDSkE_T$Sd zrXV3*H*RKHk{?NYqi-T-dsb}7u32s2ZLLc(?mBc%_g>4h<)$>e>_5xfe=5Zt9mA&- z#wTh3*sRv|-5tmIAwc{x#U&R-A@A)y#)w31fNN+(E8@1R2H;IN*mYS5LVk83(}bHi zInrBsIlOVr#v@<=M+wlPteq~Kk=5-+Ud9a#3@~&lF`ncHu0c=)GxI8Ktc5|fG{A(} z4%Q=iNYic`3@J$%#e}Q-wx}M3FNzBUt5@^`pyL)Bw$34}E?G%*Ru@f066{~Q`fVcW zCfx>PCh8Rgu7!eOR_8BA=l#gFMz|0!eP z&I)f|+q5D>SvZ->o?ROpG1KGKx|34VmtX>GoHdaRS5hp{FzE#=vH$r>Ec4B zuQYL4+cL|kKl{vOK1+PvA3_j2vjsE=3_inxdL@rS(H#+qbHnO}dBc86?2%aJR+^xP zWNK79yan-lS}hdG^ROYM%wrUFrl~M#DQE6QGN5MP8|Sz6EnDZ#?#z9YZ|i0)fceGI z3tup|et!4j6{2{Ym}82z)wpKn0Ialf)9oyN>IhePU#6+d^Et(Ps5}P(fE#2Xz~)2?win@!?JcNRNgv|;7R0Z?-^(xh0ffjlZ3uXY zW)OtOHH8Mmxb0+4-APBg&h``j0cpo@4KBE?5@F7SNi%BjUpT*#=NI}OPF*U<@KYW_ z#(18;Ol}W8gp;Y8?poLAN`i*velSvp!@q%l&hM5C`pP{Z2juKgu=*_L0&;E@0z4g( zOAwI)JjwPuSx{K=HT+Bm8u~_FGy~pWxU86k+{+045-I7E!6AMzU~?|xhqCzyoW>OJ zjZw}3HCmg1Ioqf~PMdd<*!B(y=t{bXxV*Y1BuEG6? zHxiP`!j2k_A2N}WvZpny0)#cqEs8hDB#5Wq8QoRe)pxm>98GFKY)QA6eZU9wj4@b# zgc}X|6h{pls^dk7wntVZr^}d-g!jqX@l^_4d4Y%!_1DG1Tv4*B+SBCO#Ivf{mf&z;8r_fxgk9ucm|1eiy1Ov_25ZsXTnHoO{`8C#T|^MXNeyr7H@+Eqk+`8 z%4rD;9%yaT$;6d*vXH~p`a{m*iKX_H zSprXoXI$UyK{ZiW zDmOg;{D7i1C)TVXk;nnMf8k<|RtMJnflRZWY^A0T19~`;4_{|C?gt*uTr><5H?u%a zwt8k$cY?8s4baQ8;6OyM0aMcASzc-*rhUgS5e(q56yKb}<9^73ni5D}%qu^175 zTE3Iu?`Hu1V~}qKvg*_I8NDyIfv{9+-JQALZp zHgRz!5~0nxQt}ctzDo|k1SxJ*53}2}kocRQ0B&c@Vbi%pHCI4~1 z09F=12bf5}1Z05a)!k6_KrE*+nj?JroR?`mZT}om!UNQ0swHfC4p!V;{Ax^jqTVx>mE+6uIdvh z`ZQZwGH>-M*|~&W>2Izo;E_tu_o4qNa#6GUE%Zp~9$0n)^h!x+)%mGByC_$XF`i8( zM~Ke+XP&BywYWPcJbj$HHD#DR@p+C@+rE?7mN3ecd(>8fVerv8UH+f~?$zUTG2p{( z6rjdg7ebC-=yKpL(qRURkPmNG8bn|gRe;-T7Jib`WA;FYs8V9OP+LuXPI<4H%U&iy zI?bS?=P8_d$r6~L9|89R5qdBPl`}ES7SX^1j@MFOer{^zn}8-z)veTHx<-L%!yiW~vDoLDKy4j_t^ zV2?M7U5QRd@?-%+Q!FJe46tENb|z5M7EsHrua{HlB<2|#i=YOuA3s77l`$Nm|0yPxSp7K zKJBxbJvH-RJwhvYAx^yC(Kh?PW&v~`YVAqCiZ>qqHo`o4#_Da22G`85+;#;N&l)~* zdLWXl8A%5i1@ppcSaHL5$P`hWO3ZWlB?4e*{9`RD(&6=Xau;ZdR?f_4&13s?aeYmC zLYlG%Z!~?Pvjt|vjy~vV?UfaIXEMfx9tncIT3K&xW3@(Nixyr|7R6@zjsc%kp$f_~ zrp6Ufb_}_IOkF2_Qvy-agC=H%W-44D5Zsn)ekpH+SL#v zz?ey&u6Q*x7>v#1eE-{h@c6-!u3S^isM?`75|zebhSoui_>rm%!J!Z7_^fZb)9%?(^Vin=08bCOkxN}`%4Dw|P%x4K)F_Gcx4{+{sauG7d`TcGN zE_(HsX5p(J&AT0+ZHUw}ba4BF-Kb@J8*Z%e~Oia+PKiIGlr-MI`t^Y}7T&)u^PPG*S zbX%UW@OdtXATKA%7Z4keui%7n_JIN?**-S!Shx`Gy>Qa0B9D4HQJRRo*e&~_`UN@R%W9J{b<#LR9* z)^9yJbAr;1?nQ}({^2JizNaY8feGCSp|AhLxJCT> zS|>jL&~36Wx(>KraxA>Tjo6v>?Q-q=)uXisb+nC<|zgB6sh^Nu;s+-LSyDH(9(6!Pdr2R7>;?KZ86RBd;iPDUp@S= zT&EvC?Qqkq7hO^lzexal>ng_Hjcg5!dDyc0iU%1^p#Xn$&W8*R*00%f)W{I z#^*)jJ)9kMFn{s{UR`-!h$pAw^(<@X7W9)N_mQiXE~!@=JE{^V?tMoG9g$*->V1x3 z4gLZX{|?2N&C$>3nH_rMKtl$U@TPX)h_=z4jz2PJyNzPNJgdm_A zPx5-y1UevHy0ry5Fd_S)&{uRbgBKQNeR$xnM)1vgu)mTrM`@sll)g5&@GEA+O$Yn8 zM;y*C&m$e@#J)-3>Rte6uJjSSZ6fXO`#T-inH-&2-!Wgi^{F9sESG;q9*asfr;ubg zg8(j%@_6dkywbWeEXt~>oT6ini(?T7% zYRxu{DFr&wPcV(1v)AA;Gr3)gulA5v59dy7>z0gs*jGM{IU=5P#}TtW2v^Q#f19u7 z;LUy^zTwVogSG#`D|G$r1N?uYKHC2%Q@;`U<_rFcl2m^+PnLf~$@n4ggs47vKvj~p z+=4vX$af3w#VG_XW#|m7KR;|@UVbQ(f)~`7Fsf5nCzGos{!%rYtH>S6i;fp@m}Gt! zVK1UFPfJBXeVjj&jK>Vu^X3lM$+qK0PEYqIko<5s1o{F_ed-y7gc?%?ag;keIfing z3N7>Dxlh9wZ^gbF`+(aJCVT@ip!I0oWXpMyLc7t*(s{=;h}d!BE_0WC;Lxf5T{?-l z>s$+rL44rNrNJbkr1Lo5xOIP}P3x#X&cjF=QcE_17;s{&7cpWBGV)y5e(c_??(AM+ zoM1r^i5G!QPE5XkL3Lq}&{MO93ydkSG0MoS<36R}W;Jrq zNq__G#uO@T?Ppv}-cT@S&c$K(jP)Fpq|c9_d)|q;pLyMGzxga9e^!HV^;}BEV<3;rDl=FGlmXm-m{Hp|Ll#cVp>09VThO{3F-9GnJ6Gk4<`#g z5`JU3X*%h7@W|X=)mLH$3_GK9+^Y}E1h*OfAsV=}Z_d%bd)X4;;B;5RE^e27tbL#+ zdu8%EUAp+r)8DUpsX22QD#D$lyZDkNa!cyicp@hBqn3OeniOpQuDzs+f6E=^Bbfj) zN0d-9n>@2Z47c$Tut-q`4|pUH4p&{C9XX#(4FXvc-MFUQ2SbtspiG={g~dU&3l}^p zDiZ#zggYeL3};G25F(x^i)9LKKt4dO$~~p@5_@aQ1BgnRtUjLs)nbE4S+5|}A^{gU zMUw^{KD1)x-H5VT##?xai0+hFI0Qo*Y0xB>FB4l@J1AiA5!_wJ#YE=JMe){dfns-u z8mFGwF}I@GWF(RcF=CrIacOgjP=KF0$x_3?#jTj*%oH9W&h~=iNU`Rp76EeoxXgO~ zS3#iIoXKVUUpQy})!6@mGj+mE9~>Y_=}Pu*krnR(Vsm1X&UgxCy1&XgoiWuuMd&aN zDhV(u9K<*Lm3p$3YsS{lX~7HFSCTN%+#uv_UZiU=jo=2@i{r`mPseNClj(n(*?~*< z*NCcf6UhyW;{-H<9jTP(Q$vdMiQ(am&CBO$i|y31b>{7U4}b=9K4-wS0h)Nf;&1teHqHbcGm=R;<)2Z(3Xezmsn`1zqmX zH`n&N=?*Bd)m|7=!y(4@O&H;Ulc zL=61R8ASn{Rt)ufRbXQ;2e9HE@fL|8^%+Oz6&kIN#qEFb~Ovmq<=!kw+BG6FBnR2v?Bkve~ynCC!s4mbS$2EhI4nNPqxnfZ&w zV?u<>rXU0V3_|d*++0JLAP%Ez*soTu?$v8ZRLwAmB)M2-4ln1qBr(r9?_nLKFc} z;6Gg6SAX~Y);DX-V%@_t&)#RBJ!fW4JcJOkW-LzaMw>T4oGtwGxXVo!xtG)?f?d}V zH5qIc@rxcQ&dI50M1(zesHbB-r2x*wB8Hshg2>8vN6GT+~$3St@`&+FEFyD0_uEgaVzQqVXP|h{pJY^`LS|^gSN$VB9ovm>VqW z=6Tp&nexug(_PnmvvoTdI<>i_)ReGttWCD7}^ns&ipI2mw z2;0pX0*2UW$g3@qI9mEJ0~d!h#!O&i*qbpEv9-U{@}VN#3*n`i+}xGqui(N$zE5B; zUY6w5?_K+Ah4%YQ@!SAcPvs%Oz)VZxf-$}~%QB_zo2?W-&ll1KJFCm^JH3|1{C@CK zH@d?*l_B1jKBC#Zj&Q1=khy33V(io^+OtXf*Ng1mS)29QLHCqM5>s^LbzkvX>DKV% z_Zc7FbQC(=zj@PC1+x`LNrhtJjX+OTHy>2&J|w|Cc<=6n`#{DXbl9t(=US+rR7f$m zIr$;2z|M!=5skDLX3CR0htaUqM|T?Fc^NUqm%|^6I)$H5J9ZGu8>mUvbp|aG#uh z*huNVlGdRw=cdc$`-cWE=KIcyG(jYaOrUgqGSV z)V)_x5d6Iv4F{c{;P#F2EeAhssXd!Y`+AL8%PoGDpst>}m8=Kd8S^AB$!ZCXKiCo+ zPuYr4&{9vIO*x^VHvkx3Pde90Sm5z=JznExWFf+Mqw$HKa13(=c3|zk36w`?9DYao zIWZnx1Q0PMdYdSl(=n2}5joY0VZsppr53JRI3Y_|DwIJA3-768M!gPj>@1yc^s^4N zD_C6(!DZecV-WvpR+5l6CB{bL?^O;QQ6cA9SW|8vA#g)ZMq zwNtc%k5HyM>b#%m$SoX=-PN9{U{NU+&~t|mxK#*+-zL)~mTkJzy5n6#k@sj3+m@u2 z98Ywh7>`ttl^}gWqzB%#V@B1~wzm5rUUeV$_X?5L%{W%MU?TfW^JKHJbmiro;o)~_ zo<%-uyJx?DoMH$2m2)KY5fDh#e!Hhwkdr~fF8G2OTdBVui$a(iCdw*MY-_2U$ZYDF zp|v}q2~V~YicPT?_`-s|6Ty<0*KRbmZ(A^WQB~gIWc45N;61;N zK$N)oHV0Pr<~p}Nyf4OfRk{K;Nv`cXSu~(CSmEB*8_ssh^m4!(Dim*dlKjQFeT_wj z=hw&L_RbxNqUrjU^|Z(4ggZiWInifMt%D0jTJUd=;ZZi!Y1}*e#_iUg#k!oodOc{$ zT8bgM*J)~(vRUK$9(r4>M=|-8&-^;w=#`fHRAl6Bo)2?1{pKqqyJ1?Ado8^FX`RW4 zV3e?wtDQlA{!=#IGLzAoC!!JII;(LGom`E)OFvhQMAd{LNBEiz(hy;e6&V>un$%A_ z8ierKhJO9w1m<&ohmvK6tJLfWV`=FH%lYP2dIE1==P4+bU&q;E9KUb)9N%~Tw+5Rp zwsecrzMBmlv~Ty)-T4?zW})0t$ba@WNp^F_`RHXcl2Qm4b;Efn_dW8$L9ry@PyxQSv_pEZLG?}nt~E_ti~t_^Q|#HZ?BjTSB$AS(UoTT4@|49 zqCr-}JS0+Y=_HM#JIJX%N@#;o5v4OpQ;=fY7i*6cG= zXZh9bb=a(}AAOnG(NlTb;D6M*4>Yymc$4NLYk%r0LdIJ_}EO$EJL(=R3o1$=jk&MER+IpK^ zg0ky?u2_bkDDI2dmbx$Wg<_qRS+63=mFJ8pY@_uYH@X8j4zS$2?#q;C={;YSTGAG3 zIH6)|8TH4tSg164{B~zJqw4W49KUzSdpV5qXDm5Ms z-?o4Yz*^pC2OOUL*n7Z_R_Jc^%Jf}UKFm^u+LI0nC8f0IT{J_}Y#!c^PUZD1$C)O8 z3K>a$z^aB1yX(Kgl1mbd(t4U1OWY{&jjjoLva|QY-z&m~*TF2wpkL3Y%&gR6Qs1=B zNIz~q)77!bu&mM)s>r_;;mR*quI-PoQk7Vn7qfuf&ro=i-bRCf+DzY{&`5u%%4ax8 z`Xi1}qFuhFlXTpz|>1#w<`W;xVk_`6&?uA%)3$d0|h-%0c2+@KD zw_n|DaJXbGK!(N2(d~BM!f&C-L_~$!w7+$aWcFi$_OG?! zHSS}+PQiOJZ4>3I{&JC_(>C=e)@#bwF*QE!`k?RbOEyd@0d|w1x5PK3x@!&ZO^6^Y zgY-V6=bR~y+ZU!$4stKCxDG3`zxqNp4(SQ|4S$!y;Ao$*B8|zd!D5@XRJxuh7B4a4 zc7(ZzzQIM#@2M37 z(DTpgwlsRgtfsAg%`z2g6P~Jk-nm9yZV1XO0YR!UJcOX;mav1@;HYNo^%cAI01Nj( zi~h)osswL`P07G)Ufr$NZ2K0L@|l+XTw5e`!M@iWm>CfG&C1OJKXTON0<})XpZ#V; zz54+)>9jzw^ZbooH(TC+1-XBfkHRq&8|+NmfbvRd_`-uR9rCl=T;%wk-5(7^$i(Rc z#I^#3skKw=ALtWCpUgB$FR#CV;`$R-@DA*4a2xMmd$vS3C`_h z&Mm+nouRv-y;h-_6BC*q&cD9`_2!-66TwL{&OXSWdTh|)t|%bgGs0HxExXBJ8T+g9 zg!4o$0Io4_&GefrPsT+%6XvxR{`g~!PF|URV$^inIn#?WsZJcF6e9C^`MAtPQl*85 zSe@%$q5CESd6fyD4U5O-9`~9AZnim>Y;5R%#(Y+7xtATIxpb`fG}E$BM)JP+ZCq3S zc06@l(J@|!WgMQ6OvSotO-}X`f=|VsPu_90HD|%0&T9$ypKX|`20F8*-j8|WeKr`7 zmaHFP4b~~+kC1Zw;zFB~LsoiDrd1u#6He2-C);rxmzJ9B%1MN88fpk96FW55!VmD< zE^y3Ko;EL%-Q8UXetNRL%f!-d^61;+ivFQ_&SdAX0O}Y=w<3Nwdy-Jor7oVUrzQdi zIKH@WpJ@-1Zz>6&POq%c@?bfi!RmoG12x&&=q8ou?7|9ySll(YHy3>+YMS*$ts~qbIUmjO0|Zda63LonAAv=K_<~f5#cZ>o_o^zO0%2s<0yM z^EdLG1JN9j>|D}f*|?P^w-kFQmt2WWf4yV@UBoY5#=4u#zo<|XN2L+xNEY~2tq#{4 z*C9T;ZH`lTMFX=>+SWdouO5@6+Lz1lx*n&A@~Bl_9}OoifVEE%h_-Om!AmF2{r7ro z{IZh7t~wsMW=5~TN={vX_fepOPhFd2*ID2%LZ%31lA$P(F;a@r&?vQ91^x&(&F<>p zISXNK#qQK#Y4lghzV6zOqkf??;Hbd`CNdsOC^Een$r_8ZV09QM^J9B9RF+uSS;Op9 z#$~8adAA^!+P#*+Sah=ewZP;T=d-GCHcP&mm?J(x-)ASKy(7Jt-_2=xp6nY~4g!5S zV|5;n)Wr-s`SD~w-ic`JbJ7=NH!QG*H5xrhfQ-c!aj6LLQ{my6#z~w|OAtoFmk(e> zeDUg9eyk9!)?`6@#H|PErIom9LiMxlK@?nCz5X*9X28Om#P;%47U;N6gGIZ=*!s2~ zRP5(savYtu1(YF3a=wdwTJ*r_ z^>cX#wxq|J&F|{rWjbadp>1*)XPCEME$!Gku|h6RT395qaM+R<2FB>6R#C8X*1?J|V%9OE}EM zuB5%0pjK7RW$JnET%y*E9#?uTuj7Vmd!~YP@^G42hEHRWt})N-o<1adi^6iKUE;@? z@m4Q~f-=?Vs`-X&cc7fyNR%g{f1P&di`cBz_$Ms`ya+i21ti>O=}awvYWAMXnp9(y z)FFmtvI6#?l$z?HM0`vzynpmA3lu@oI;3(MjO81}9-6awg06kcvt@A{a`N*m=j)z= z31MOp^MLnga~-yO+T2c08yy~?wzXg^wnNvvydJzQX*PpjUuTao&GR-ZH)u3O8rMQq zyrrjwwy%YAgA=_Ow<*5hfbz~QeaGL0*8T4Y?JCzJXB2Up-O#S*8pkiD_G4DOl%!Ie zesjMoTre2_CI{!$p@Zcu)I6z(_1*l%h z%XDGTt}3L}8g!Z%3zS?%0n!s9f!6%kz+w|46093Ue{U769TW_v019}37zq|>=DKWH zn`UZ^`jB4~$kI!NG*TqR@%&2kS5P}GiwXRON1-sK2S%H(BSG`sx1#$%J4v|zbt;ng z(oPHer5($b3p>ez|F}v4q&7j26n}Nr(9pnT&3}&i5Jnj!cvF%J_}v1zq=B?v&_t_% z9?$_dTgfj=Es&)vxBjVwAd+}4Jd#5aoR0D*Ktp5xLwk`8+qXd=J@BjbvZjBuH$V_- z+T1k)_}T=SE|y;Z(c1vuW2jNs4vm0EZR~e0Ko{lzCM?k(&_$*n8>3{po%21EY`?hp zufPQwn&6*{FZ|^&0j{*)K)NAhWglMz{&NF7IZ;5hW|~8+g(VL4uKL2B1Gj zV9Lm#fV0h!;F)#~B=BMrc_Ii51E)JKO*oZK_C}6`+)^$chDhsA^;CMF4`d0 z2B@(X20A+~Z6P=Cg3*oyZ&XwY7CWRZf=*7PE#&?m(AFI2l=#1fz`yk&H=U5S;_nj! zR{yY~Y^6W}!(5T9)h-Ocug*&sSo{ago`E$;0~?$j1zhM3`bq~Vbx|W-xY%q_47Ov@ zRWvjS6rjHk$SU=R@tR144mVh-X5#-c`uG7$T_Q-f7zI)1i?>^RkWC7OZ8aEx1j_)y zh)e%aHg2E*TSAeQ>F&PFHPmJPf06Ye4&mUU|4XwdGp>IzU>wg=F4!(7V4+ACQKqv{ zu;0@`>_z)tM&|G20UDY#3h+Y~n1fJ2zE=Rr2>d&`2gaKh1sIftl@yz*g|) z|C-vAmY{`z1OZWk0}??C0MOOZ1(-6XnFv6CfP(!9`^5?q5=jaQj0j5UDL4*tF-t~ zY#D(k+Er93@-I7rt0qk8?3B|)d34uvJ zJMfVX!8<{@afU0HWlQSO%Z9u_EeG9}2}ZTce>{RGriS&1SS?mF#kf3TnS%IWpE6_r zBB2l)VK#b)`uy=`Fv9ROJ$yQ00*<9RbW4&kp$T2venYxaD*|e!E7?HB$04`jRRwxZf2ej11pWk zBiz;58U+_!f6DQ>VH!=gF6}Xoi4B`+or?s*DlQctKK`=F%uIAAV~!QsfG#xT8Nykx z!I5f{*OsuSbknfs6wheQG><^|3#LI#-Qe{zb)$0K7Qs98R@}Dqt97OWD08f=7@m

*tMuDy|-X1d?;wE>>CMOF1TlDIcZ z$>C~f*v_11n#Q2s5IA0kuIe<-DdMM!qsS^wK%_F|(<3{yxp?sI79d0e?Yr1Dlpu5m zzSatf!x%s(r|rU?bq5?O`#&#RvuO;k*hwIw__{UmTiy#% z$1ePwm338@z;qnl#Fq(7VxP4=+%nsgZ@eW4=r+b~VKRI6MFQA@9D2q z-+}?|-9TQ?DeJvd zYI4BtESqLQx4@mKpz3y}1$OZtxO=J_>Ervd1CHZbpQ3%HklJvB`5>jyS1PG(t#rb` z;|P*6)Q2;#H7Zns9M2|nBxe`mDrZ3~k40OqvqgK>h>iFWDNP;d%BWs4N0y8RTP>_? zQh#d9!OzB2C!R+(*zMRE)n4E3IbKVCr-Ow?7@={B?Fr_>B1>jugKwox81LCY-}hu* z05ozt%T>o6t)IBXpEl^I%WK<%2B&K8I9I2~+{spDL(Y6)a#od4pQh^xocp&Ymbd0ifu@YV!T7E$;9VXt$oRWc~I|@CA*`X)NgRV%8P=SJ<*~(IJZD zQMD!$jD6DJWCM;1<6<3s@2=>2N<#18fG$d<4RzI4H~cBo-Uvr{^TX<5)X++*kQe0NggAzL{Zvre@>)vYi9Ms!lE6dd~J%$yzv?7xMO6 zpr9<&9W(3Nh;m<+X(u7pEi@Syvj?i7i^i@nS?}l%zwqFg-Ke~INpP9Z!7fAZ7rdMA zy=?~kK|}5sKmuy06-l8+Lr`ZDfT(ODHK%>HoG*RVL4J=UH~6>V%vl#T8D8ny(6+;6 z;^jVLAa7$SDgbSr&_XL%DAJJ$M=N^wj+#&mr6I^Kb8%Pdt9WW{OvdYb0a7Z<^>3%Rv7-v8*67LHxG_gQ)}c-;yN(Ez*BWDfDpvGh56O3XAfe1cWSS zczN|N&Cy|lfY1UH!7+hK{I~!;{AHZKef7*!%;aVyFj?tlXh0_j4K!2uVd@_y(0IbL zCU%Er8U246gPWRod~6i2j5i^i#Nrrn8Zn>gRZ=oXWJ+Mx;Dp$PY#?09j&csUS&-KpC159l_m z1qhGG`Y8>_VAwk4MG;?X-u{YmM}0BylO72FlCE0&g@e)b8sX=wgy`z>T26%Yc2^H8 z^mBqIkWl%K#ZPa9>Q)ATkvCXGOE^@9;U_t8NZY#KL@O9R_i+c|eG(nuCo_vz2I9`A*+Yap2|aHIV;P3`1xz{`eLR zLuh2~^R=THiUvTE*GFI0+NW|`9A%t+d$@Z4h9?w2m)D0@esu}hSQ5m?;q@93_O&d& z*t<1a?H}mz|L6h-O|*R?^WmddV zo_=`LL5?bi-BSUm5DVidCW^vSfnlp0lX9b@Jk5~E6Tp#!wTnt$5%(Hg96OYJEiX}2 z#M5|%wdDOX`+U&=p7N}4M^oSZE!-f3f8EI;(rpuO|AQmATd@rsvkRStt(yvytG&x> zgSEqYET&iwMTvf?na{MCA#0_kcp&Ym!$tD2!6}@Fql5}DTGIH1h!8kgWN`o;cob+K z3I!QYWp7$3G(`)QZ~BeRg6_Hzw-8N8Pat^6b1H3+LjS8IQtwN}gPzbpE6t}VUs=x$FUWG$1Z;esS(>0+8MTc zi1fQ-o{?SXZ{=3e42=q>;$j!>cZ3klYg1U?ULC0J-}vGATdq(2A)#AEh`)=sj-OIP zfIIZBdgP0bCu@YiMgGqCZB|}{xpgokm^6jrXoAYL^^0V!UFJP8V-OnNb{?5hXwIrc zmKvP^J}HiFc&-JTLi%0#2dZ~>-$sE9_EN1wdYQ8E0VbtWk?t&YN^4irFBYqdxWYoc z^4}z@b?^Z%W>caCN%a^}^X$qrn6@S`0@Rh%nOadz-#iWHz=YMQh|dE7pYujc{Q(m$t22k5g=l!B)kZzB378sFMjHCu~^& z(qh!ZBb7sSLyiSR@WNz791+CQEGE(^t-qOpZ%x z{?Q|yRmYoS%yXTtNTv5f3(MJrvpxM#bKcctT}6dF>3B)bCQl+X2D42wXH_BsOjNbU z1yNW`&R%(b{kALEtr7Z22|8fwlY-;x*8P0;-XX_-+mOk_PQ#k?^rH)9yC+63JP&-JQCZPaQ^vq|Ud8fs#wV#d+Lux-5w=c$&B4#N)&1BaGR4 z)B_*aKK)@MxxIelg8;#j6sfTdFe&X2WSE;ZcjUM<(8na3VJ$uE>~7MManN&d=)LdE zWzg2TNMIOF$!6V*v9xe0I}i9-oi~?BE?_cpdAKi%8&t!?7Fw0_`ReSb2YQN8z<7yT z_w43dEh8Rf=2*7=QL|}5X8(W{Je^%K!nqz0O?|A;%DL(z22Az-Jp)Vx_$4^3;sh_q zh;`;qw+ohxS=X6AjkxFU)1opfm$~^^hKGA1dS&0a%(2Ed{j}gVHdgGs#-;95;quDi zo8j0z-Py9a5O|?ziwZ^c$u=x38=J-I-2jWvjTlwXKEj*BZ+?rTzEqJ|PMLb zwJ1{b@QDiGytGr?baO}s*xj>hoe061`*EO3y%zFuXyw0UU#4}4j4NVnx~0`48aMx- zmQdQ^d&L}Pdqela+{G%$ehB7qeXA?9bvgOUzTkQIk&Apk6?Vw2Ip_x)xyudaoF``D zMDL2JdB`j^L(vaT`9?1VznT;kKEiPeByoD7$CSvlP;Sf%uJc3$l$f$n+de_~TT>T_ z7@mvW#;1T!LXG+TaA%HJxS=kj!dC zf9-hfsJ@D;RxDeQ=$cp}$b)vQhWV{EVw~!ABwZNh&T;gqUfP{zCO1SuSCTmd9c5~~ z1WC#n9`@~WZ&f>pQ$RE_H}(|yssoYtga7TWh~coA8U^zXpe?04V?3l~YIF$CIa3%{ zI!VuQOwUl>mwo_pRbEQMSumt*-T@bimB5kRW-W!G9&l@c?Jy-S1EH^W^PNi{ks`p; zpt7$87ShfFw~$+)yAPc$3HBEkOd)W_ntd+61lhq5aVv@*Uucxg$#c<2<=TH4y3APw z7pt^^BDO{V@RHBU8g6f@z}EhX?rn#pmoyr;sZ56jR?{0k&#AG<%^jV?*8Zp_nXb>) zepx(J71i27O*Vmh55iUs8?4uZ$}ye0?4}16h67ooeX%^R%rqG7-5W)6kJ_Dl5%9*6 zo%kfvS)V+IGKt&HAN!m;I;M0!-n5BP7#z5PV_irN&{qf)u-0n;Jn)Yg$TW1M>2A+Z z>6*v6LHU>YWcLtK+8?1WtTswE^GRMi<@TF5?+NzaxCZF?x6bDpF;H7VRG0~94cr<` z>C^}QSQeKVD&81iwlj^oF|~SOZZC<8J(?F+a6Hl0cHX#i=?=QE?Rb|Bt0gvvV7R3n zlNxgd$VuMldjEVcFJn>49sS-^I)tR7>al*5$%1;fbUxNPQnvaz&npMkggtGT#Pni1 z?u>e$?J6+RP@mM%9H_k{Z``W-Ybt{eu3-Dn3|C7QuY*difT(U3v%dxrq22~@=y6cm zC>gcnE~XzloW0fuM2r<6{?o2@{}op%VO0>}|FEB?G)WD}|E{3#RAl>Mu?Z3*7> zC;#cA0ueNc0r6c9L(K3Jo?o&kV(~huPz>9!=-N7N43GJ!5UFMnjSF*i*_3+Fg!eme z8w`x!-4t-@r%8cpV16UuYw|iAW%A6kl)SDZqgWf!?MW(jHwJL${n6UewZGZJ`bQhM z#6m3>S?+klK_+!%Y9VwvVIH>$WQOPLG`dqugSC;zwPr3)@MuSqIPgjXzma69<@ySaiWz@8A;t5dKZ5A=)y{V#6Ab1%B-w&JaK1OXlqr zaL*I{|9X=DtP%*R^{*@WCq!J|8=ZoJfFwWxg|xT<>h_9gBFF)$28P^I(OLzCqCXO! zH&lcrid$evaAjywt))M`dU8(_pJi(`lZEyj2bd@phKcs#S!b_vS{{E=6Lqrjak0&@ zH8pJ-_VxV*ua9el$Ei|AH;XY+AEjPtZ=G#H=;hy^TB6RCXuuh94U?W|mM@z|mbHw- zF5cDv=v$_jr>FMrTCccuRj%NgWmGn^w>TGXQ11FlPQ015;@qdC+M~nk)^I%rtuVv! zwX~X6Wj1ZvaH?0$0h*3l#b!E&P7~;lzZY$oUVEcKb_&}hRm?| zTfw@np%9NyozIBf!sj&mR}(;CPS6_dZo zA}RGOhe^Ra>q!CnrFwIc(kpkW93zcYu6I%0i?McA@Q ztGr`NYz@(WK{(x7C)H{ep1S9C6DBYw`bF?8N-{G=l<=ECk$Y!Xo24)o>JQHXprUdx z@V72q;)CVavCcmF8qJZsksX!y7`(jO6`$(lD4& zc$=n)kGumdQd*SF*l%~aA>eFnt`i1|Nd}5~f5(o5#yupGUTesryEM;EZM2U>fx+l>i%bbpSAvJ7(}G$n)ZN6r+)p=^1;=O*I)D+p2ba zg*#q{u>qJ&4- z8npi!8;3JHfLO89-=?4+mNAv>W2{z(QB%sO7v?5pS$qzL8Ln5N%!81G9&!|NW){*+ zRUCSjG2Y-G;__w)eUpSs>YCu4&aV&OfT`9R+~mf2opp#Wb4wm+?v^tq4x$f}FU!~$ zKK{a~7^wG0kpRDBM%n2H7C->eUZ&q$@{R_K+*Jr=XGp2H9_n}uWy=yN?HOUS-Ru`I zNmeD|h%Ozz-!mBe5LKQ>GG4UL?FidZ?C=VIsU0&vm0v(uIj#@m~}Vh5!K(00ugc19uGw0V4lmIr_Inr@8UAXoV6+ zO}-j6x;89y5-O>+iKyK$xL9GEbw)D96yy3f>R;IGZtr?5rUWY!{*R&<$5vYm9o55v zhn?=18QoDWGrZkKErA0I zIjrjkyv_(8AOW6CeKUnAYmDQ(50fLDG^0`zYqs~+z9l|b$IA)|etjD_|Gd>R-?l9| z!Y7E*3oVd0u;r|Ou8EHVp5%n5KIf=~V2IDXSjpEav1YnYSZ+}lLL@D;+oh5rQYXb{ z!>e0P7^!N^Gia}6Z`Q%b+9qb%U9Kb3a0BYLI7KcBa5{S<*^{|y{Buwoh zt3&~`xwS}TtKz8mr2J6s=*=^vt&$u63zuMQHRsSyYDcTg`B$<9XCv-OcVfnYq_sS` z;gsX6)6bzwcgCYdS1nvVT{^=nh=bq)e(v3+IzsrmJ=-^f zbeCK#nMYe($-U`3Yq!|QTUM~F9M>q4Bt($_&AhQUO91HhNaI}5I3&}s`22n;7SyMlu8QSzRKhSv6Pk0M5-F^kq zMl^IHQ52ke!UPGQ1c&;FvGiA%|82KTnZ`*!Q2rBevEMKfhM_<}!qNVp1+Vwv1Gcqn zz3|O30{YB=>px2=wmI#WXyFssCr)xpM;37v#0nDGYf8yOXt}oul4!Cr+$}h*?__(T zql|t8r*xrrv@Y7=l5&O0!ofzI0rJL9@9uV zlwsm!y!3<{l4^}Jz-sN&$xw5Nr+e|??R^zg+k8rZgWss4qs(4 z_d^G!9<-j!H&qw}*Di3T#U!Hx(RZY@l?S`6h2mybmO+Zc_LzJITg zYzyWS$RblNT8=ai=Ud=)BPEbLr}lSVDA*1@)?{MMT#X=5Ps{eE02rD!31wo>OX=#X z1cmevrW8`@Q&X@eu&C;z{Oi^o`T~Y2mO<^GrdAqk#64fEX0wk=o)Eaa(@18`L@n!* zy=mx_OnyUG&rD1iXtr^z9!yu(Zz*r@U?mqMJ&I_KPbSsaz)VUa$cK*7~SZwhZBSk4>-+PtzQz;2}1yKPFvae zuFHp_H1w%eD0D52Cxq9z8S}(*oxXVjU zb$|ME!kNYjw9Fz(d)uvu3+E?|DGk%;a)(4G*#YZMje*#9kpVbt6(>kB)Kc(P4EHyK zA!q8U&*=g>sIQ_*;#~Wmz~2EEhuD=yxRw;t)Ltk}umRzx6y3#p=G}#R>WGr7J8FX* zuvQG3EmXqc0`6{%6v2wn|ddkKd6oHkb z{mT>5J}Z;g7j*7+aLXg19XWTSP|WD_IMt<{bxDRU%ZbiLFySAHjNNKGRbr+jJPZ%X zJ9_z5IcDwJCcEhiLg{bTzq%Mup^=cX;SRTfS zE^s94qnHajx)glYb`#CHhrhpOcXWA>MCe-uEn+QA4SiYS%~TwbX}`#?iu1aUBW|Td zltRj2Z{&hQUrN>oKNhz{9(Fmv(~LaLDUj$0En(&u-R^ldw!>8hK@=87X_Cc9*ky~F z0MH1EMRu^q3#ByD3nw%oMau;=)e#zK8iH3c-MK4rBnuI5#AeQ*>IWot=tzgGchEK? zMONtX1@TtA%A@xUSRWurCS7v;5e!UE#H|8HB6j{b+HFL6a~ss&k6#Pyw1oYo+SEgd zDFtcuHtp;_kc<7=daSXNnz&0^IXrPk03tNK9qwQb3T#plTSarnhC~74pQ5OWNl%K# zOqf4=t9C^YKhZzwFSsf8l}Rg^&B-wkgZ$3|gxx6lOln80GYnYs{K_ zG4pv2RlHSd-aU=LiMvBqO8fpnH&n|1d7F$)eSVu9RJc#)O-WaleP_ZME|h)T2VgNR zZcoFP`H5+MIWF`2SnJHUrZaz4CG-Le}N-b(WgI6EZ))~z?u>?4I{1} zejCj<%fgALs)lqAR-|b)y(9taWBLRPBEhGF3<~#D9ZDW=#FsYz<+LE|LFTLxoIdFqof@y%LxrJ=@N+s z+VGL}lSqw5FfN-2yfk{WpK0GBLRLw@MkK;MiNYDVC{|%+x!_Nub;J_fpo3punR~oq z+KenjczJIq)JPDlDl!tSd?2A(dXR1ptf>`vk%161KSKB&4b#MA1HzaShM8YjZyv(k zuF)9vg`5+dzcS9K&wBvWr{X5dColQm|G%@*|D^pxoF~!6e}(Jjzne5%|5La^0%iM= z0V)4b#F7$v!1c<4GB38H>Mex$H0RDFhzK<)_Xs_s5v$n27;C2XVoUK=gwPPtAXeY6 z#Npd@L$lx5bM{$0YsIexJ*T-3*{55+1{;ojeSQ#1{jDMB78H;7nn)+&({jl5#KtIc zq=eC0sR>6P+a=e zg+=(}t4fP&>$riJ0+rhxJVr5}mvJ_`Dy!9acBu!ua1loB)N6Ew8FzP4`c(U}(%<-3 z{l8Nxt*Jw5Y*&6DJxIFhZD({(7O+OB1Ec~Cj%!Jv`IoK4d&RR`nXs@a3kfoB0T7+G z+j|CJ$6{Ans`4|HG#GO%)tR_!&`C2b*q$#)PnBh@wy!iML?=wDp_~ph5&16tWzo|* zBFE}k-7pCST_(TjXKZg{QvbUD4zo<3+-0qnva}8^FNxZAs(f!9*d$%T42V;mk}fhF zWwVP~GtufWmIK#zu&#$ai8MgKh$!J7r+cm zUW$>QS2gMBA zUwJK+v4lN4V8>2=*6RTFxc+m-pQg^%&4V4bt4DI_WjDG^2#Q4h1Q5esfT;zCUmmbE z?3&W@IV8`KA=r@T+aoELd|}e5U?5@6cz&Q2;sp;z65Q|*S5wG8=v_}P!+E2x{#<1Tk z&P@)Lx_H0n!QzhWVCZxvJw-1a;hmAXx({>BKH4azOHt#XVDW)Vf7n zIM-3$Q+hOz%n%sT=|q9J?)bdH=DyiI%o?=hG4vEtu?&B4x<#2q>PIrX5~AcFjF|8L zLmi;@hlck5nZLuo%2((gbaZsFWU_QIHnTGa#yL2^3hj-q4#whfb+$G^I+la}7qBDs znb1l4*XCs)00E)IK%@cqrZeYk2(>wP|2%FA^|pcf zZ|ULJ{Ez_WI~g&d@pwBHxZU@Ykl((n=5=}5)PZm#pNSSx1q=cbp2shYJHOGJ#l$q zD3pELs^Cg+OeS=2sMrep$(lIGfd&XK&*BE9$>@+ZH^JkB%w_5R++{H|$>SQXZ>l5< z>v^(av6G5FS-XlMSOsY;{F2wnO9+=v=f~YBV zdxqot(o31YMG*CpOlm$Y$?w^&#w_7Vs{xWuapdtN zBZti1tY$USY-Ac&SEN`PlLwUE$s!yM`Eq<{veUtJoX8@wB8?t z@;E7z#&)%1rAm`263+cfrWPM&8o!r@Y1N6`!mlTmN8T6XjW=c*77}G?j&~-z3OprMo{kUFB?kCYuUWjWI!9l%l%gAvfEZoQHXQY4geV(PgNWD#X? z31o~EeNE>D{S|$4PYDgoc@My87aP!fD``N;rO&tT#_!ZWVE3)m|89I~4t2pKfKsvkP%w9+o@Xo5@;x%=Vo&P3_U}SP5a}< z+ua|_n?pla^{N(|cJ9{7tT*c};t-_i6luaYONO%cD$TeshGzfyhI$+|Il5$u-< z7{xn!azpW!OqfIO;evdle-qR_RN%cr9%aBE#%m)*H(5c%O>kzcqXf*orGH^sN>pEp@T6zs*BldZT(o5&^cUv*saSp-ud!1>u_#BgWWYe zNv$!aZT)0ce$0SbEKUNuz#_A`j75!V+tMj1@E0y1o7l2EGJL1QzSY=Q=1rafHAb*4 z621o(l|nH7Tt{`aZi1#3-DLyD^(LyM>r3-M_AV0*F-!W5gcUbcb_bq9&1%TG2@CpE zY^%uYmd?ddw#dVH)d%mLFR60rC8 zEcNg72a;Bv0L;5(?Vd&2$nN_=8A?E&oiT5Vk8cB(Evy91w>}T(KtZ+ZC0daF8uK~c zvxiQ`;~yg(jU2HSl+1|Gl1R4X!E-N`9M)Q{6O3ihcJOL1tb3yUorvE6S+hoE{+mKU zsSNgTE0$-<#m1ger(5yU0s|LTmGxj;gT$O!E;R2|O{;V{t?iiA&$P^G2RlCt z)<~y!6Ak>Kqgm0l*V}u5oR}P^HaL5f*4o?IibYBN{?TVfO38lO4pq8quKhD{#QxSe z`^yu_P)?=jK3*h$cTSSDhxUX#3QtoZ=3b3%C@Gt2ZqZ6e!gjubO`00n=&6l!|W#m8fIm96j)Xq6nJ0dEzvU4*aXNLI!B?Z|+kd8)=&zZg% zCzw9-9R8;m*lzHR7!DTg1Z=fkX>kDlj_ZdjS@A?;x+>S_I>liVjk2hAUD>W*DMVu- z;5=9poSv7UXafQ*R+eJQ)L;emHFmnFXJ;WbyHjBU3V zl15Nt-^Vd>7$mjt z$7{u>r?NfOsY`cpt1avKsV(z)q54oLg5)vF9}%XIxz-y1K4bEqepmz?*PQL)p15v& z{*e_n-N5_^Hd?L2@_{a|Hfj{06qD*S^3E1O@>0Ce3z-tnBZU)BIrh_3N`RMgbo+yfTt z-CVe>Oxn#6#M4%>IZ3&EwA|(D=(Xs9vW&2x+3gkJb0j9m8b1D}wX?Cq%O-Lf&d~^R zcfj)`V=-GkGuTDc$`31vMCIRqTNJ|aYvaC^^NSxaJmKT$UCq~g6AZp#TFVt+hZm&R zKFM;Ni$A5v0-JyYguY;Zf(SvAJg6u4MkQ>jt2Ykpg%|%R?F_CPMS}ZUod+H@n}Mtn zvV{S5TKljpU0ZJ?tB%tRT8w&o@@Z`}Gg#35R*lrLW$0pcV&VUq73ctgnrDKL*PR#EiMSexRabD%<0nCa z?-zET-ed3SJkjdWe8tYmJ7b^unv6-=rf@?&+#MP1lV{Xeq>XCn&%jXF_5PvZeR2%g z3Z;v(40PjD=vv;$Qt6Axzq=n<9!vg%+jia3y^4RCaN)?B(h;Yw(e)ULHU968S^%2` z7P8qOL{O}R!N-Sx;r{Q7Et&y@^)CVsUU#}GuFmI1H1aN2`S$*ikiOIRKks5=!_Caj zjqd}d$}lhILAwaeR^3w@bXc}T@*C6umYp+)%-VWsb&4h4ws}9bb@QA^ugRFvtES@( z9OmU36y}4;5A3gax9JM;=X>3&%J*SHx==wAdH?Nm5tGz@4PuKCUll&}%)uY#kzTf> zxiCf@h12N`B99Nx(siy$y4M{P9*A1yloQcxSQEd2@{cd}(NSAbdR7U$@Z>iD%oxMB zb9e^f)aioq6;R|A{AhpZ&wM>M?BpJA#n~$7Q>>WCH|R6&NA{^}c}X^*w5JJ2kSRSs zmBKX8t{Rc!+(^@ChElIFCYZ=}@Z~v_C`#x%-5eqsP%rnzv9}E4%cz_z(8GS8Yef{Q zcJ*hi#;K z_H8lVZo}3$l<(VwBm<2X!)RX1O`Py@c_j-|*ink1ZY{Wv9=+c|6HVL!%rk#P>rpq* zY{F^4J$ycxQv_rTx^b`EhuHUJ4p@3I@+ozKEy>zzN)9Wu@ACfKN7F5zUk-ge zMQgbxKT}sK*>9_|J4a9oB$?wW{jr}k#+Yn`T_A9yTDckQ((>o}cA}xIV}2t1#WdAF z$|ZYzRm9%W^9*wzrv$MCU?$*_SJjcMXzbw}9Aa;2aR@0bpnD1RCu7e!C+;J6G%j^q zh@k}duL+5d5gmmOeMg~%S)GW`5|wCQHM)CT825rLsf)QCh-ChltS1_F4YP7kCC0}t z^d@e{2Ye0p0dHo|*` zYIJKND%ucJgZaa&L{!+Q97U}3v^$K6%mFcc>0}gw>4UspF-Vt?THaigSK`fO9i<|t zdR;|S0?DkS*5DP93VoME!mB;np)la&6!DWs8e`vRRIgl=Yy5Fh17KRtO3rB89iBQs z>ldjHm-*XTUl$Tjb1b_YZt5&3^J*90==>bWmngj;`m`M@OBih9^w?2|?R3AfS~ zzn`eOKWB;B^A=Q)YMCj4ODNtvr!Ri*a6`#(W4S7ovr6!oSAXqH}rmVTXe`3X33T8;Rhb*Nx;+=$i1lnWL@yqyK_{!qo19K5Na$4Onel!=*aQt z?*rn7>*n+ffHYp;d?Y>r{XMO?q_5K7cUQ^Cnv*J8c7C8`YUGV3sRuD9lIZxqo@KR|^6)_IP#!<{T4S0t zLz|L)_CTO)hPCVc;>K6{g+J&c!ApDJ2a^l=?fv6;nLWy1FjM{kCGW#%A5+OMICo%+ zHnYOy1fY)3y5>zHP*u+sG5wcP?ZJ%fc$&W~`_=wE?hxh1;ub9PeyXThvLC>(*Mw8w zSxZ3O9+3Xiwr1|&0^0r;o#eS&`*jSZVb8rJ8Z-S>eA*GiRl={K6M5q%6gza(!h^X< zW*$6w&Vojca5-vxS=V)1N9%|c2ytA0&!udqc>sc`WI4n%;?iZqF0VG4b*<}ZEsT$}b zBcQT>3MIO`{Rm7_H2BttTho#NAThIhsuMW%U__a7IJq{MgOdOw-&XdYSXN{H@!d_sNC z#`uMW_I1zHzZt)>`xN{3(#~4wy9x4_`T;OT5}IH!6y{_olgJ*F|2%t;X4|Mfk1Yp(d*46k#2|8k7W)!(76}~gV zsnG{Ab~_kI!}Zg;y#wj%NE%nL+v$@VC8~oS=Mvs*e~n!HisS+z?1Py9L==8-JX_f* zc7MES4h*O(Y{18sJ%Fn zno5Nqj3WTYCM1R!|6@_Bg$UNPIB z_j>dPTCjRIEB7|Sd(hNs->E|{XZxQD==F$Xhn^URu%t^JN@Tvlz81{c(ui@sedv4_D%9!PJ@KV_ z#L%GxKlTJ~4%I%&|3JC$c%Sv5zx*wg!&p%$1h3UCoX)@ovIpD6(8OFYKbvj^JA>f# zU>y>B7=+y&3g$45c|n|58h4`}s$jJnws4{Rrm7j4{pcI2W>eM#5EZ-h_X zqV=5IYAPYb1%AtQO(gU@47PQLJNj*6sOX~&-fQ6R*y$8!LXk_YUl8 zRwLy32271Jvupc|?7A%N7dkk+<}&<|1E}i4!(1<$yAS~3{c9tL)%1+9ttM*9+0RuG zboIyeO-8U522ww6!rm*cyjgNbwt)PfOVup zYs#t2R(RK~nl0DsjT~Woeir75+GYtUb++1%qN)x3_1JO%QUkb`oHG|6vT%h70QRc- z*0>1@7mh{TaxnbT*m^+N+o31a_TH<$dHNam!q99L^6A)Zfo|R3@UY0%gTB&Dlr#tC zy5;NZS3)LN%T3-RG9}5t-gN8nXQE^Q2^A#tbxX5zvMWJr*jSvLE0Kj*Ch5zh%KW^Y zFX{QovNPkk{D#xYylj*EEC0D!;Gwm!JuqNK{F1l_D_fy zlxzeXBr6CBscXKZtgvq!m<;2&GO&Ih5c+1l&3--TXvbD?N_UDT?!%`p%Oe_qb?}ctr)X(8&{Qfbi1r%@lj?%GdCVB z9uX>tGq<0#@bC$%*0^)z$4K-25V&ycq9t3qJ3ull~cV_CH9?_CH5D z@Ib*VBtV^hYD@L89J;~)?Nw?c`W>3MNo-`|FBr(+zhNE>a;;r6*Cvn3exQG4NfWFN zz+RO``IayW>_I;}TyJuCUUFS6PhRqf`askgcz@ARTbs!vXeUc>R}~f-Bc=v+x*5_B&hmkw;2ezN#lSOR;w^Lj|l7as$qkgxt35I zY2gJ5T`QSH>@^nsc(wM+`eT)EHJC5Bg(G-`As$NHu~a|SO9^_M23x0u>K-tkaA;EB zVF2o6eTQ^j!ysX+Sc~3*d6n4`2TR?|>c*JZuvh~u@b^C3h(n_8&bfOn2NcUM7?t+# zA0pcU=Me?*PipCC$OM|kXXD0N>0`WMM#vAc5(8)ia#|MHH;i9?yUutX`G+(bZd=3T zU{z=Bfie(t*tBVdvqqnFeGN^Pt7Kv44**L^#}4XId$%UCZR6o!YQIzQF8CsU#z!UJmjU=T|#kb_;Zph;m- zeC?Ybj!C|`1gGzrv|91%f>X0C700#jffd^ja zhyk`W@g&gyDl{4oH6D|35;K$}gF;Hn=t9^OSi!294272lHDh#<%W2_y9A1Y(_Wc>_ zy2(B4s(Vk0A{6j{zPY_oy0J@TpBUvlPS0lZJekem>-*?p^L(D`1AKw?WBAeS!=sY! zq|8TecFV|WjYfs2SKsaXcE9vSB!_5_lLNK}pioyD7Q&Dk*2B8m$Fe>|{KyBwYlsCM z#E=MY0|&G0ugMumhe~Koq{LGT%r%xceB%a)aP%#aPhw*x=M#UsxtG-U)ns}mU*TJe z%8=C@tzf7gnrhOlb!Cn)=de%P(c98yWaG-6HvfNpoC!EoU)aD$LbA=+$u5z7?8?4N z_G~fsvTIOwO@y+?wQpr#vhRlMA+l4Ey<{m_3sJsn{Ht&Jp69!sd1l=Ed*AcE=bkxp z&OPUSjs4$OX>z!fr>K~Vx@gvZiuxI#j2c4L?}Xl$yEc(-wbEDIqw?svkE!t8(6QK& zkD2bzy4=Gvqw<{f$Et0oKEn|@F3SBybfGQy9)?rnW-+A>igP1XcmNBT>RP*@ys7^6 z2&5a^&26oxR+}%s+qyKEN)MqUBTL@j{idr>@2sp%kzMw|o2V`^f{(|i%3jmK1c9n# z>>B&FQ*G|soGQ7^mfwFvczRc9U2f<`R$3A60^ZWlg?Q)0XPuim(q=~Pc=sxk#SQx1 z705*UQnfE+M;bO>(^;f?Kc5?RYqSKv#AgJqcF^arNKnIs@LI=_e$C80`ii28laG4L zkuK{oB6Pz%wewQ_6$f7@fxflxnW=Rs^%vtJgKPIl5C`E&J|1~ujR~u-Q8R}s^#R|N zbgzV|(cuY~&W?JE^`t%LqnJ*LtX{EMDcR$(fzsR}UI0U{yJ^2GNyW!@wnSRV zov27Iet3E@t3vlJXgk2koz>N&k=y2kxJ4yi9TH$r&r^_THLsiyLsQ^4TN5RwfA;Bz zqkWDiUR0lHsb>zd)byj@I~ZslJPkk6hDz@}wyL9>%eU-#CLHYnB9p-AKnZ((s8E2=!PPiU(?o7!a=nCF+?MhinlrE{o_yl6Y3thF}x zvgAD9vd!v^*fu)Uo)wclriMvIIR(X8ZrBHk~jik$Ov92((LiF0K;W24=6 zKR=r6=Xjk&pKCfnYhE-CJ`x9d)|`Ps@?)PB|Et?)%NwiNjS4d0EB^$Pbg?Qu+Az5xYrA$HP}UJ_PM@lcscmV-c3|-`C^`Ceqw) z@@Wu6&xR~vg!8>fRDd3NCF}Tm-_Xc5n0DR(sDm7SlCD(;Y({K^>8&=fq>&iOj@i{wO zPQH1VRVVgFgmvPqqTVsW@?~j%S!2`w7MDyQ>L@GBz=ndk?UB%6o@p*lb?p{ewXnyh z^o7Cc8E}|+3=T7W83?C!vRK)l=HK{{VhDd&63%cJubP|k_2pzESWi$;b`ZH@_Sc%5 zsA<=D&G(kcyjQbL?9b0uL@LY(5ydnjqq;vazvfmP_j5(3gy5_&nHA`$?WQ`U%_2e{ zOKh>HoMd$oBr0nyl|?O7x4ZR3eMg zMYovksXCVn)?AxrqmkAT^sC;O@puNdmKhcUe``R^Utq zXAz8TP=j_a#i%!_uu$d@FP03^!u9dylAm`rB9n{%!}%q;GV6}z$xa;tgHc)b>o*i_ zC&iWKSOXxpjC_R@GkRv(eID$WZ4@&%r54*-Dt8$dsn(BA@ExF8%{IobFPs9s@Y5(qz zidE@D&Jqg4By>y0)Ilr_D500cPPIDcyNhJEXSnoCaM?Xm9GiPJZIZ1Mny+&9;(aS@ zQ@_?Mach=`S~xCphqqITkk(>k*M}lUMM_j+vZ6f#U)R71A=>Yy@{M*dF;X;Q5ZZE> zpDz=M-#;Jgwq|AiI9aOd#?sUA#qK2vwng6s1tdDvj8S>`I7SZHs6FK^U>^(Pf1dPK z{=qZ6h;kQJV_c2(DMz~^UjpY^$9A+K8b7Zff#hLTQ3Bt?s?vDImCyG~CPSou&iy+B z6}d<<2mC0~Lsc}Gh~$P|Gj-0DXAuZ~781;LUU!^4j6RR#yGwP+s$XR(Ra;itnW zE4wNA{+b`9!aqlkN0=9Or)Ow`2%VAXt4W9MUpYx$nIB9A1eSCRtCk78T)9T_Hkez3(S}oBv|r z4m-n+Cjq~B^(&T-11?buXT_aGK2r^#pWkq_C8WA;P~^g$IJnH0)3z!UY*b5-pI5qS z*vT)-!}kaqcYWiPZSF`(;(k{({fMj5+ihiu>y(~k1_rGCLXB%A?CJPkak|@@ia&Q-fht|Ey6g$> zB$LzzbJ>lin~(gyEN%S?cqH^?%W3l$!I8z{rRYT}n6FOADr0w$y!oud$449qHytNbyC8+!;?Y zv0!g8Rq?o4qeRo9lQKU{jCo+V_YtHHsu&cFlF{0}2q$7a7soqu#VpqF?3%JFUtPf) z7Ozg~bU`@HC@H&j=D6M9N_q|rb4Jhd;GQwkpLbDz%}Bio*kzE>Oyv3ooI&vmuxgbr zQhqx}8Yr8zGas|SF@4c2`N#VpvN@gOQkI_t*!?O1xtih+_Nzx{s+G!Ko(5#-pP?Sd z1xF0^;G{?hGmV$2pg^^|j>$m-K1jGB^-_at;)7Uf0xxP_(0Ao}j0;m!(~Y1USG;qf z#~mT*RO1FaqM+etahu28=jtlSNURB?w0@PDGLs^{v0j2YJ~$w1V`aEt@@1;mN<0P~ z#p&&s<&dS^`-0dO+RA2|T1pW#8KJ^t^@3S#W5rr(cbouD?1Rc1jWL5|o}*gvM%#DW zwFm2X3ygQ^KQ!)YHumStEAY)qzAiQUWtV;FY72SJu*b9@(s#t0_oJGZ+UGUlC4_^bP+bI4PU@JNxfLFF6;26@Cn|7zXY(mFg?VB%9^i25*b@H%fKfyl6Mf`vull zgo*+eGcOTM@h72#9}O^^kCh7l$T9ggVzhx-hh3F=>MWFgU`gi@LfYlSj3dwFH!-W^`jD=tKb$_&q(vlQQ1DAV&CdP($jdJIJo4jIYb z>lk#mdYhUDuo&CGn(TgTze!|G7X4N2J{*Im*uRW3z1VAo>K~Ky+#ra&^M$tJAZ;w- zhH~If>(n++M!^)qK0=)km-C}b+=`0zJSiK3t+Nj%uUU$X#Zz9|`ugm=bsLE@N84Tn zNdWw-MWqubyj479;&!s`d6Us6WCbAt@96bSJYG)F$xQOdm`Ew`UG_`=xG^vG-o@6t zAW(GdQ#k(DssP$H>b#?W2AKr+uhd@!9IDh&S`@m_Us|Td@A!3~(2d6lastjoY?d%S zgR+nyD)OWH_*(vWL=~dTXcNbu?7B$d#ctFknQ$_z^lH;*#=e11_LpC$r%2AFq-3N> zxBl`!BxMP|1siyB!6EFieIRd~^Kb;K6jYFRp7m{HI8^Y`eCz`^nECa`&@H7leH^z? zl<()L#64A7-?-3}gzEgNSpB8zS^!1&_qyym7ex^Wz1Pi--MzkMW1>z$R_Jo{K`V8g zcTO+=o7TR0b=nKuibOQLUtP{R7JiKTtKz?Q6t58jkg=w*5UWyOT zizf32woh)~Lx@sHay&J9<(OL>^Q#)krG>ilscSoOJYJ<^*mlK11712Fokxd$a8~ho z=T)QFQMMAJfLEGJrEJTT(mVxx;N-bdPaSn{NTcEvLA~{DpT%pNEB$nJ(vk+0H;Y-G z@2)eZB|oquwtR<T&(T3ekEJ?@%4 zyQm}$`<_KfeW#tlw<2qf%7+1g?fQ)!JSjB!v&YvED^i6k`K|s$F9?!{dI;#=2C`J~$uw^@aEH?9P@Ya8>tf%F{%O7l`2 zd^-C*!#J7!gGcsKn}lToo53yFgCWd?7R1L&?^%OuSsduke1SwAK7zh&m|<;pYKMm9 zZpKzQ9KTBtBkfHb=`(-!FmJ(*r|v4wa<+}vVnYOz`$Lbt#~!-FuzfdXS7y~!o`&S? z;eGY?=#-2uvmvtTMmFREt(lx`y8%3n=$)=Ue5)wbZKu?g&-_aO-6LNn0SI z`!{WYX&oyj^#SmpP8d4_CeT(ViaN<525NzT9XaLzJM;ezC}dqe8T@>*cHOwwl1lhQPoJS6OfLX!EvFV^gMXdBq=E%?1!63Y?0{pyzx&+(wb(5f1lfS& z4sr~Lwa$vAkvS27cgkZRto17_h%yD^R#WGx|9_VZAdstA;9eToy66DnF2Pg(<+@J% z$H@ZyX9Mncor+^UlEV@w$OX%h1p>NH+ri(b9^eWw7I>Hsu)Y+>gnnQq@Rlzr!E){w zVrnPtB`3z8zk_=SL=sE9qXbYZyBhajBgPu=V{r*(7=m&Tv_mv8; yCb@vrDk`85>`qU<(0_i*K&{MJn*D2lb9JoLIvOXLlpzoS@XsC!fgIPI{P#cg;+Hf4 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4418ac7b..c2974e15 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Apr 05 23:44:03 CEST 2014 +#Tue Aug 12 20:02:33 CEST 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip From c4be090d12a8c4df63651e1bd75fc7a6a444e3af Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 17 Aug 2014 02:09:15 +0200 Subject: [PATCH 069/314] The printer now destroys mismatches blocks. --- .../schematica/SchematicPrinter.java | 35 ++++++++++++++----- .../handler/ConfigurationHandler.java | 21 +++++++---- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 8c8dc8dc..4db7c885 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -122,12 +122,6 @@ public boolean print() { for (x = minX; x < maxX; x++) { for (z = minZ; z < maxZ; z++) { - Block block = this.schematic.getBlock(x, y, z); - - if (this.schematic.isAirBlock(x, y, z)) { - continue; - } - if (this.timeout[x][y][z] > 0) { this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; continue; @@ -137,14 +131,39 @@ public boolean print() { wy = this.schematic.position.y + y; wz = this.schematic.position.z + z; - Block realBlock = world.getBlock(wx, wy, wz); + final Block block = this.schematic.getBlock(x, y, z); + final Block realBlock = world.getBlock(wx, wy, wz); + final int metadata = this.schematic.getBlockMetadata(x, y, z); + final int realMetadata = world.getBlockMetadata(wx, wy, wz); + + if (block == realBlock && metadata == realMetadata) { + continue; + } + + if (!world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { + this.minecraft.playerController.clickBlock(wx, wy, wz, 0); + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + + if (!ConfigurationHandler.destroyInstantly) { + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return true; + } + + continue; + } + + if (this.schematic.isAirBlock(x, y, z)) { + continue; + } + if (!realBlock.isReplaceable(world, wx, wy, wz)) { continue; } - int metadata = this.schematic.getBlockMetadata(x, y, z); if (placeBlock(this.minecraft, world, player, wx, wy, wz, BlockInfo.getItemFromBlock(block), metadata)) { this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + if (!ConfigurationHandler.placeInstantly) { player.inventory.currentItem = slot; syncSneaking(player, isSneaking); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index d8a8aa63..3950458d 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -39,6 +39,8 @@ public class ConfigurationHandler { public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; public static final String PLACE_INSTANTLY = "placeInstantly"; public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; + public static final String DESTROY_INSTANTLY = "destroyInstantly"; + public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; public static final String PLACE_ADJACENT = "placeAdjacent"; public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; public static final String SWAP_SLOTS = "swapSlots"; @@ -56,13 +58,14 @@ public class ConfigurationHandler { public static final boolean HIGHLIGHT_DEFAULT = true; public static final boolean HIGHLIGHTAIR_DEFAULT = true; public static final double BLOCKDELTA_DEFAULT = 0.005; + public static final boolean DRAWQUADS_DEFAULT = true; + public static final boolean DRAWLINES_DEFAULT = true; public static final int PLACEDELAY_DEFAULT = 1; public static final int TIMEOUT_DEFAULT = 10; public static final boolean PLACEINSTANTLY_DEFAULT = false; + public static final boolean DESTROYINSTANTLY_DEFAULT = false; public static final boolean PLACEADJACENT_DEFAULT = true; public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; - public static final boolean DRAWQUADS_DEFAULT = true; - public static final boolean DRAWLINES_DEFAULT = true; public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), "schematics"); public static boolean enableAlpha = ENABLEALPHA_DEFAULT; @@ -70,14 +73,15 @@ public class ConfigurationHandler { public static boolean highlight = HIGHLIGHT_DEFAULT; public static boolean highlightAir = HIGHLIGHTAIR_DEFAULT; public static float blockDelta = (float) BLOCKDELTA_DEFAULT; + public static boolean drawQuads = DRAWQUADS_DEFAULT; + public static boolean drawLines = DRAWLINES_DEFAULT; public static int placeDelay = PLACEDELAY_DEFAULT; public static int timeout = TIMEOUT_DEFAULT; public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; + public static boolean destroyInstantly = DESTROYINSTANTLY_DEFAULT; public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; public static int[] swapSlots = SWAPSLOTS_DEFAULT; public static Queue swapSlotsQueue = new ArrayDeque(); - public static boolean drawQuads = DRAWQUADS_DEFAULT; - public static boolean drawLines = DRAWLINES_DEFAULT; public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; public static Property propEnableAlpha = null; @@ -85,13 +89,14 @@ public class ConfigurationHandler { public static Property propHighlight = null; public static Property propHighlightAir = null; public static Property propBlockDelta = null; + public static Property propDrawQuads = null; + public static Property propDrawLines = null; public static Property propPlaceDelay = null; public static Property propTimeout = null; public static Property propPlaceInstantly = null; + public static Property propDestroyInstantly = null; public static Property propPlaceAdjacent = null; public static Property propSwapSlots = null; - public static Property propDrawQuads = null; - public static Property propDrawLines = null; public static Property propSchematicDirectory = null; public static void init(File configFile) { @@ -144,6 +149,10 @@ private static void loadConfiguration() { propPlaceInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_INSTANTLY)); placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); + propDestroyInstantly = configuration.get(CATEGORY_PRINTER, DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, DESTROY_INSTANTLY_DESC); + propDestroyInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DESTROY_INSTANTLY)); + destroyInstantly = propDestroyInstantly.getBoolean(DESTROYINSTANTLY_DEFAULT); + propPlaceAdjacent = configuration.get(CATEGORY_PRINTER, PLACE_ADJACENT, PLACEADJACENT_DEFAULT, PLACE_ADJACENT_DESC); propPlaceAdjacent.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_ADJACENT)); placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); From 198b644b5aafd76d5f2253b47d40ab8ee4813cb1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 17 Aug 2014 02:12:02 +0200 Subject: [PATCH 070/314] Added localization stuff. --- src/main/resources/assets/schematica/lang/ca_ES.lang | 2 ++ src/main/resources/assets/schematica/lang/cs_CZ.lang | 2 ++ src/main/resources/assets/schematica/lang/da_DK.lang | 2 ++ src/main/resources/assets/schematica/lang/de_DE.lang | 2 ++ src/main/resources/assets/schematica/lang/en_GB.lang | 2 ++ src/main/resources/assets/schematica/lang/en_PT.lang | 2 ++ src/main/resources/assets/schematica/lang/en_US.lang | 2 ++ src/main/resources/assets/schematica/lang/es_ES.lang | 2 ++ src/main/resources/assets/schematica/lang/es_MX.lang | 2 ++ src/main/resources/assets/schematica/lang/fi_FI.lang | 2 ++ src/main/resources/assets/schematica/lang/fr_FR.lang | 2 ++ src/main/resources/assets/schematica/lang/hu_HU.lang | 2 ++ src/main/resources/assets/schematica/lang/it_IT.lang | 2 ++ src/main/resources/assets/schematica/lang/la_LA.lang | 2 ++ src/main/resources/assets/schematica/lang/lt_LT.lang | 2 ++ src/main/resources/assets/schematica/lang/nl_NL.lang | 2 ++ src/main/resources/assets/schematica/lang/no_NO.lang | 2 ++ src/main/resources/assets/schematica/lang/pl_PL.lang | 2 ++ src/main/resources/assets/schematica/lang/pt_PT.lang | 2 ++ src/main/resources/assets/schematica/lang/ru_RU.lang | 2 ++ src/main/resources/assets/schematica/lang/sk_SK.lang | 2 ++ src/main/resources/assets/schematica/lang/sl_SI.lang | 2 ++ src/main/resources/assets/schematica/lang/th_TH.lang | 2 ++ src/main/resources/assets/schematica/lang/tr_TR.lang | 2 ++ src/main/resources/assets/schematica/lang/uk_UA.lang | 2 ++ src/main/resources/assets/schematica/lang/zh_CN.lang | 2 ++ 26 files changed, 52 insertions(+) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index aa71dfa1..edfb2dc7 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Imprimir # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index a3e49f67..2213b453 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tiskárna # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 8a219225..c50263c3 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Antal # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 296e3b6f..8f428a20 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Drucker # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 70e8f09f..f7774cfb 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Printer # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 9c7935cf..4767848e 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Printing thing # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 78c3c4bb..5ead52ce 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -60,6 +60,8 @@ schematica.config.timeout=Timeout schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. schematica.config.placeInstantly=Place Instantly schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +schematica.config.destroyInstantly=Destroy Instantly +schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Place Only Adjacent schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 056a7da2..cbeda91d 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Impresora # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 9588bd35..8eed2285 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Cantidad # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index e7f9cfd1..e7deec82 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tulostin # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index f6cd0158..9899f541 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Mode imprimante # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 7e29baac..6d410d41 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Nyomtató # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index a19ae783..4437eda1 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Quantità # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 3b85abc1..fe398f31 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Numerus # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 0f0987c0..16bc3138 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Kiekis # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 03f82400..b7bb5de2 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index d9ca9c20..d3504437 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -60,6 +60,8 @@ schematica.config.timeout=Tidsavbrudd schematica.config.timeout.tooltip=Tidsavbrudd før nytt forsøk på å plassere blokker. schematica.config.placeInstantly=Plasser umiddelbart schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Plasser kun tilstøtende schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 5d867da3..81a9fad2 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Drukarka # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index d0554517..bdda3d5b 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 8d38f6b4..63de7a12 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Принтер # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index a30b802b..85a9b67d 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tlačiareň # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index c86acafc..21f2bec0 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tiskalnik # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 98598907..e9b6670e 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -60,6 +60,8 @@ schematica.gui.printer=การปริ๊น # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index fdcc299e..ddddb540 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Yazıcı # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 3adccc7d..4b386c2f 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Принтер # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index b60d3559..a6df67e9 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -60,6 +60,8 @@ schematica.gui.printer=投影 # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyInstantly=Destroy Instantly +# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent # schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # schematica.config.swapSlots=Swap Slots From 7e2b4fdd6e08214dc0af95d991e05a644c9ef672 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 17 Aug 2014 21:52:13 +0200 Subject: [PATCH 071/314] The destroy functionality of the printer is now configurable, off by default. --- .../lunatrius/schematica/SchematicPrinter.java | 2 +- .../schematica/handler/ConfigurationHandler.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 4db7c885..945d78b2 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -140,7 +140,7 @@ public boolean print() { continue; } - if (!world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { + if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { this.minecraft.playerController.clickBlock(wx, wy, wz, 0); this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 3950458d..f15a8e81 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -14,6 +14,8 @@ import java.util.Queue; public class ConfigurationHandler { + public static final String VERSION = "1"; + public static final String CATEGORY_RENDER = "render"; public static final String CATEGORY_PRINTER = "printer"; public static final String CATEGORY_GENERAL = "general"; @@ -39,6 +41,8 @@ public class ConfigurationHandler { public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; public static final String PLACE_INSTANTLY = "placeInstantly"; public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; + public static final String DESTROY_BLOCKS = "destroyBlocks"; + public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks in creative mode."; public static final String DESTROY_INSTANTLY = "destroyInstantly"; public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; public static final String PLACE_ADJACENT = "placeAdjacent"; @@ -63,6 +67,7 @@ public class ConfigurationHandler { public static final int PLACEDELAY_DEFAULT = 1; public static final int TIMEOUT_DEFAULT = 10; public static final boolean PLACEINSTANTLY_DEFAULT = false; + public static final boolean DESTROYBLOCKS_DEFAULT = false; public static final boolean DESTROYINSTANTLY_DEFAULT = false; public static final boolean PLACEADJACENT_DEFAULT = true; public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; @@ -78,6 +83,7 @@ public class ConfigurationHandler { public static int placeDelay = PLACEDELAY_DEFAULT; public static int timeout = TIMEOUT_DEFAULT; public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; + public static boolean destroyBlocks = DESTROYBLOCKS_DEFAULT; public static boolean destroyInstantly = DESTROYINSTANTLY_DEFAULT; public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; public static int[] swapSlots = SWAPSLOTS_DEFAULT; @@ -94,6 +100,7 @@ public class ConfigurationHandler { public static Property propPlaceDelay = null; public static Property propTimeout = null; public static Property propPlaceInstantly = null; + public static Property propDestroyBlocks = null; public static Property propDestroyInstantly = null; public static Property propPlaceAdjacent = null; public static Property propSwapSlots = null; @@ -101,7 +108,7 @@ public class ConfigurationHandler { public static void init(File configFile) { if (configuration == null) { - configuration = new Configuration(configFile); + configuration = new Configuration(configFile, VERSION); loadConfiguration(); } } @@ -149,6 +156,10 @@ private static void loadConfiguration() { propPlaceInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_INSTANTLY)); placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); + propDestroyBlocks = configuration.get(CATEGORY_PRINTER, DESTROY_BLOCKS, DESTROYBLOCKS_DEFAULT, DESTROY_BLOCKS_DESC); + propDestroyBlocks.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DESTROY_BLOCKS)); + destroyBlocks = propDestroyBlocks.getBoolean(DESTROYBLOCKS_DEFAULT); + propDestroyInstantly = configuration.get(CATEGORY_PRINTER, DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, DESTROY_INSTANTLY_DESC); propDestroyInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DESTROY_INSTANTLY)); destroyInstantly = propDestroyInstantly.getBoolean(DESTROYINSTANTLY_DEFAULT); From e3c085aba1b3e1916cd4a1bfdf1473f41351a7bd Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 17 Aug 2014 21:52:45 +0200 Subject: [PATCH 072/314] Added localization stuff. --- src/main/resources/assets/schematica/lang/ca_ES.lang | 2 ++ src/main/resources/assets/schematica/lang/cs_CZ.lang | 2 ++ src/main/resources/assets/schematica/lang/da_DK.lang | 2 ++ src/main/resources/assets/schematica/lang/de_DE.lang | 2 ++ src/main/resources/assets/schematica/lang/en_GB.lang | 2 ++ src/main/resources/assets/schematica/lang/en_PT.lang | 2 ++ src/main/resources/assets/schematica/lang/en_US.lang | 2 ++ src/main/resources/assets/schematica/lang/es_ES.lang | 2 ++ src/main/resources/assets/schematica/lang/es_MX.lang | 2 ++ src/main/resources/assets/schematica/lang/fi_FI.lang | 2 ++ src/main/resources/assets/schematica/lang/fr_FR.lang | 2 ++ src/main/resources/assets/schematica/lang/hu_HU.lang | 2 ++ src/main/resources/assets/schematica/lang/it_IT.lang | 2 ++ src/main/resources/assets/schematica/lang/la_LA.lang | 2 ++ src/main/resources/assets/schematica/lang/lt_LT.lang | 2 ++ src/main/resources/assets/schematica/lang/nl_NL.lang | 2 ++ src/main/resources/assets/schematica/lang/no_NO.lang | 2 ++ src/main/resources/assets/schematica/lang/pl_PL.lang | 2 ++ src/main/resources/assets/schematica/lang/pt_PT.lang | 2 ++ src/main/resources/assets/schematica/lang/ru_RU.lang | 2 ++ src/main/resources/assets/schematica/lang/sk_SK.lang | 2 ++ src/main/resources/assets/schematica/lang/sl_SI.lang | 2 ++ src/main/resources/assets/schematica/lang/th_TH.lang | 2 ++ src/main/resources/assets/schematica/lang/tr_TR.lang | 2 ++ src/main/resources/assets/schematica/lang/uk_UA.lang | 2 ++ src/main/resources/assets/schematica/lang/zh_CN.lang | 2 ++ 26 files changed, 52 insertions(+) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index edfb2dc7..a723d555 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Imprimir # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 2213b453..7e5f8e7e 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tiskárna # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index c50263c3..ddb93129 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Antal # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 8f428a20..afa0446b 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Drucker # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index f7774cfb..b441935a 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Printer # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 4767848e..12b1ffc8 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Printing thing # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 5ead52ce..c13c3c14 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -60,6 +60,8 @@ schematica.config.timeout=Timeout schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. schematica.config.placeInstantly=Place Instantly schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +schematica.config.destroyBlocks=Destroy Blocks +schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). schematica.config.destroyInstantly=Destroy Instantly schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index cbeda91d..076abfeb 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Impresora # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 8eed2285..c1fc1a19 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Cantidad # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index e7deec82..86b4ccc2 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tulostin # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 9899f541..b05941ca 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Mode imprimante # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 6d410d41..f7737d8e 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Nyomtató # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 4437eda1..3b2a4f17 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Quantità # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index fe398f31..6a2cb2a3 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Numerus # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 16bc3138..0438c2f7 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Kiekis # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index b7bb5de2..4cf6e4c6 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -60,6 +60,8 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index d3504437..09100c5c 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -60,6 +60,8 @@ schematica.config.timeout=Tidsavbrudd schematica.config.timeout.tooltip=Tidsavbrudd før nytt forsøk på å plassere blokker. schematica.config.placeInstantly=Plasser umiddelbart schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Plasser kun tilstøtende diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 81a9fad2..99695d87 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Drukarka # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index bdda3d5b..6cdad7ca 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 63de7a12..41fe9f04 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Принтер # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 85a9b67d..0228c923 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tlačiareň # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index 21f2bec0..10e0fdd4 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Tiskalnik # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index e9b6670e..eb44f122 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -60,6 +60,8 @@ schematica.gui.printer=การปริ๊น # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index ddddb540..4e9bbd5f 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Yazıcı # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 4b386c2f..ddf2b7f8 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -60,6 +60,8 @@ schematica.gui.printer=Принтер # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index a6df67e9..887816c0 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -60,6 +60,8 @@ schematica.gui.printer=投影 # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. # schematica.config.placeInstantly=Place Instantly # schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +# schematica.config.destroyBlocks=Destroy Blocks +# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). # schematica.config.destroyInstantly=Destroy Instantly # schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. # schematica.config.placeAdjacent=Place Only Adjacent From 77b3fc3a6258bccf50686aafa5fbcc6604bec2a2 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 17 Aug 2014 23:29:25 +0200 Subject: [PATCH 073/314] Added a bunch of missing placement mappings. --- .../lunatrius/schematica/config/BlockInfo.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 06b232e8..24ff0639 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -259,7 +259,7 @@ public static void populatePlacementMaps() { addPlacementMapping(BlockEnderChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); addPlacementMapping(BlockFurnace.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); addPlacementMapping(BlockHopper.class, new PlacementData(PlacementType.BLOCK, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockLog.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC)); + addPlacementMapping(BlockLog.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC).setMaskMetaInHand(0x3)); addPlacementMapping(BlockPistonBase.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); addPlacementMapping(BlockPumpkin.class, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0xF)); addPlacementMapping(BlockStairs.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 1, 0).setOffset(0x4, 0.0f, 1.0f).setMaskMeta(0x3)); @@ -269,17 +269,28 @@ public static void populatePlacementMaps() { addPlacementMapping(Blocks.planks, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.sandstone, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.wool, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.yellow_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.red_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.double_stone_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0x7)); addPlacementMapping(Blocks.stone_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); addPlacementMapping(Blocks.stained_glass, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.ladder, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 2, 5, 4)); + addPlacementMapping(Blocks.lever, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); + addPlacementMapping(Blocks.snow_layer, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0x7)); addPlacementMapping(Blocks.trapdoor, new PlacementData(PlacementType.BLOCK, -1, -1, 1, 0, 3, 2).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x3)); addPlacementMapping(Blocks.monster_egg, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.stonebrick, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.tripwire_hook, new PlacementData(PlacementType.BLOCK, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); addPlacementMapping(Blocks.quartz_block, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.fence_gate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3)); + addPlacementMapping(Blocks.double_wooden_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.wooden_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); addPlacementMapping(Blocks.anvil, new PlacementData(PlacementType.PLAYER, -1, -1, 1, 3, 0, 2).setMaskMeta(0x3).setMaskMetaInHand(0xC).setBitShiftMetaInHand(2)); addPlacementMapping(Blocks.stained_hardened_clay, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.carpet, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.stained_glass_pane, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Items.wooden_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); + addPlacementMapping(Items.iron_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); addPlacementMapping(Items.repeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); addPlacementMapping(Items.comparator, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); } From 311baaaf7f1f7e19b374e8a4238bf3e405ca5316 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 17 Aug 2014 23:30:51 +0200 Subject: [PATCH 074/314] Special cased a few pick block instances. --- .../schematica/handler/ConfigurationHandler.java | 2 +- .../schematica/handler/client/KeyInputHandler.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index f15a8e81..19d00601 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -42,7 +42,7 @@ public class ConfigurationHandler { public static final String PLACE_INSTANTLY = "placeInstantly"; public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; public static final String DESTROY_BLOCKS = "destroyBlocks"; - public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks in creative mode."; + public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks (creative mode only)."; public static final String DESTROY_INSTANTLY = "destroyInstantly"; public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; public static final String PLACE_ADJACENT = "placeAdjacent"; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 3f206ccf..bf64d389 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -7,11 +7,14 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraftforge.common.ForgeHooks; @@ -97,6 +100,12 @@ private boolean pickBlock(final SchematicWorld schematic, final float partialTic } if (player.capabilities.isCreativeMode) { + final Block block = schematic.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); + final int metadata = schematic.getBlockMetadata(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); + if (block == Blocks.double_stone_slab || block == Blocks.double_wooden_slab || block == Blocks.snow_layer) { + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(block, 1, metadata & 0x7)); + } + final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); } From 5041fab9b58f2d45d4e248356ec5efe268ec39bf Mon Sep 17 00:00:00 2001 From: hieroglyphic Date: Tue, 19 Aug 2014 03:25:21 +0900 Subject: [PATCH 075/314] Added localizations for Korean Added localizations for Korean --- .../assets/schematica/lang/ko_KR.lang | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/main/resources/assets/schematica/lang/ko_KR.lang diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang new file mode 100644 index 00000000..d6112ea1 --- /dev/null +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -0,0 +1,80 @@ +# gui - general +schematica.gui.openFolder=Schematic 폴더 열기 +schematica.gui.done=완료 +schematica.gui.title=Schematic 파일 선택 +schematica.gui.folderInfo=(여기에 schematic 파일을 놓으세요) +schematica.gui.noschematic=-- Schematic 없음 -- +schematica.gui.increase=+ +schematica.gui.decrease=- +schematica.gui.hide=숨기기 +schematica.gui.all=모두 +schematica.gui.show=표시 +schematica.gui.movehere=여기에 옮기기 +schematica.gui.flip=뒤집기 +schematica.gui.rotate=회전 +schematica.gui.save=저장 +schematica.gui.moveschematic=Schematic 이동 +schematica.gui.layers=레이어 +schematica.gui.operations=동작 +schematica.gui.point.red=빨간 점 +schematica.gui.point.blue=푸른 점 +schematica.gui.saveselection=선택 영역을 schematic으로 저장 +schematica.gui.enable=활성화 +schematica.gui.disable=비활성화 +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: +schematica.gui.materials=재료 +schematica.gui.materialname=재료 +schematica.gui.materialamount=양 +schematica.gui.printer=프린터 + +# gui - config - categories +schematica.config.category.render=렌더링 +schematica.config.category.render.tooltip=렌더링 관련 설정. +schematica.config.category.printer=프린터 +schematica.config.category.printer.tooltip=프린터 관련 설정. +schematica.config.category.general=일반 +schematica.config.category.general.tooltip=일반 설정. + +# gui - config - render +schematica.config.alphaEnabled=알파 활성화됨 +schematica.config.alphaEnabled.tooltip=투명한 텍스쳐 활성화. +schematica.config.alpha=알파 +schematica.config.alpha.tooltip=알파 값은 schematic을 렌더링할 때 사용됩니다(1.0 = 불투명, 0.5 = 반투명, 0.0 = 투명). +schematica.config.highlight=블럭 표시 +schematica.config.highlight.tooltip=놓아질 블럭과 잘못 놓아진 블럭을 표시합니다. +schematica.config.highlightAir=공기 표시 +schematica.config.highlightAir.tooltip=공기여야 하는 블럭을 표시합니다. +schematica.config.blockDelta=블럭 델타 +schematica.config.blockDelta.tooltip=표시에 쓰이는 델타 값 (만약 z-fighting 이 생기면 높이세요). +schematica.config.drawQuads=표면 그리기 +schematica.config.drawQuads.tooltip=블럭 표면을 보여줍니다. +schematica.config.drawLines=선 그리기 +schematica.config.drawLines.tooltip=외곽선을 보여줍니다. + +# gui - config - printer +schematica.config.placeDelay=놓기 지연시간 +schematica.config.placeDelay.tooltip=놓기 시도간의 지연시간 (틱 단위). +schematica.config.timeout=시간 제한 +schematica.config.timeout.tooltip=실패한 블럭을 재시도하기 전의 시간 제한. +schematica.config.placeInstantly=즉시 놓기 +schematica.config.placeInstantly.tooltip=1틱 안에 가능한 모든 블럭을 놓기. +schematica.config.destroyBlocks=블럭 부수기 +schematica.config.destroyBlocks.tooltip=프린터가 블럭을 부숩니다 (크리에이티브 모드 전용). +schematica.config.destroyInstantly=즉시 부수기 +schematica.config.destroyInstantly.tooltip=1틱안에 가능한 모든 블럭을 부수기. +schematica.config.placeAdjacent=접촉된 블럭만 놓기 +schematica.config.placeAdjacent.tooltip=접촉된 블럭이 있을 경우에만 블럭을 놓습니다. +schematica.config.swapSlots=슬롯 바꾸기 +schematica.config.swapSlots.tooltip=프린터는 인벤토리의 아이템을 바꾸기 위해 이 슬롯들을 사용합니다. + +# gui - config - general +schematica.config.schematicDirectory=Schematic 디렉토리 +schematica.config.schematicDirectory.tooltip=Schematic 디렉토리. + +# keys +schematica.key.category=Schematica +schematica.key.load=Schematic 불러오기 +schematica.key.save=Schematic 저장 +schematica.key.control=Schematic 조작 From 9d9af329285024affa57aab0eb0558966cb5c698 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 19 Aug 2014 19:03:45 +0200 Subject: [PATCH 076/314] Allow stone double slabs with meta up to 15 instead of 7. --- .../java/com/github/lunatrius/schematica/config/BlockInfo.java | 2 +- .../lunatrius/schematica/handler/client/KeyInputHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 24ff0639..e06ba6e9 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -271,7 +271,7 @@ public static void populatePlacementMaps() { addPlacementMapping(Blocks.wool, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.yellow_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.red_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.double_stone_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0x7)); + addPlacementMapping(Blocks.double_stone_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.stone_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); addPlacementMapping(Blocks.stained_glass, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.ladder, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 2, 5, 4)); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index bf64d389..a51f7b4f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -103,7 +103,7 @@ private boolean pickBlock(final SchematicWorld schematic, final float partialTic final Block block = schematic.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); final int metadata = schematic.getBlockMetadata(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); if (block == Blocks.double_stone_slab || block == Blocks.double_wooden_slab || block == Blocks.snow_layer) { - player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(block, 1, metadata & 0x7)); + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(block, 1, metadata & 0xF)); } final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; From 9f668ffaaa8411021b69dafdaaf65669df87c210 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 19 Aug 2014 19:05:03 +0200 Subject: [PATCH 077/314] Increased the message count for SBCs to 20 and added debug output. --- .../lunatrius/schematica/handler/client/ChatEventHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index fb4301d0..d6534ed7 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -15,8 +15,10 @@ public class ChatEventHandler { @SubscribeEvent public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { - if (chatLines++ < 10) { + if (chatLines < 20) { + chatLines++; String message = event.message.getFormattedText(); + Reference.logger.debug(String.format("Message #%d: %s", chatLines, message)); if (message.contains(SBC_DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); SchematicPrinter.INSTANCE.setEnabled(false); From 5f273aeea60495f2551b058b18c1ed1f2b8386e2 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 26 Aug 2014 19:57:05 +0200 Subject: [PATCH 078/314] Extracted block placement code and added some error logging. Fixes #46 --- .../schematica/SchematicPrinter.java | 125 ++++++++++-------- 1 file changed, 67 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 945d78b2..4aa69a1f 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -5,6 +5,7 @@ import com.github.lunatrius.schematica.config.PlacementData; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -94,89 +95,97 @@ public void refresh() { } public boolean print() { - int minX, maxX, minY, maxY, minZ, maxZ, x, y, z, wx, wy, wz, slot; - boolean isSneaking; - EntityClientPlayerMP player = this.minecraft.thePlayer; - World world = this.minecraft.theWorld; + final EntityClientPlayerMP player = this.minecraft.thePlayer; + final World world = this.minecraft.theWorld; syncSneaking(player, true); - Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); - minX = Math.max(0, trans.x - 3); - maxX = Math.min(this.schematic.getWidth(), trans.x + 4); - minY = Math.max(0, trans.y - 3); - maxY = Math.min(this.schematic.getHeight(), trans.y + 4); - minZ = Math.max(0, trans.z - 3); - maxZ = Math.min(this.schematic.getLength(), trans.z + 4); + final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); + final int minX = Math.max(0, trans.x - 3); + final int maxX = Math.min(this.schematic.getWidth(), trans.x + 4); + final int minY = Math.max(0, trans.y - 3); + final int maxY = Math.min(this.schematic.getHeight(), trans.y + 4); + final int minZ = Math.max(0, trans.z - 3); + final int maxZ = Math.min(this.schematic.getLength(), trans.z + 4); - slot = player.inventory.currentItem; - isSneaking = player.isSneaking(); + final int slot = player.inventory.currentItem; + final boolean isSneaking = player.isSneaking(); - int renderingLayer = this.schematic.renderingLayer; - for (y = minY; y < maxY; y++) { + final int renderingLayer = this.schematic.renderingLayer; + for (int y = minY; y < maxY; y++) { if (renderingLayer >= 0) { if (y != renderingLayer) { continue; } } - for (x = minX; x < maxX; x++) { - for (z = minZ; z < maxZ; z++) { - if (this.timeout[x][y][z] > 0) { - this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; - continue; + for (int x = minX; x < maxX; x++) { + for (int z = minZ; z < maxZ; z++) { + try { + if (placeBlock(world, player, x, y, z)) { + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return true; + } + } catch (Exception e) { + Reference.logger.error("Could not place block!", e); + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return false; } + } + } + } - wx = this.schematic.position.x + x; - wy = this.schematic.position.y + y; - wz = this.schematic.position.z + z; + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return true; + } - final Block block = this.schematic.getBlock(x, y, z); - final Block realBlock = world.getBlock(wx, wy, wz); - final int metadata = this.schematic.getBlockMetadata(x, y, z); - final int realMetadata = world.getBlockMetadata(wx, wy, wz); + private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z) { + if (this.timeout[x][y][z] > 0) { + this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; + return false; + } - if (block == realBlock && metadata == realMetadata) { - continue; - } + final int wx = this.schematic.position.x + x; + final int wy = this.schematic.position.y + y; + final int wz = this.schematic.position.z + z; - if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { - this.minecraft.playerController.clickBlock(wx, wy, wz, 0); - this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + final Block block = this.schematic.getBlock(x, y, z); + final Block realBlock = world.getBlock(wx, wy, wz); + final int metadata = this.schematic.getBlockMetadata(x, y, z); + final int realMetadata = world.getBlockMetadata(wx, wy, wz); - if (!ConfigurationHandler.destroyInstantly) { - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return true; - } + if (block == realBlock && metadata == realMetadata) { + return false; + } - continue; - } + if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { + this.minecraft.playerController.clickBlock(wx, wy, wz, 0); - if (this.schematic.isAirBlock(x, y, z)) { - continue; - } + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; - if (!realBlock.isReplaceable(world, wx, wy, wz)) { - continue; - } + return !ConfigurationHandler.destroyInstantly; + } - if (placeBlock(this.minecraft, world, player, wx, wy, wz, BlockInfo.getItemFromBlock(block), metadata)) { - this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + if (this.schematic.isAirBlock(x, y, z)) { + return false; + } - if (!ConfigurationHandler.placeInstantly) { - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return true; - } - } - } + if (!realBlock.isReplaceable(world, wx, wy, wz)) { + return false; + } + + if (placeBlock(this.minecraft, world, player, wx, wy, wz, BlockInfo.getItemFromBlock(block), metadata)) { + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + + if (!ConfigurationHandler.placeInstantly) { + return true; } } - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return true; + return false; } private boolean isSolid(World world, int x, int y, int z, ForgeDirection side) { From f31baac1dfeac3e7d5676bed0514e1ee4e69e96a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 27 Aug 2014 21:56:52 +0200 Subject: [PATCH 079/314] Re-enabled alpha support. This time around it uses a really simple shader. --- .../renderer/RendererSchematicChunk.java | 129 ++++-------------- .../client/renderer/shader/ShaderProgram.java | 124 +++++++++++++++++ .../handler/ConfigurationHandler.java | 2 - .../assets/schematica/shaders/alpha.frag | 9 ++ 4 files changed, 159 insertions(+), 105 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java create mode 100644 src/main/resources/assets/schematica/shaders/alpha.frag diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index ef389121..3068bcae 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -1,11 +1,11 @@ package com.github.lunatrius.schematica.client.renderer; import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; @@ -18,21 +18,20 @@ import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; -import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; public class RendererSchematicChunk { public static final int CHUNK_WIDTH = 16; public static final int CHUNK_HEIGHT = 16; public static final int CHUNK_LENGTH = 16; + private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); + private static boolean canUpdate = false; public boolean isInFrustrum = false; @@ -47,11 +46,10 @@ public class RendererSchematicChunk { private final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); - private static final Map resourcePacks = new HashMap(); - private Field fieldMapTexturesStiched; - private boolean needsUpdate = true; private int glList = -1; + // TODO: move this away from GL lists + private int glListHighlight = -1; public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int baseY, int baseZ) { this.schematic = schematicWorld; @@ -79,19 +77,16 @@ public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int base } this.glList = GL11.glGenLists(3); - - try { - this.fieldMapTexturesStiched = ReflectionHelper.findField(TextureMap.class, "f", "field_94252_e", "mapUploadedSprites"); - } catch (Exception ex) { - Reference.logger.fatal("Failed to initialize mapTexturesStiched!", ex); - this.fieldMapTexturesStiched = null; - } + this.glListHighlight = GL11.glGenLists(3); } public void delete() { if (this.glList != -1) { GL11.glDeleteLists(this.glList, 3); } + if (this.glListHighlight != -1) { + GL11.glDeleteLists(this.glListHighlight, 3); + } } public AxisAlignedBB getBoundingBox() { @@ -145,7 +140,9 @@ public void updateRenderer() { GL11.glNewList(this.glList + pass, GL11.GL_COMPILE); renderBlocks(pass, minX, minY, minZ, maxX, maxY, maxZ); + GL11.glEndList(); + GL11.glNewList(this.glListHighlight + pass, GL11.GL_COMPILE); int quadCount = RenderHelper.getQuadCount(); int lineCount = RenderHelper.getLineCount(); @@ -195,9 +192,22 @@ public void render(int renderPass) { GL11.glDisable(GL11.GL_LIGHTING); this.profiler.startSection("blocks"); - bindTexture(); + this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + + if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { + GL20.glUseProgram(SHADER_ALPHA.getProgram()); + GL20.glUniform1f(GL20.glGetUniformLocation(SHADER_ALPHA.getProgram(), "alpha_multiplier"), ConfigurationHandler.alpha); + } + GL11.glCallList(this.glList + renderPass); + if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { + GL20.glUseProgram(0); + } + + this.profiler.endStartSection("highlight"); + GL11.glCallList(this.glListHighlight + renderPass); + this.profiler.endStartSection("tileEntities"); renderTileEntities(renderPass); @@ -374,91 +384,4 @@ public void renderTileEntities(int renderPass) { Reference.logger.error("Failed to render tile entities!", ex); } } - - private void bindTexture() { - if (!ConfigurationHandler.enableAlpha) { - this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - return; - } - - // TODO: work out alpha for multiple resource packs - this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - /* - String resourcePackName = this.minecraft.getResourcePackRepository().getResourcePackName(); - - if (!resourcePacks.containsKey(resourcePackName)) { - String texturePackFileName = resourcePackName.replaceAll("(?i)[^a-z0-9]", "_") + "-" + (int) (this.settings.alpha * 255) + ".png"; - - try { - File outputfile = new File("assets/" + texturePackFileName); - - ResourceManager manager = this.minecraft.getResourceManager(); - - Icon icon = Block.dirt.getIcon(0, 0); - float deltaU = icon.getMaxU() - icon.getMinU(); - float deltaV = icon.getMaxV() - icon.getMinV(); - - int width = (int) Math.pow(2, Math.round(Math.log(icon.getIconWidth() / deltaU) / Math.log(2))); - int height = (int) Math.pow(2, Math.round(Math.log(icon.getIconHeight() / deltaV) / Math.log(2))); - - BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - - Map map = (Map) this.fieldMapTexturesStiched.get(this.minecraft.renderEngine.getTexture(TextureMap.locationBlocksTexture)); - if (map == null) { - resourcePacks.put(resourcePackName, TextureMap.locationBlocksTexture); - return; - } - - Collection sprites = map.values(); - - for (TextureAtlasSprite sprite : sprites) { - ResourceLocation resourcelocation = new ResourceLocation(ForgeHooksClient.fixDomain("textures/blocks/", sprite.getIconName()) + ".png"); - - try { - sprite.load(manager, resourcelocation); - } catch (RuntimeException ignored) { - } catch (IOException ignored) { - } - } - - for (TextureAtlasSprite sprite : sprites) { - if (sprite.getFrameCount() != 0) { - int[] data = sprite.getFrameTextureData(0); - int offsetX = sprite.getOriginX(); - int offsetY = sprite.getOriginY(); - - int x, y; - int color, alpha, index = 0; - - for (y = 0; y < sprite.getIconHeight(); y++) { - for (x = 0; x < sprite.getIconWidth(); x++) { - color = data[index++]; - alpha = (color >> 24) & 0xFF; - alpha *= this.settings.alpha; - color = (color & 0x00FFFFFF) | (alpha << 24); - bufferedImage.setRGB(offsetX + x, offsetY + y, color); - } - } - } - } - - ImageIO.write(bufferedImage, "png", outputfile); - - for (TextureAtlasSprite sprite : sprites) { - if (!sprite.hasAnimationMetadata()) { - sprite.clearFramesTextureData(); - } - } - - resourcePacks.put(resourcePackName, new ResourceLocation(texturePackFileName)); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - if (resourcePacks.containsKey(resourcePackName)) { - this.minecraft.renderEngine.bindTexture(resourcePacks.get(resourcePackName)); - } - */ - } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java new file mode 100644 index 00000000..21b1309a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java @@ -0,0 +1,124 @@ +package com.github.lunatrius.schematica.client.renderer.shader; + +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class ShaderProgram { + private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); + + private int program; + + public ShaderProgram(String domain, String vertShaderFilename, String fragShaderFilename) { + try { + init(domain, vertShaderFilename, fragShaderFilename); + if (this.program > 0) { + GL20.glUseProgram(this.program); + GL20.glUniform1i(GL20.glGetUniformLocation(this.program, "texture"), 0); + GL20.glUseProgram(0); + } + } catch (Exception e) { + Reference.logger.error("Could not initialize shader program!", e); + this.program = 0; + } + } + + private void init(String domain, String vertShaderFilename, String fragShaderFilename) { + if (!OpenGlHelper.shadersSupported) { + this.program = 0; + return; + } + + this.program = GL20.glCreateProgram(); + + int vertShader = loadAndCompileShader(domain, vertShaderFilename, GL20.GL_VERTEX_SHADER); + int fragShader = loadAndCompileShader(domain, fragShaderFilename, GL20.GL_FRAGMENT_SHADER); + + if (vertShader != 0) { + GL20.glAttachShader(this.program, vertShader); + } + + if (fragShader != 0) { + GL20.glAttachShader(this.program, fragShader); + } + + GL20.glLinkProgram(this.program); + + if (GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) { + Reference.logger.error(String.format("Could not link shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); + GL20.glDeleteProgram(this.program); + this.program = 0; + return; + } + + GL20.glValidateProgram(this.program); + + if (GL20.glGetProgrami(this.program, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) { + Reference.logger.error(String.format("Could not validate shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); + GL20.glDeleteProgram(this.program); + this.program = 0; + } + } + + private int loadAndCompileShader(String domain, String filename, int shaderType) { + if (filename == null) { + return 0; + } + + final int handle = GL20.glCreateShader(shaderType); + + if (handle == 0) { + Reference.logger.error(String.format("Could not create shader of type %d for %s: %s", shaderType, filename, GL20.glGetProgramInfoLog(this.program, 1024))); + return 0; + } + + String code = loadFile(new ResourceLocation(domain, filename)); + if (code == null) { + GL20.glDeleteShader(handle); + return 0; + } + + GL20.glShaderSource(handle, code); + GL20.glCompileShader(handle); + + if (GL20.glGetShaderi(handle, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) { + Reference.logger.error(String.format("Could not compile shader %s: %s", filename, GL20.glGetShaderInfoLog(this.program, 1024))); + GL20.glDeleteShader(handle); + return 0; + } + + return handle; + } + + private String loadFile(ResourceLocation resourceLocation) { + try { + final StringBuilder code = new StringBuilder(); + final InputStream inputStream = MINECRAFT.getResourceManager().getResource(resourceLocation).getInputStream(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + + String line; + while ((line = reader.readLine()) != null) { + code.append(line); + code.append('\n'); + } + reader.close(); + + return code.toString(); + } catch (Exception e) { + Reference.logger.error("Could not load shader file!", e); + } + + return null; + } + + public int getProgram() { + return this.program; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 19d00601..b89c69a4 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -116,12 +116,10 @@ public static void init(File configFile) { private static void loadConfiguration() { propEnableAlpha = configuration.get(CATEGORY_RENDER, ALPHA_ENABLED, ENABLEALPHA_DEFAULT, ALPHA_ENABLED_DESC); propEnableAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA_ENABLED)); - propEnableAlpha.setShowInGui(false); enableAlpha = propEnableAlpha.getBoolean(ENABLEALPHA_DEFAULT); propAlpha = configuration.get(CATEGORY_RENDER, ALPHA, ALPHA_DEFAULT, ALPHA_DESC, 0.0, 1.0); propAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA)); - propAlpha.setShowInGui(false); alpha = (float) propAlpha.getDouble(ALPHA_DEFAULT); propHighlight = configuration.get(CATEGORY_RENDER, HIGHLIGHT, HIGHLIGHT_DEFAULT, HIGHLIGHT_DESC); diff --git a/src/main/resources/assets/schematica/shaders/alpha.frag b/src/main/resources/assets/schematica/shaders/alpha.frag new file mode 100644 index 00000000..155116b9 --- /dev/null +++ b/src/main/resources/assets/schematica/shaders/alpha.frag @@ -0,0 +1,9 @@ +#version 120 + +uniform sampler2D texture; +uniform float alpha_multiplier; + +void main() { + vec4 tex = texture2D(texture, gl_TexCoord[0].xy) * gl_Color; + gl_FragColor = vec4(tex.r, tex.g, tex.b, tex.a * alpha_multiplier); +} From 613869de280e134399ff2d8198488433155faa02 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 27 Aug 2014 21:59:58 +0200 Subject: [PATCH 080/314] Bumped version number. --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 651db73a..1cf93c07 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ version.major=1 version.minor=7 -version.micro=1 +version.micro=2 version.minecraft=1.7.10 version.forge=10.13.0.1187 version.minforge=10.13.0.1185 From 8e0762b55f9ceb2f0f0f31450d0872f41f2265ca Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 28 Aug 2014 12:57:35 +0200 Subject: [PATCH 081/314] Fixed the printer crashing other mods. Yay deprecated code! Fixes #47 --- .../java/com/github/lunatrius/schematica/SchematicPrinter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 4aa69a1f..7a4c1f1b 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -312,7 +312,7 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player int side = direction.getOpposite().ordinal(); /* copypasted from n.m.client.Minecraft to sooth finicky servers */ - success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, x, y, z, side).isCanceled(); + success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, x, y, z, side, world).isCanceled(); if (success) { // still not assured! success = minecraft.playerController.onPlayerRightClick(player, world, itemStack, x, y, z, side, Vec3.createVectorHelper(x + offsetX, y + offsetY, z + offsetZ)); From a7aeea9ba7cae52f8ea4b0fb21326f671dd99859 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 28 Aug 2014 23:58:00 +0200 Subject: [PATCH 082/314] Moved a few methods into SchematicUtil. Added a fallback read (compressed, uncompressed). --- .../client/gui/GuiSchematicLoad.java | 3 +- .../schematica/proxy/ClientProxy.java | 3 +- .../schematica/world/SchematicWorld.java | 64 +--------------- .../world/schematic/SchematicAlpha.java | 2 +- .../world/schematic/SchematicFormat.java | 10 +-- .../world/schematic/SchematicUtil.java | 76 +++++++++++++++++++ 6 files changed, 86 insertions(+), 72 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index aeb70d82..3dfdbc43 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -144,7 +145,7 @@ protected void reloadSchematics() { for (File file : filesSchematics) { name = file.getName(); - this.schematicFiles.add(new GuiSchematicEntry(name, SchematicWorld.getIconFromFile(file), file.isDirectory())); + this.schematicFiles.add(new GuiSchematicEntry(name, SchematicUtil.getIconFromFile(file), file.isDirectory())); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 510c689a..31f6aed5 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -12,6 +12,7 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import cpw.mods.fml.client.config.GuiConfigEntries; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; @@ -209,7 +210,7 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam } SchematicWorld schematic = getSchematicFromWorld(world, from, to); - schematic.setIcon(SchematicWorld.getIconFromName(iconName)); + schematic.setIcon(SchematicUtil.getIconFromName(iconName)); SchematicFormat.writeToFile(directory, filename, schematic); return true; diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 59d7d95b..ac026bcb 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -4,6 +4,7 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -18,8 +19,6 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntitySkull; @@ -33,9 +32,6 @@ import net.minecraft.world.storage.SaveHandlerMP; import net.minecraftforge.common.util.ForgeDirection; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -109,63 +105,7 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L } public SchematicWorld(String iconName, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { - this(getIconFromName(iconName), blocks, metadata, tileEntities, width, height, length); - } - - public static ItemStack getIconFromName(String iconName) { - ItemStack icon; - String name = ""; - int damage = 0; - - String[] parts = iconName.split(","); - if (parts.length >= 1) { - name = parts[0]; - if (parts.length >= 2) { - try { - damage = Integer.parseInt(parts[1]); - } catch (NumberFormatException ignored) { - } - } - } - - icon = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, damage); - if (icon.getItem() != null) { - return icon; - } - - icon = new ItemStack(GameData.getItemRegistry().getObject(name), 1, damage); - if (icon.getItem() != null) { - return icon; - } - - return SchematicWorld.DEFAULT_ICON.copy(); - } - - public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { - ItemStack icon = SchematicWorld.DEFAULT_ICON.copy(); - - if (tagCompound != null && tagCompound.hasKey("Icon")) { - icon.readFromNBT(tagCompound.getCompoundTag("Icon")); - - if (icon.getItem() == null) { - icon = SchematicWorld.DEFAULT_ICON.copy(); - } - } - - return icon; - } - - public static ItemStack getIconFromFile(File file) { - try { - InputStream stream = new FileInputStream(file); - NBTTagCompound tagCompound = CompressedStreamTools.readCompressed(stream); - - return getIconFromNBT(tagCompound); - } catch (Exception e) { - Reference.logger.error("Failed to read schematic icon!", e); - } - - return SchematicWorld.DEFAULT_ICON.copy(); + this(SchematicUtil.getIconFromName(iconName), blocks, metadata, tileEntities, width, height, length); } private void generateBlockList() { diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 86d6a16e..63117579 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -33,7 +33,7 @@ public class SchematicAlpha extends SchematicFormat { @Override public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { - ItemStack icon = SchematicWorld.getIconFromNBT(tagCompound); + ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); byte localBlocks[] = tagCompound.getByteArray(BLOCKS); byte localMetadata[] = tagCompound.getByteArray(DATA); diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 76a1fdc0..a702a439 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -2,14 +2,11 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import java.io.DataOutputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.zip.GZIPOutputStream; @@ -27,10 +24,9 @@ public abstract class SchematicFormat { public static SchematicWorld readFromFile(File file) { try { - InputStream stream = new FileInputStream(file); - NBTTagCompound tagCompound = CompressedStreamTools.readCompressed(stream); - String format = tagCompound.getString(MATERIALS); - SchematicFormat schematicFormat = FORMATS.get(format); + final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); + final String format = tagCompound.getString(MATERIALS); + final SchematicFormat schematicFormat = FORMATS.get(format); if (schematicFormat == null) { throw new UnsupportedFormatException(format); diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java new file mode 100644 index 00000000..cb21b11c --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -0,0 +1,76 @@ +package com.github.lunatrius.schematica.world.schematic; + +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.registry.GameData; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +public final class SchematicUtil { + public static NBTTagCompound readTagCompoundFromFile(File file) throws IOException { + try { + return CompressedStreamTools.readCompressed(new FileInputStream(file)); + } catch (Exception ex) { + Reference.logger.warn("Failed compressed read, trying normal read...", ex); + return CompressedStreamTools.read(file); + } + } + + public static ItemStack getIconFromName(String iconName) { + ItemStack icon; + String name = ""; + int damage = 0; + + String[] parts = iconName.split(","); + if (parts.length >= 1) { + name = parts[0]; + if (parts.length >= 2) { + try { + damage = Integer.parseInt(parts[1]); + } catch (NumberFormatException ignored) { + } + } + } + + icon = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, damage); + if (icon.getItem() != null) { + return icon; + } + + icon = new ItemStack(GameData.getItemRegistry().getObject(name), 1, damage); + if (icon.getItem() != null) { + return icon; + } + + return SchematicWorld.DEFAULT_ICON.copy(); + } + + public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { + ItemStack icon = SchematicWorld.DEFAULT_ICON.copy(); + + if (tagCompound != null && tagCompound.hasKey("Icon")) { + icon.readFromNBT(tagCompound.getCompoundTag("Icon")); + + if (icon.getItem() == null) { + icon = SchematicWorld.DEFAULT_ICON.copy(); + } + } + + return icon; + } + + public static ItemStack getIconFromFile(File file) { + try { + return getIconFromNBT(readTagCompoundFromFile(file)); + } catch (Exception e) { + Reference.logger.error("Failed to read schematic icon!", e); + } + + return SchematicWorld.DEFAULT_ICON.copy(); + } +} From e8f3a73a045f6317eefb0d856cd9f6b8869b7bc3 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 4 Sep 2014 17:36:37 +0200 Subject: [PATCH 083/314] Replaced Enable/Disable with OFF/ON. --- .../lunatrius/schematica/client/gui/GuiSchematicControl.java | 4 ++-- .../lunatrius/schematica/client/gui/GuiSchematicSave.java | 4 ++-- src/main/resources/assets/schematica/lang/ca_ES.lang | 4 ++-- src/main/resources/assets/schematica/lang/cs_CZ.lang | 4 ++-- src/main/resources/assets/schematica/lang/da_DK.lang | 4 ++-- src/main/resources/assets/schematica/lang/de_DE.lang | 4 ++-- src/main/resources/assets/schematica/lang/en_GB.lang | 4 ++-- src/main/resources/assets/schematica/lang/en_PT.lang | 4 ++-- src/main/resources/assets/schematica/lang/en_US.lang | 4 ++-- src/main/resources/assets/schematica/lang/es_ES.lang | 4 ++-- src/main/resources/assets/schematica/lang/es_MX.lang | 4 ++-- src/main/resources/assets/schematica/lang/fi_FI.lang | 4 ++-- src/main/resources/assets/schematica/lang/fr_FR.lang | 4 ++-- src/main/resources/assets/schematica/lang/hu_HU.lang | 4 ++-- src/main/resources/assets/schematica/lang/it_IT.lang | 4 ++-- src/main/resources/assets/schematica/lang/ko_KR.lang | 4 ++-- src/main/resources/assets/schematica/lang/la_LA.lang | 4 ++-- src/main/resources/assets/schematica/lang/lt_LT.lang | 4 ++-- src/main/resources/assets/schematica/lang/nl_NL.lang | 4 ++-- src/main/resources/assets/schematica/lang/no_NO.lang | 4 ++-- src/main/resources/assets/schematica/lang/pl_PL.lang | 4 ++-- src/main/resources/assets/schematica/lang/pt_PT.lang | 4 ++-- src/main/resources/assets/schematica/lang/ru_RU.lang | 4 ++-- src/main/resources/assets/schematica/lang/sk_SK.lang | 4 ++-- src/main/resources/assets/schematica/lang/sl_SI.lang | 4 ++-- src/main/resources/assets/schematica/lang/th_TH.lang | 4 ++-- src/main/resources/assets/schematica/lang/tr_TR.lang | 4 ++-- src/main/resources/assets/schematica/lang/uk_UA.lang | 4 ++-- src/main/resources/assets/schematica/lang/zh_CN.lang | 4 ++-- 29 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index b0b2d86e..34e7a5d4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -121,7 +121,7 @@ public void initGui() { this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, I18n.format("schematica.gui.materials")); this.buttonList.add(this.btnMaterials); - this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, I18n.format(this.printer.isPrinting() ? "schematica.gui.disable" : "schematica.gui.enable")); + this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, I18n.format(this.printer.isPrinting() ? "schematica.gui.on" : "schematica.gui.off")); this.buttonList.add(this.btnPrint); this.btnDecX.enabled = this.schematic != null; @@ -208,7 +208,7 @@ protected void actionPerformed(GuiButton guiButton) { this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); } else if (guiButton.id == this.btnPrint.id && this.printer.isEnabled()) { boolean isPrinting = this.printer.togglePrinting(); - this.btnPrint.displayString = I18n.format(isPrinting ? "schematica.gui.disable" : "schematica.gui.enable"); + this.btnPrint.displayString = I18n.format(isPrinting ? "schematica.gui.on" : "schematica.gui.off"); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index b85c597d..760bf506 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -135,7 +135,7 @@ public void initGui() { this.btnIncBZ = new GuiButton(id++, this.centerX + 100, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); this.buttonList.add(this.btnIncBZ); - this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable")); + this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off")); this.buttonList.add(this.btnEnable); this.tfFilename = new GuiTextField(this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); @@ -213,7 +213,7 @@ protected void actionPerformed(GuiButton guiButton) { this.btnAmountBZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ]); } else if (guiButton.id == this.btnEnable.id) { ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; - this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.disable" : "schematica.gui.enable"); + this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off"); this.btnSave.enabled = ClientProxy.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index a723d555..03f9db54 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operacions schematica.gui.point.red=Punt Vermell schematica.gui.point.blue=Punt Blau schematica.gui.saveselection=Guardar la selecció com un esquema -schematica.gui.enable=Activar -schematica.gui.disable=Desactivar +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 7e5f8e7e..0a1f696a 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operace schematica.gui.point.red=Rudý bod schematica.gui.point.blue=Modrý bod schematica.gui.saveselection=Uložit výběr jako schéma -schematica.gui.enable=Zapnout -schematica.gui.disable=Vypnout +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index ddb93129..b8200483 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operationer schematica.gui.point.red=Rødt punkt schematica.gui.point.blue=Blåt punkt schematica.gui.saveselection=Gem markeringen som en schematic -schematica.gui.enable=Slå til -schematica.gui.disable=Slå fra +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index afa0446b..ad3f346f 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Aktionen schematica.gui.point.red=Roter Punkt schematica.gui.point.blue=Blauer Punkt schematica.gui.saveselection=Auswahl als Schematic speichern -schematica.gui.enable=Einschalten -schematica.gui.disable=Ausschalten +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index b441935a..313f1c70 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operations schematica.gui.point.red=Red point schematica.gui.point.blue=Blue point schematica.gui.saveselection=Save the selection as a schematic -schematica.gui.enable=Enable -schematica.gui.disable=Disable +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 12b1ffc8..ad6f047f 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Plans schematica.gui.point.red=Red dot schematica.gui.point.blue=Blue dot schematica.gui.saveselection=Save it as a blueprint -schematica.gui.enable=Work -schematica.gui.disable=Break +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index c13c3c14..a26ad3b2 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operations schematica.gui.point.red=Red point schematica.gui.point.blue=Blue point schematica.gui.saveselection=Save the selection as a schematic -schematica.gui.enable=Enable -schematica.gui.disable=Disable +schematica.gui.on=ON +schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 076abfeb..0763e6c1 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Acciones schematica.gui.point.red=Punto rojo schematica.gui.point.blue=Punto Azul schematica.gui.saveselection=Guardar selección como esquema -schematica.gui.enable=Activar -schematica.gui.disable=Desactivar +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index c1fc1a19..cf688f2c 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operaciones schematica.gui.point.red=Punto rojo schematica.gui.point.blue=Punto azul schematica.gui.saveselection=Guardar lo seleccionado como un esquema -schematica.gui.enable=Activar -schematica.gui.disable=Desactivar +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 86b4ccc2..8096bec8 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Toiminnot schematica.gui.point.red=Punainen piste schematica.gui.point.blue=Sininen piste schematica.gui.saveselection=Tallenna valinta kaavana -schematica.gui.enable=Ota käyttöön -schematica.gui.disable=Poista käytöstä +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index b05941ca..41b58df3 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Opérations schematica.gui.point.red=Point rouge schematica.gui.point.blue=Point bleu schematica.gui.saveselection=Sauvegarder la sélection en tant que schematic -schematica.gui.enable=Activer -schematica.gui.disable=Désactiver +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X : schematica.gui.y=Y : schematica.gui.z=Z : diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index f7737d8e..8f769695 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Műveletek schematica.gui.point.red=Piros pont schematica.gui.point.blue=Kék pont schematica.gui.saveselection=Kijelölés mentése kliséként -schematica.gui.enable=Bekapcsol -schematica.gui.disable=Kikapcsol +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 3b2a4f17..91a5be42 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operazioni schematica.gui.point.red=Punto rosso schematica.gui.point.blue=Punto blu schematica.gui.saveselection=Salva la selezione come schematica -schematica.gui.enable=Abilita -schematica.gui.disable=Disabilita +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index d6112ea1..b9bbd202 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -19,8 +19,8 @@ schematica.gui.operations=동작 schematica.gui.point.red=빨간 점 schematica.gui.point.blue=푸른 점 schematica.gui.saveselection=선택 영역을 schematic으로 저장 -schematica.gui.enable=활성화 -schematica.gui.disable=비활성화 +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 6a2cb2a3..a3bb7fb0 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -19,8 +19,8 @@ schematica.gui.show=Ostende schematica.gui.point.red=Rubra res schematica.gui.point.blue=Caerulea res # schematica.gui.saveselection=Save the selection as a schematic -# schematica.gui.enable=Enable -# schematica.gui.disable=Disable +# schematica.gui.on=ON +# schematica.gui.off=OFF # schematica.gui.x=X: # schematica.gui.y=Y: # schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 0438c2f7..2fdcec02 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Veiksmas schematica.gui.point.red=Raudonasis taðkas schematica.gui.point.blue=Mëlynasis taðkas schematica.gui.saveselection=Iðsaugoti paþymëta plotà kaip schemà? -schematica.gui.enable=Ájungti -schematica.gui.disable=Iðjungti +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 4cf6e4c6..8d26c2bb 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Handelingen schematica.gui.point.red=Rood punt schematica.gui.point.blue=Blauw punt schematica.gui.saveselection=Sla de selectie op als schematic -schematica.gui.enable=Inschakelen -schematica.gui.disable=Uitschakelen +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 09100c5c..bcf3498a 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operasjoner schematica.gui.point.red=Rødt punkt schematica.gui.point.blue=Blått punkt schematica.gui.saveselection=Lagre utvalget som en tegning -schematica.gui.enable=Aktiver -schematica.gui.disable=Deaktiver +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 99695d87..496d4a7c 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operacje schematica.gui.point.red=Czerwony znacznik schematica.gui.point.blue=Niebieski znacznik schematica.gui.saveselection=Zapisz zaznaczenie jako schemat -schematica.gui.enable=Wlacz -schematica.gui.disable=Wylacz +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 6cdad7ca..2f4478a7 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operaçőes schematica.gui.point.red=Ponto Vermelho schematica.gui.point.blue=Ponto Azul schematica.gui.saveselection=Guardar selecçăo como uma schematica -schematica.gui.enable=Habilitar -schematica.gui.disable=Desabilitar +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 41fe9f04..c4f7e2b5 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Операции schematica.gui.point.red=Красная точка schematica.gui.point.blue=Синяя точка schematica.gui.saveselection=Сохранить схему выделенной области -schematica.gui.enable=Включить -schematica.gui.disable=Выключить +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 0228c923..18889dbe 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operácie schematica.gui.point.red=Červený bod schematica.gui.point.blue=Modrý bod schematica.gui.saveselection=Uložiť výber ako schému -schematica.gui.enable=Povoliť -schematica.gui.disable=Zakázať +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index 10e0fdd4..de49a27f 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operacije schematica.gui.point.red=Rdeča točka schematica.gui.point.blue=Modra točka schematica.gui.saveselection=Shrani izbrano območje kot shemo -schematica.gui.enable=Omogoči -schematica.gui.disable=Onemogoči +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index eb44f122..f464c2de 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -19,8 +19,8 @@ schematica.gui.operations=การดำเนินงาน schematica.gui.point.red=จุดแดง schematica.gui.point.blue=จุดน้ำเงิน schematica.gui.saveselection=บันทึกจุดที่เลือกไปยัง Schematic -schematica.gui.enable=เปิด -schematica.gui.disable=ปิด +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 4e9bbd5f..40f73b79 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -19,8 +19,8 @@ schematica.gui.operations=İşlemler schematica.gui.point.red=Kırmızı nokta schematica.gui.point.blue=Mavi nokta schematica.gui.saveselection=Seçimi şematik olarak kaydet -schematica.gui.enable=Etkin -schematica.gui.disable=Devre Dışı +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index ddf2b7f8..1c0f098b 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Операції schematica.gui.point.red=Червона мітка schematica.gui.point.blue=Синя мітка schematica.gui.saveselection=Зберегти виділену технологічну схему -schematica.gui.enable=Увімкнути -schematica.gui.disable=Вимкнути +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=Х: schematica.gui.y=Y: schematica.gui.z=Z: diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 887816c0..0972b1e7 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -19,8 +19,8 @@ schematica.gui.operations=操作 schematica.gui.point.red=红点 schematica.gui.point.blue=蓝点 schematica.gui.saveselection=将选区保存为Schematic文件 -schematica.gui.enable=启用 -schematica.gui.disable=禁用 +# schematica.gui.on=ON +# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: From 504c66b7eb6ef8d018aaa194e9bfcf81f029eecd Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 4 Sep 2014 20:38:22 +0200 Subject: [PATCH 084/314] Refactored all constant strings into the Names class. --- .../schematica/client/gui/GuiModConfig.java | 3 +- .../client/gui/GuiSchematicMaterialsSlot.java | 5 +- .../schematica/config/BlockInfo.java | 11 +- .../handler/ConfigurationHandler.java | 100 ++++++------------ .../handler/client/ChatEventHandler.java | 10 +- .../lunatrius/schematica/reference/Names.java | 78 ++++++++++++++ .../world/schematic/SchematicAlpha.java | 60 +++++------ .../world/schematic/SchematicFormat.java | 14 ++- .../world/schematic/SchematicUtil.java | 5 +- .../assets/schematica/lang/en_US.lang | 1 + 10 files changed, 158 insertions(+), 129 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/reference/Names.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java index ceb95234..7b6955a4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.client.config.GuiConfig; import cpw.mods.fml.client.config.IConfigElement; @@ -18,7 +19,7 @@ public GuiModConfig(GuiScreen guiScreen) { private static List getConfigElements() { List elements = new ArrayList(); for (String name : ConfigurationHandler.configuration.getCategoryNames()) { - elements.add(new ConfigElement(ConfigurationHandler.configuration.getCategory(name).setLanguageKey(String.format("%s.category.%s", ConfigurationHandler.LANG_PREFIX, name)))); + elements.add(new ConfigElement(ConfigurationHandler.configuration.getCategory(name).setLanguageKey(Names.Config.LANG_PREFIX + ".category." + name))); } return elements; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index 3ec9d878..052d628e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -3,6 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; class GuiSchematicMaterialsSlot extends GuiSlot { @@ -12,6 +13,8 @@ class GuiSchematicMaterialsSlot extends GuiSlot { protected int selectedIndex = -1; + private final String strUnknownBlock = I18n.format("schematica.gui.unknownblock"); + public GuiSchematicMaterialsSlot(GuiSchematicMaterials par1) { super(Minecraft.getMinecraft(), par1.width, par1.height, 16, par1.height - 34, 24); this.guiSchematicMaterials = par1; @@ -51,7 +54,7 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat if (itemStack != null && itemStack.getItem() != null) { itemName = itemStack.getItem().getItemStackDisplayName(itemStack); } else { - itemName = "Unknown"; + itemName = this.strUnknownBlock; } GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, itemStack); diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index e06ba6e9..995afdad 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.config; +import com.github.lunatrius.schematica.reference.Names; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; @@ -26,15 +27,13 @@ import static com.github.lunatrius.schematica.config.PlacementData.PlacementType; public class BlockInfo { - public static final String MINECRAFT = "minecraft"; - public static final List BLOCK_LIST_IGNORE_BLOCK = new ArrayList(); public static final List BLOCK_LIST_IGNORE_METADATA = new ArrayList(); public static final Map BLOCK_ITEM_MAP = new HashMap(); public static final Map CLASS_PLACEMENT_MAP = new HashMap(); public static final Map ITEM_PLACEMENT_MAP = new HashMap(); - private static String modId = MINECRAFT; + private static String modId = Names.ModId.MINECRAFT; public static void setModId(String modId) { BlockInfo.modId = modId; @@ -61,7 +60,7 @@ private static boolean addIgnoredBlock(Block block) { } private static boolean addIgnoredBlock(String blockName) { - if (!MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { return false; } @@ -152,7 +151,7 @@ private static boolean addIgnoredBlockMetadata(Block block) { } private static boolean addIgnoredBlockMetadata(String blockName) { - if (!MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { return false; } @@ -210,7 +209,7 @@ private static Item addBlockItemMapping(Block block, Block item) { } private static Item addBlockItemMapping(Object blockObj, Object itemObj) { - if (!MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index b89c69a4..c453c9da 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.handler; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.google.common.primitives.Ints; import cpw.mods.fml.client.event.ConfigChangedEvent; @@ -16,45 +17,6 @@ public class ConfigurationHandler { public static final String VERSION = "1"; - public static final String CATEGORY_RENDER = "render"; - public static final String CATEGORY_PRINTER = "printer"; - public static final String CATEGORY_GENERAL = "general"; - - public static final String ALPHA_ENABLED = "alphaEnabled"; - public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; - public static final String ALPHA = "alpha"; - public static final String ALPHA_DESC = "Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent)."; - public static final String HIGHLIGHT = "highlight"; - public static final String HIGHLIGHT_DESC = "Highlight invalid placed blocks and to be placed blocks."; - public static final String HIGHLIGHT_AIR = "highlightAir"; - public static final String HIGHLIGHT_AIR_DESC = "Highlight blocks that should be air."; - public static final String BLOCK_DELTA = "blockDelta"; - public static final String BLOCK_DELTA_DESC = "Delta value used for highlighting (if you experience z-fighting increase this)."; - public static final String DRAW_QUADS = "drawQuads"; - public static final String DRAW_QUADS_DESC = "Draw surface areas."; - public static final String DRAW_LINES = "drawLines"; - public static final String DRAW_LINES_DESC = "Draw outlines."; - - public static final String PLACE_DELAY = "placeDelay"; - public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; - public static final String TIMEOUT = "timeout"; - public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; - public static final String PLACE_INSTANTLY = "placeInstantly"; - public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; - public static final String DESTROY_BLOCKS = "destroyBlocks"; - public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks (creative mode only)."; - public static final String DESTROY_INSTANTLY = "destroyInstantly"; - public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; - public static final String PLACE_ADJACENT = "placeAdjacent"; - public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; - public static final String SWAP_SLOTS = "swapSlots"; - public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; - - public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; - public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; - - public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; - public static Configuration configuration; public static final boolean ENABLEALPHA_DEFAULT = false; @@ -114,60 +76,60 @@ public static void init(File configFile) { } private static void loadConfiguration() { - propEnableAlpha = configuration.get(CATEGORY_RENDER, ALPHA_ENABLED, ENABLEALPHA_DEFAULT, ALPHA_ENABLED_DESC); - propEnableAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA_ENABLED)); + propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLEALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); + propEnableAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA_ENABLED); enableAlpha = propEnableAlpha.getBoolean(ENABLEALPHA_DEFAULT); - propAlpha = configuration.get(CATEGORY_RENDER, ALPHA, ALPHA_DEFAULT, ALPHA_DESC, 0.0, 1.0); - propAlpha.setLanguageKey(String.format("%s.%s", LANG_PREFIX, ALPHA)); + propAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA, ALPHA_DEFAULT, Names.Config.ALPHA_DESC, 0.0, 1.0); + propAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA); alpha = (float) propAlpha.getDouble(ALPHA_DEFAULT); - propHighlight = configuration.get(CATEGORY_RENDER, HIGHLIGHT, HIGHLIGHT_DEFAULT, HIGHLIGHT_DESC); - propHighlight.setLanguageKey(String.format("%s.%s", LANG_PREFIX, HIGHLIGHT)); + propHighlight = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT, HIGHLIGHT_DEFAULT, Names.Config.HIGHLIGHT_DESC); + propHighlight.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT); highlight = propHighlight.getBoolean(HIGHLIGHT_DEFAULT); - propHighlightAir = configuration.get(CATEGORY_RENDER, HIGHLIGHT_AIR, HIGHLIGHTAIR_DEFAULT, HIGHLIGHT_AIR_DESC); - propHighlightAir.setLanguageKey(String.format("%s.%s", LANG_PREFIX, HIGHLIGHT_AIR)); + propHighlightAir = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT_AIR, HIGHLIGHTAIR_DEFAULT, Names.Config.HIGHLIGHT_AIR_DESC); + propHighlightAir.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT_AIR); highlightAir = propHighlightAir.getBoolean(HIGHLIGHTAIR_DEFAULT); - propBlockDelta = configuration.get(CATEGORY_RENDER, BLOCK_DELTA, BLOCKDELTA_DEFAULT, BLOCK_DELTA_DESC, 0.0, 0.2); - propBlockDelta.setLanguageKey(String.format("%s.%s", LANG_PREFIX, BLOCK_DELTA)); + propBlockDelta = configuration.get(Names.Config.Category.RENDER, Names.Config.BLOCK_DELTA, BLOCKDELTA_DEFAULT, Names.Config.BLOCK_DELTA_DESC, 0.0, 0.2); + propBlockDelta.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.BLOCK_DELTA); blockDelta = (float) propBlockDelta.getDouble(BLOCKDELTA_DEFAULT); - propDrawQuads = configuration.get(CATEGORY_RENDER, DRAW_QUADS, DRAWQUADS_DEFAULT, DRAW_QUADS_DESC); - propDrawQuads.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DRAW_QUADS)); + propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAWQUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); + propDrawQuads.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_QUADS); drawQuads = propDrawQuads.getBoolean(DRAWQUADS_DEFAULT); - propDrawLines = configuration.get(CATEGORY_RENDER, DRAW_LINES, DRAWLINES_DEFAULT, DRAW_LINES_DESC); - propDrawLines.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DRAW_LINES)); + propDrawLines = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_LINES, DRAWLINES_DEFAULT, Names.Config.DRAW_LINES_DESC); + propDrawLines.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_LINES); drawLines = propDrawLines.getBoolean(DRAWLINES_DEFAULT); - propPlaceDelay = configuration.get(CATEGORY_PRINTER, PLACE_DELAY, PLACEDELAY_DEFAULT, PLACE_DELAY_DESC, 0, 20); - propPlaceDelay.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_DELAY)); + propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACEDELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); + propPlaceDelay.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DELAY); placeDelay = propPlaceDelay.getInt(PLACEDELAY_DEFAULT); - propTimeout = configuration.get(CATEGORY_PRINTER, TIMEOUT, TIMEOUT_DEFAULT, TIMEOUT_DESC, 0, 100); - propTimeout.setLanguageKey(String.format("%s.%s", LANG_PREFIX, TIMEOUT)); + propTimeout = configuration.get(Names.Config.Category.PRINTER, Names.Config.TIMEOUT, TIMEOUT_DEFAULT, Names.Config.TIMEOUT_DESC, 0, 100); + propTimeout.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TIMEOUT); timeout = propTimeout.getInt(TIMEOUT_DEFAULT); - propPlaceInstantly = configuration.get(CATEGORY_PRINTER, PLACE_INSTANTLY, PLACEINSTANTLY_DEFAULT, PLACE_INSTANTLY_DESC); - propPlaceInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_INSTANTLY)); + propPlaceInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_INSTANTLY, PLACEINSTANTLY_DEFAULT, Names.Config.PLACE_INSTANTLY_DESC); + propPlaceInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_INSTANTLY); placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); - propDestroyBlocks = configuration.get(CATEGORY_PRINTER, DESTROY_BLOCKS, DESTROYBLOCKS_DEFAULT, DESTROY_BLOCKS_DESC); - propDestroyBlocks.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DESTROY_BLOCKS)); + propDestroyBlocks = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_BLOCKS, DESTROYBLOCKS_DEFAULT, Names.Config.DESTROY_BLOCKS_DESC); + propDestroyBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_BLOCKS); destroyBlocks = propDestroyBlocks.getBoolean(DESTROYBLOCKS_DEFAULT); - propDestroyInstantly = configuration.get(CATEGORY_PRINTER, DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, DESTROY_INSTANTLY_DESC); - propDestroyInstantly.setLanguageKey(String.format("%s.%s", LANG_PREFIX, DESTROY_INSTANTLY)); + propDestroyInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, Names.Config.DESTROY_INSTANTLY_DESC); + propDestroyInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_INSTANTLY); destroyInstantly = propDestroyInstantly.getBoolean(DESTROYINSTANTLY_DEFAULT); - propPlaceAdjacent = configuration.get(CATEGORY_PRINTER, PLACE_ADJACENT, PLACEADJACENT_DEFAULT, PLACE_ADJACENT_DESC); - propPlaceAdjacent.setLanguageKey(String.format("%s.%s", LANG_PREFIX, PLACE_ADJACENT)); + propPlaceAdjacent = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_ADJACENT, PLACEADJACENT_DEFAULT, Names.Config.PLACE_ADJACENT_DESC); + propPlaceAdjacent.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_ADJACENT); placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); - propSwapSlots = configuration.get(CATEGORY_PRINTER, SWAP_SLOTS, SWAPSLOTS_DEFAULT, SWAP_SLOTS_DESC, 0, 8); - propSwapSlots.setLanguageKey(String.format("%s.%s", LANG_PREFIX, SWAP_SLOTS)); + propSwapSlots = configuration.get(Names.Config.Category.PRINTER, Names.Config.SWAP_SLOTS, SWAPSLOTS_DEFAULT, Names.Config.SWAP_SLOTS_DESC, 0, 8); + propSwapSlots.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SWAP_SLOTS); swapSlots = propSwapSlots.getIntList(); swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); @@ -177,8 +139,8 @@ private static void loadConfiguration() { Reference.logger.warn("Could not canonize file path!", e); } - propSchematicDirectory = configuration.get(CATEGORY_GENERAL, SCHEMATIC_DIRECTORY, schematicDirectory.getAbsolutePath().replace("\\", "/"), SCHEMATIC_DIRECTORY_DESC); - propSchematicDirectory.setLanguageKey(String.format("%s.%s", LANG_PREFIX, SCHEMATIC_DIRECTORY)); + propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, schematicDirectory.getAbsolutePath().replace("\\", "/"), Names.Config.SCHEMATIC_DIRECTORY_DESC); + propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); schematicDirectory = new File(propSchematicDirectory.getString()); if (configuration.hasChanged()) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index d6534ed7..125996d9 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -2,14 +2,12 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; public class ChatEventHandler { - public static final String SBC_DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; - public static final String SBC_DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; - public static final String SBC_DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; public static int chatLines = 0; @@ -19,15 +17,15 @@ public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { chatLines++; String message = event.message.getFormattedText(); Reference.logger.debug(String.format("Message #%d: %s", chatLines, message)); - if (message.contains(SBC_DISABLE_PRINTER)) { + if (message.contains(Names.SBC.DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); SchematicPrinter.INSTANCE.setEnabled(false); } - if (message.contains(SBC_DISABLE_SAVE)) { + if (message.contains(Names.SBC.DISABLE_SAVE)) { Reference.logger.info("Saving is disabled on this server."); Schematica.proxy.isSaveEnabled = false; } - if (message.contains(SBC_DISABLE_LOAD)) { + if (message.contains(Names.SBC.DISABLE_LOAD)) { Reference.logger.info("Loading is disabled on this server."); Schematica.proxy.isLoadEnabled = false; } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java new file mode 100644 index 00000000..fd58bd35 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -0,0 +1,78 @@ +package com.github.lunatrius.schematica.reference; + +@SuppressWarnings("HardCodedStringLiteral") +public final class Names { + public static final class Config { + public static final class Category { + public static final String RENDER = "render"; + public static final String PRINTER = "printer"; + public static final String GENERAL = "general"; + } + + public static final String ALPHA_ENABLED = "alphaEnabled"; + public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; + public static final String ALPHA = "alpha"; + public static final String ALPHA_DESC = "Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent)."; + public static final String HIGHLIGHT = "highlight"; + public static final String HIGHLIGHT_DESC = "Highlight invalid placed blocks and to be placed blocks."; + public static final String HIGHLIGHT_AIR = "highlightAir"; + public static final String HIGHLIGHT_AIR_DESC = "Highlight blocks that should be air."; + public static final String BLOCK_DELTA = "blockDelta"; + public static final String BLOCK_DELTA_DESC = "Delta value used for highlighting (if you experience z-fighting increase this)."; + public static final String DRAW_QUADS = "drawQuads"; + public static final String DRAW_QUADS_DESC = "Draw surface areas."; + public static final String DRAW_LINES = "drawLines"; + public static final String DRAW_LINES_DESC = "Draw outlines."; + + public static final String PLACE_DELAY = "placeDelay"; + public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; + public static final String TIMEOUT = "timeout"; + public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; + public static final String PLACE_INSTANTLY = "placeInstantly"; + public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; + public static final String DESTROY_BLOCKS = "destroyBlocks"; + public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks (creative mode only)."; + public static final String DESTROY_INSTANTLY = "destroyInstantly"; + public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; + public static final String PLACE_ADJACENT = "placeAdjacent"; + public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; + public static final String SWAP_SLOTS = "swapSlots"; + public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; + + public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; + public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; + + public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; + } + + public static final class ModId { + public static final String MINECRAFT = "minecraft"; + } + + public static final class NBT { + public static final String ROOT = "Schematic"; + + public static final String MATERIALS = "Materials"; + public static final String FORMAT_CLASSIC = "Classic"; + public static final String FORMAT_ALPHA = "Alpha"; + + public static final String ICON = "Icon"; + public static final String BLOCKS = "Blocks"; + public static final String DATA = "Data"; + public static final String ADD_BLOCKS = "AddBlocks"; + public static final String ADD_BLOCKS_SCHEMATICA = "Add"; + public static final String WIDTH = "Width"; + public static final String LENGTH = "Length"; + public static final String HEIGHT = "Height"; + public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it + public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; + public static final String TILE_ENTITIES = "TileEntities"; + public static final String ENTITIES = "Entities"; + } + + public static final class SBC { + public static final String DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; + public static final String DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; + public static final String DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 63117579..29a78687 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.registry.GameData; @@ -18,53 +19,40 @@ import java.util.Set; public class SchematicAlpha extends SchematicFormat { - public static final String ICON = "Icon"; - public static final String BLOCKS = "Blocks"; - public static final String DATA = "Data"; - public static final String ADD_BLOCKS = "AddBlocks"; - public static final String ADD_BLOCKS_SCHEMATICA = "Add"; - public static final String WIDTH = "Width"; - public static final String LENGTH = "Length"; - public static final String HEIGHT = "Height"; - public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it - public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; - public static final String TILE_ENTITIES = "TileEntities"; - public static final String ENTITIES = "Entities"; - @Override public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); - byte localBlocks[] = tagCompound.getByteArray(BLOCKS); - byte localMetadata[] = tagCompound.getByteArray(DATA); + byte localBlocks[] = tagCompound.getByteArray(Names.NBT.BLOCKS); + byte localMetadata[] = tagCompound.getByteArray(Names.NBT.DATA); boolean extra = false; byte extraBlocks[] = null; byte extraBlocksNibble[] = null; - if (tagCompound.hasKey(ADD_BLOCKS)) { + if (tagCompound.hasKey(Names.NBT.ADD_BLOCKS)) { extra = true; - extraBlocksNibble = tagCompound.getByteArray(ADD_BLOCKS); + extraBlocksNibble = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS); extraBlocks = new byte[extraBlocksNibble.length * 2]; for (int i = 0; i < extraBlocksNibble.length; i++) { extraBlocks[i * 2 + 0] = (byte) ((extraBlocksNibble[i] >> 4) & 0xF); extraBlocks[i * 2 + 1] = (byte) (extraBlocksNibble[i] & 0xF); } - } else if (tagCompound.hasKey(ADD_BLOCKS_SCHEMATICA)) { + } else if (tagCompound.hasKey(Names.NBT.ADD_BLOCKS_SCHEMATICA)) { extra = true; - extraBlocks = tagCompound.getByteArray(ADD_BLOCKS_SCHEMATICA); + extraBlocks = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS_SCHEMATICA); } - short width = tagCompound.getShort(WIDTH); - short length = tagCompound.getShort(LENGTH); - short height = tagCompound.getShort(HEIGHT); + short width = tagCompound.getShort(Names.NBT.WIDTH); + short length = tagCompound.getShort(Names.NBT.LENGTH); + short height = tagCompound.getShort(Names.NBT.HEIGHT); short[][][] blocks = new short[width][height][length]; byte[][][] metadata = new byte[width][height][length]; Short id = null; Map oldToNew = new HashMap(); - if (tagCompound.hasKey(MAPPING_SCHEMATICA)) { - NBTTagCompound mapping = tagCompound.getCompoundTag(MAPPING_SCHEMATICA); + if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { + NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); Set names = mapping.func_150296_c(); for (String name : names) { oldToNew.put(mapping.getShort(name), (short) GameData.getBlockRegistry().getId(name)); @@ -85,7 +73,7 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { } List tileEntities = new ArrayList(); - NBTTagList tileEntitiesList = tagCompound.getTagList(TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); + NBTTagList tileEntitiesList = tagCompound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tileEntitiesList.tagCount(); i++) { try { @@ -106,11 +94,11 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { NBTTagCompound tagCompoundIcon = new NBTTagCompound(); ItemStack icon = world.getIcon(); icon.writeToNBT(tagCompoundIcon); - tagCompound.setTag(ICON, tagCompoundIcon); + tagCompound.setTag(Names.NBT.ICON, tagCompoundIcon); - tagCompound.setShort(WIDTH, (short) world.getWidth()); - tagCompound.setShort(LENGTH, (short) world.getLength()); - tagCompound.setShort(HEIGHT, (short) world.getHeight()); + tagCompound.setShort(Names.NBT.WIDTH, (short) world.getWidth()); + tagCompound.setShort(Names.NBT.LENGTH, (short) world.getLength()); + tagCompound.setShort(Names.NBT.HEIGHT, (short) world.getHeight()); int size = world.getWidth() * world.getLength() * world.getHeight(); byte localBlocks[] = new byte[size]; @@ -166,15 +154,15 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } } - tagCompound.setString(MATERIALS, FORMAT_ALPHA); - tagCompound.setByteArray(BLOCKS, localBlocks); - tagCompound.setByteArray(DATA, localMetadata); + tagCompound.setString(Names.NBT.MATERIALS, Names.NBT.FORMAT_ALPHA); + tagCompound.setByteArray(Names.NBT.BLOCKS, localBlocks); + tagCompound.setByteArray(Names.NBT.DATA, localMetadata); if (extra) { - tagCompound.setByteArray(ADD_BLOCKS, extraBlocksNibble); + tagCompound.setByteArray(Names.NBT.ADD_BLOCKS, extraBlocksNibble); } - tagCompound.setTag(ENTITIES, new NBTTagList()); - tagCompound.setTag(TILE_ENTITIES, tileEntitiesList); - tagCompound.setTag(MAPPING_SCHEMATICA, mapping); + tagCompound.setTag(Names.NBT.ENTITIES, new NBTTagList()); + tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); + tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, mapping); return true; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index a702a439..06d9a3aa 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.nbt.NBTTagCompound; @@ -13,9 +14,6 @@ public abstract class SchematicFormat { public static final Map FORMATS = new HashMap(); - public static final String MATERIALS = "Materials"; - public static final String FORMAT_CLASSIC = "Classic"; - public static final String FORMAT_ALPHA = "Alpha"; public static String FORMAT_DEFAULT; public abstract SchematicWorld readFromNBT(NBTTagCompound tagCompound); @@ -25,7 +23,7 @@ public abstract class SchematicFormat { public static SchematicWorld readFromFile(File file) { try { final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); - final String format = tagCompound.getString(MATERIALS); + final String format = tagCompound.getString(Names.NBT.MATERIALS); final SchematicFormat schematicFormat = FORMATS.get(format); if (schematicFormat == null) { @@ -53,7 +51,7 @@ public static boolean writeToFile(File file, SchematicWorld world) { DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); try { - NBTTagCompound.func_150298_a("Schematic", tagCompound, dataOutputStream); + NBTTagCompound.func_150298_a(Names.NBT.ROOT, tagCompound, dataOutputStream); } finally { dataOutputStream.close(); } @@ -71,9 +69,9 @@ public static boolean writeToFile(File directory, String filename, SchematicWorl } static { - FORMATS.put(FORMAT_CLASSIC, new SchematicClassic()); - FORMATS.put(FORMAT_ALPHA, new SchematicAlpha()); + FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); + FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); - FORMAT_DEFAULT = FORMAT_ALPHA; + FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index cb21b11c..a695a6cb 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.registry.GameData; @@ -53,8 +54,8 @@ public static ItemStack getIconFromName(String iconName) { public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { ItemStack icon = SchematicWorld.DEFAULT_ICON.copy(); - if (tagCompound != null && tagCompound.hasKey("Icon")) { - icon.readFromNBT(tagCompound.getCompoundTag("Icon")); + if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { + icon.readFromNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); if (icon.getItem() == null) { icon = SchematicWorld.DEFAULT_ICON.copy(); diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index a26ad3b2..904ef0e7 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materials schematica.gui.materialname=Material schematica.gui.materialamount=Amount schematica.gui.printer=Printer +schematica.gui.unknownblock=Unknown Block # gui - config - categories schematica.config.category.render=Rendering From d622164bba5f2c194435c21614bb7477b120e3f4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 4 Sep 2014 20:39:13 +0200 Subject: [PATCH 085/314] Updated localization files. --- src/main/resources/assets/schematica/lang/ca_ES.lang | 1 + src/main/resources/assets/schematica/lang/cs_CZ.lang | 1 + src/main/resources/assets/schematica/lang/da_DK.lang | 1 + src/main/resources/assets/schematica/lang/de_DE.lang | 1 + src/main/resources/assets/schematica/lang/en_GB.lang | 1 + src/main/resources/assets/schematica/lang/en_PT.lang | 1 + src/main/resources/assets/schematica/lang/es_ES.lang | 1 + src/main/resources/assets/schematica/lang/es_MX.lang | 1 + src/main/resources/assets/schematica/lang/fi_FI.lang | 1 + src/main/resources/assets/schematica/lang/fr_FR.lang | 1 + src/main/resources/assets/schematica/lang/hu_HU.lang | 1 + src/main/resources/assets/schematica/lang/it_IT.lang | 1 + src/main/resources/assets/schematica/lang/ko_KR.lang | 1 + src/main/resources/assets/schematica/lang/la_LA.lang | 1 + src/main/resources/assets/schematica/lang/lt_LT.lang | 1 + src/main/resources/assets/schematica/lang/nl_NL.lang | 1 + src/main/resources/assets/schematica/lang/no_NO.lang | 1 + src/main/resources/assets/schematica/lang/pl_PL.lang | 1 + src/main/resources/assets/schematica/lang/pt_PT.lang | 1 + src/main/resources/assets/schematica/lang/ru_RU.lang | 1 + src/main/resources/assets/schematica/lang/sk_SK.lang | 1 + src/main/resources/assets/schematica/lang/sl_SI.lang | 1 + src/main/resources/assets/schematica/lang/th_TH.lang | 1 + src/main/resources/assets/schematica/lang/tr_TR.lang | 1 + src/main/resources/assets/schematica/lang/uk_UA.lang | 1 + src/main/resources/assets/schematica/lang/zh_CN.lang | 1 + 26 files changed, 26 insertions(+) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 03f9db54..be802033 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -28,6 +28,7 @@ schematica.gui.z=Z: # schematica.gui.materialname=Material schematica.gui.materialamount=Quantitat schematica.gui.printer=Imprimir +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 0a1f696a..2e203b14 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiály schematica.gui.materialname=Materiál schematica.gui.materialamount=Množství schematica.gui.printer=Tiskárna +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index b8200483..d757c0aa 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materialer schematica.gui.materialname=Materiale schematica.gui.materialamount=Antal # schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index ad3f346f..b9c700ca 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materialien schematica.gui.materialname=Material schematica.gui.materialamount=Menge schematica.gui.printer=Drucker +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 313f1c70..faab5c78 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materials schematica.gui.materialname=Material schematica.gui.materialamount=Amount schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index ad6f047f..084a0f68 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Stuff schematica.gui.materialname=Stuff schematica.gui.materialamount=Number schematica.gui.printer=Printing thing +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 0763e6c1..6627455e 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiales # schematica.gui.materialname=Material schematica.gui.materialamount=Cantidad schematica.gui.printer=Impresora +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index cf688f2c..b25ac3c1 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiales # schematica.gui.materialname=Material schematica.gui.materialamount=Cantidad # schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 8096bec8..1c2072b8 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiaalit schematica.gui.materialname=Materiaali schematica.gui.materialamount=Määrä schematica.gui.printer=Tulostin +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 41b58df3..5ee65f49 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Matériaux schematica.gui.materialname=Matériau schematica.gui.materialamount=Quantité schematica.gui.printer=Mode imprimante +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 8f769695..892db620 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Anyagfelhasználás schematica.gui.materialname=Anyag schematica.gui.materialamount=Mennyiség schematica.gui.printer=Nyomtató +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 91a5be42..945e598a 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiali schematica.gui.materialname=Materiale schematica.gui.materialamount=Quantità # schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index b9bbd202..e0f36177 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -28,6 +28,7 @@ schematica.gui.materials=재료 schematica.gui.materialname=재료 schematica.gui.materialamount=양 schematica.gui.printer=프린터 +# schematica.gui.unknownblock=Unknown Block # gui - config - categories schematica.config.category.render=렌더링 diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index a3bb7fb0..67bab6f7 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -28,6 +28,7 @@ schematica.gui.point.blue=Caerulea res # schematica.gui.materialname=Material schematica.gui.materialamount=Numerus # schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 2fdcec02..dcf05d63 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Medþiagos schematica.gui.materialname=Medþiaga schematica.gui.materialamount=Kiekis # schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 8d26c2bb..9a755a7a 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materialen schematica.gui.materialname=Materiaal schematica.gui.materialamount=Hoeveelheid # schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index bcf3498a..892f2d95 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materialer schematica.gui.materialname=Materiale schematica.gui.materialamount=Mengde schematica.gui.printer=Printer +# schematica.gui.unknownblock=Unknown Block # gui - config - categories schematica.config.category.render=Gjengivelse diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 496d4a7c..f510eb4a 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materialy # schematica.gui.materialname=Material schematica.gui.materialamount=Ilosc schematica.gui.printer=Drukarka +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 2f4478a7..9c571076 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiais schematica.gui.materialname=Material schematica.gui.materialamount=Quantidade schematica.gui.printer=Modo de construçăo automática +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index c4f7e2b5..90f52c4c 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Материалы schematica.gui.materialname=Материал schematica.gui.materialamount=Количество schematica.gui.printer=Принтер +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 18889dbe..c2000ba9 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiály schematica.gui.materialname=Materiál schematica.gui.materialamount=Množstvo schematica.gui.printer=Tlačiareň +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index de49a27f..d958c3ba 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Materiali schematica.gui.materialname=Material schematica.gui.materialamount=Količina schematica.gui.printer=Tiskalnik +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index f464c2de..6e3eb6ee 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -28,6 +28,7 @@ schematica.gui.materials=ส่วนประกอบ schematica.gui.materialname=ส่วนประกอบ schematica.gui.materialamount=จำนวน schematica.gui.printer=การปริ๊น +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 40f73b79..4c41b030 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Malzemeler schematica.gui.materialname=Malzeme schematica.gui.materialamount=Miktar schematica.gui.printer=Yazıcı +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 1c0f098b..1ce96571 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -28,6 +28,7 @@ schematica.gui.materials=Матеріали schematica.gui.materialname=Матеріал schematica.gui.materialamount=кількість schematica.gui.printer=Принтер +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 0972b1e7..3bc4497d 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -28,6 +28,7 @@ schematica.gui.materials=材料 schematica.gui.materialname=材料 schematica.gui.materialamount=数量 schematica.gui.printer=投影 +# schematica.gui.unknownblock=Unknown Block # gui - config - categories # schematica.config.category.render=Rendering From 47cf3bab5c6cd429ea8270e2a1d9840518d456e5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 6 Sep 2014 02:23:21 +0200 Subject: [PATCH 086/314] Do not print if a block is missing a mapping. --- .../github/lunatrius/schematica/SchematicPrinter.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 7a4c1f1b..f3827303 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -7,6 +7,7 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.client.Minecraft; @@ -177,7 +178,13 @@ private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z return false; } - if (placeBlock(this.minecraft, world, player, wx, wy, wz, BlockInfo.getItemFromBlock(block), metadata)) { + final Item item = BlockInfo.getItemFromBlock(block); + if (item == null) { + Reference.logger.debug(GameData.getBlockRegistry().getNameForObject(block) + " is missing a mapping!"); + return false; + } + + if (placeBlock(this.minecraft, world, player, wx, wy, wz, item, metadata)) { this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; if (!ConfigurationHandler.placeInstantly) { From 847ff2a67249dfcb794f3108c123eeea63e01da4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 17 Sep 2014 03:15:41 +0200 Subject: [PATCH 087/314] Tweaks to gradle. --- build.gradle | 145 ++--------------------------- build.properties | 9 -- gradle.properties | 10 ++ gradle/scripts/artifacts.gradle | 27 ++++++ gradle/scripts/dependencies.gradle | 30 ++++++ gradle/scripts/forge.gradle | 45 +++++++++ gradle/scripts/release.gradle | 17 ++++ gradle/scripts/signing.gradle | 36 +++++++ 8 files changed, 172 insertions(+), 147 deletions(-) delete mode 100644 build.properties create mode 100644 gradle.properties create mode 100644 gradle/scripts/artifacts.gradle create mode 100644 gradle/scripts/dependencies.gradle create mode 100644 gradle/scripts/forge.gradle create mode 100644 gradle/scripts/release.gradle create mode 100644 gradle/scripts/signing.gradle diff --git a/build.gradle b/build.gradle index 2e4532b9..cf0a94f9 100644 --- a/build.gradle +++ b/build.gradle @@ -15,145 +15,14 @@ buildscript { } } -apply plugin: 'forge' - -ext.configFile = file 'build.properties' - -configFile.withReader { - def prop = new Properties() - prop.load(it) - ext.config = new ConfigSlurper().parse prop -} - ext.build = System.getenv().BUILD_NUMBER ?: 'git' -ext.modversion = "${config.version.major}.${config.version.minor}.${config.version.micro}.${build}" +ext.modversion = "${project.version_major}.${project.version_minor}.${project.version_micro}.${build}" group = 'com.github.lunatrius' -version = "${config.version.minecraft}-${modversion}" - -compileJava.options.encoding = 'UTF-8' - -repositories { - ivy { - name = 'lunatrius\' ivy repo' - url 'http://mc.lunatri.us/files' - } -} - -dependencies { - compile group: group, name: 'LunatriusCore', version: "${config.version.minecraft}-${config.version.lunatriuscore}", classifier: 'dev' -} - -idea { - module { - downloadSources = true - } -} - -def commonManifest = { - if (config.extra.fmlat) { - attributes 'FMLAT': config.extra.fmlat - } -} - -minecraft { - version = "${config.version.minecraft}-${config.version.forge}" - - if (!project.hasProperty('run_location')) - runDir = 'run' - else - runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', config.version.minecraft) - - replaceIn 'reference/Reference.java' - replace '${version}', modversion - replace '${mcversion}', config.version.minecraft - replace '${forgeversion}', config.version.forge -} - -jar { - classifier = config.extra.classifier ?: 'universal' - manifest commonManifest -} - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.version - inputs.property 'mcversion', project.minecraft.version - - from (sourceSets.main.resources.srcDirs) { - include 'mcmod.info' +version = "${project.version_minecraft}-${modversion}" - expand (['modid': project.name, - 'version': modversion, - 'mcversion': config.version.minecraft, - 'forgeversion': config.version.forge, - 'minforgeversion': config.version.minforge ?: config.version.forge, - 'coreversion': config.version.lunatriuscore - ]) - } - - from (sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} - -if (!project.hasProperty('keystore_location')) - ext.keystore_location = '.' - -if (!project.hasProperty('keystore_alias')) - ext.keystore_alias = '' - -if (!project.hasProperty('keystore_password')) - ext.keystore_password = '' - -if (!project.hasProperty('release_location')) - ext.release_location = '.' -else - ext.release_location = release_location.replace('{modid}', project.name).replace('{mcversion}', config.version.minecraft).replace('{version}', version) - -task signJar(dependsOn: 'reobf') { - inputs.file jar.getArchivePath() - inputs.file keystore_location - inputs.property 'keystore_alias', keystore_alias - inputs.property 'keystore_password', keystore_password - outputs.file jar.getArchivePath() - - onlyIf { - return keystore_location != '.' - } - - doLast { - ant.signjar( - destDir: jar.destinationDir, - jar: jar.getArchivePath(), - keystore: keystore_location, - alias: keystore_alias, - storepass: keystore_password - ) - } -} - -task devJar(type: Jar) { - from sourceSets.main.output - classifier = 'dev' - manifest commonManifest -} - -task sourceJar(type: Jar) { - from sourceSets.main.allSource - classifier = 'sources' - manifest commonManifest -} - -task release(dependsOn: ['sourceJar', 'devJar', 'signJar'], type: Copy) { - from project.tasks.jar.destinationDir - into project.file(project.release_location) - - eachFile { file -> - logger.lifecycle "copying ${file}" - } - - onlyIf { - return project.release_location != '.' - } -} +apply from: 'gradle/scripts/forge.gradle' +apply from: 'gradle/scripts/dependencies.gradle' +apply from: 'gradle/scripts/artifacts.gradle' +apply from: 'gradle/scripts/signing.gradle' +apply from: 'gradle/scripts/release.gradle' diff --git a/build.properties b/build.properties deleted file mode 100644 index 1cf93c07..00000000 --- a/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -version.major=1 -version.minor=7 -version.micro=2 -version.minecraft=1.7.10 -version.forge=10.13.0.1187 -version.minforge=10.13.0.1185 -version.lunatriuscore=1.1.2.11 - -extra.fmlat=schematica_at.cfg diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..33f5e267 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,10 @@ +version_major=1 +version_minor=7 +version_micro=2 +version_minecraft=1.7.10 +version_forge=10.13.1.1217 +version_minforge=10.13.0.1185 +version_lunatriuscore=1.1.2.13 + +extra_modsio_id=1008 +extra_fmlat=schematica_at.cfg diff --git a/gradle/scripts/artifacts.gradle b/gradle/scripts/artifacts.gradle new file mode 100644 index 00000000..a9a640b1 --- /dev/null +++ b/gradle/scripts/artifacts.gradle @@ -0,0 +1,27 @@ +def commonManifest = { + if (project.hasProperty('extra_fmlat')) { + attributes 'FMLAT': project.extra_fmlat + } +} + +jar { + classifier = project.hasProperty('extra_classifier') ? project.extra_classifier : 'universal' + manifest commonManifest +} + +task devJar(dependsOn: 'classes', type: Jar) { + from sourceSets.main.output + classifier = 'dev' + manifest commonManifest +} + +task sourceJar(dependsOn: 'classes', type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' + manifest commonManifest +} + +artifacts { + archives devJar + archives sourceJar +} diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle new file mode 100644 index 00000000..b8b736b4 --- /dev/null +++ b/gradle/scripts/dependencies.gradle @@ -0,0 +1,30 @@ +repositories { + ivy { + name = 'lunatrius\' ivy repo' + url 'http://mc.lunatri.us/files' + } +} + +dependencies { + compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev' +} + +def addDependency(depFilename, depName, depPath) { + def depfile = new File('libs/' + depFilename) + if (depfile.isFile()) { + logger.lifecycle "Building with ${depName}..." + + dependencies { + compile files(depfile) + } + } else { + logger.warn "Building without ${depName}..." + + if (depPath != null) { + sourceSets.main.java.excludes += [depPath] + idea.module.excludeDirs += [file("src/main/java/${depPath}")] + } + } +} + +// addDependency('example.jar', 'example', 'com/github/lunatrius/example/integration/test') diff --git a/gradle/scripts/forge.gradle b/gradle/scripts/forge.gradle new file mode 100644 index 00000000..e51f9f76 --- /dev/null +++ b/gradle/scripts/forge.gradle @@ -0,0 +1,45 @@ +apply plugin: 'forge' + +compileJava.options.encoding = 'UTF-8' + +idea { + module { + downloadSources = true + } +} + +minecraft { + version = "${project.version_minecraft}-${project.version_forge}" + + if (!project.hasProperty('run_location')) + runDir = 'run' + else + runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft) + + replaceIn 'reference/Reference.java' + replace '${version}', modversion + replace '${mcversion}', project.version_minecraft + replace '${forgeversion}', project.version_forge +} + +processResources { + // this will ensure that this task is redone when the versions change. + inputs.property 'version', project.version + inputs.property 'mcversion', project.minecraft.version + + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + expand(['modid' : project.name, + 'version' : modversion, + 'mcversion' : project.version_minecraft, + 'forgeversion' : project.version_forge, + 'minforgeversion': project.version_minforge ?: project.version_forge, + 'coreversion' : project.version_lunatriuscore + ]) + } + + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} diff --git a/gradle/scripts/release.gradle b/gradle/scripts/release.gradle new file mode 100644 index 00000000..4ca0e25b --- /dev/null +++ b/gradle/scripts/release.gradle @@ -0,0 +1,17 @@ +if (!project.hasProperty('release_location')) + ext.release_location = '.' +else + ext.release_location = release_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft).replace('{version}', version) + +task release(dependsOn: 'signJars', type: Copy) { + from project.tasks.jar.destinationDir + into project.file(project.release_location) + + eachFile { file -> + logger.lifecycle "copying ${file}" + } + + onlyIf { + return project.release_location != '.' + } +} diff --git a/gradle/scripts/signing.gradle b/gradle/scripts/signing.gradle new file mode 100644 index 00000000..f5068c41 --- /dev/null +++ b/gradle/scripts/signing.gradle @@ -0,0 +1,36 @@ +if (!project.hasProperty('keystore_location')) + ext.keystore_location = '.' + +if (!project.hasProperty('keystore_alias')) + ext.keystore_alias = '' + +if (!project.hasProperty('keystore_password')) + ext.keystore_password = '' + +task signJars(dependsOn: ['jar', 'devJar', 'sourceJar']) { + inputs.dir jar.destinationDir + inputs.file keystore_location + inputs.property 'keystore_alias', keystore_alias + inputs.property 'keystore_password', keystore_password + outputs.dir devJar.destinationDir + + onlyIf { + return keystore_location != '.' + } + + doLast { + jar.destinationDir.eachFile { file -> + if (!file.getPath().endsWith('.jar')) + return; + + logger.lifecycle "signing ${file}" + ant.signjar( + destDir: file.getParentFile(), + jar: file, + keystore: keystore_location, + alias: keystore_alias, + storepass: keystore_password + ) + } + } +} From 69c1fd2863dad439d117e7c60c58eb965c25fcc1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 17 Sep 2014 06:35:12 +0200 Subject: [PATCH 088/314] Make sure to reobf the universal jar... --- gradle.properties | 2 +- gradle/scripts/signing.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 33f5e267..15cc6f28 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ version_micro=2 version_minecraft=1.7.10 version_forge=10.13.1.1217 version_minforge=10.13.0.1185 -version_lunatriuscore=1.1.2.13 +version_lunatriuscore=1.1.2.14 extra_modsio_id=1008 extra_fmlat=schematica_at.cfg diff --git a/gradle/scripts/signing.gradle b/gradle/scripts/signing.gradle index f5068c41..6aa4f058 100644 --- a/gradle/scripts/signing.gradle +++ b/gradle/scripts/signing.gradle @@ -7,7 +7,7 @@ if (!project.hasProperty('keystore_alias')) if (!project.hasProperty('keystore_password')) ext.keystore_password = '' -task signJars(dependsOn: ['jar', 'devJar', 'sourceJar']) { +task signJars(dependsOn: ['reobf', 'devJar', 'sourceJar']) { inputs.dir jar.destinationDir inputs.file keystore_location inputs.property 'keystore_alias', keystore_alias From 8e21f5bce9d4cb42e8d10c917bf7ca0e0850f96b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 17 Sep 2014 16:20:45 +0200 Subject: [PATCH 089/314] Do not use a full path as the default location for schematics. Closes #51 --- .../handler/ConfigurationHandler.java | 22 ++++++++++++++----- .../schematica/proxy/ClientProxy.java | 9 +++++++- .../schematica/proxy/CommonProxy.java | 5 +---- .../schematica/proxy/ServerProxy.java | 10 ++++++++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index c453c9da..5b42599f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -33,7 +33,8 @@ public class ConfigurationHandler { public static final boolean DESTROYINSTANTLY_DEFAULT = false; public static final boolean PLACEADJACENT_DEFAULT = true; public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; - public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), "schematics"); + public static final String SCHEMATICDIRECTORY_STR = "schematics"; + public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); public static boolean enableAlpha = ENABLEALPHA_DEFAULT; public static float alpha = (float) ALPHA_DEFAULT; @@ -133,15 +134,24 @@ private static void loadConfiguration() { swapSlots = propSwapSlots.getIntList(); swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); + propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATICDIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); + propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); + schematicDirectory = new File(propSchematicDirectory.getString()); + try { - schematicDirectory = SCHEMATICDIRECTORY_DEFAULT.getCanonicalFile(); + schematicDirectory = schematicDirectory.getCanonicalFile(); + final String schematicPath = schematicDirectory.getAbsolutePath(); + final String dataPath = Schematica.proxy.getDataDirectory().getAbsolutePath(); + if (schematicPath.contains(dataPath)) { + propSchematicDirectory.set(schematicPath.substring(dataPath.length()).replace("\\", "/").replaceAll("^/+", "")); + } else { + propSchematicDirectory.set(schematicPath.replace("\\", "/")); + } } catch (IOException e) { - Reference.logger.warn("Could not canonize file path!", e); + Reference.logger.warn("Could not canonize path!", e); } - propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, schematicDirectory.getAbsolutePath().replace("\\", "/"), Names.Config.SCHEMATIC_DIRECTORY_DESC); - propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); - schematicDirectory = new File(propSchematicDirectory.getString()); + Schematica.proxy.createFolders(); if (configuration.hasChanged()) { configuration.save(); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 31f6aed5..10b6e173 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -25,6 +25,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.io.File; +import java.io.IOException; public class ClientProxy extends CommonProxy { // TODO: remove this and replace the 3 sepparate buttons with a single control @@ -169,7 +170,13 @@ public void registerEvents() { @Override public File getDataDirectory() { - return Minecraft.getMinecraft().mcDataDir; + final File file = Minecraft.getMinecraft().mcDataDir; + try { + return file.getCanonicalFile(); + } catch (IOException e) { + Reference.logger.info("Could not canonize path!", e); + } + return file; } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index cb78e3f1..dd77f904 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -8,7 +8,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -34,9 +33,7 @@ public void createFolders() { } } - public File getDataDirectory() { - return MinecraftServer.getServer().getFile("."); - } + public abstract File getDataDirectory(); public void resetSettings() { this.isSaveEnabled = true; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index b009bdb8..48a84871 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,12 +1,14 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import java.io.File; +import java.io.IOException; public class ServerProxy extends CommonProxy { @Override @@ -23,7 +25,13 @@ public void registerEvents() { @Override public File getDataDirectory() { - return MinecraftServer.getServer().getFile("."); + final File file = MinecraftServer.getServer().getFile("."); + try { + return file.getCanonicalFile(); + } catch (IOException e) { + Reference.logger.info("Could not canonize path!", e); + } + return file; } @Override From e17ec7d213cac36b935f2d15d6d6ddee756b4ac3 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Sep 2014 19:02:00 +0200 Subject: [PATCH 090/314] The setup gradle section is not needed, contributors/developers should use the wrapper instead. --- README.md | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index bbadd31d..83524bcf 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ ### Compiling [Setup Java](#setup-java) -[Setup Gradle](#setup-gradle) - [Setup Git](#setup-git) [Setup Schematica](#setup-schematica) @@ -37,28 +35,6 @@ The Java JDK is used to compile Schematica. 7. Append `;%JAVA_HOME%\bin` EXACTLY AS SHOWN and click `Ok`. Make sure the location is correct; double-check just to make sure. 3. Open up your command line and run `javac`. If it spews out a bunch of possible options and the usage, then you're good to go. If not try the steps again. -#### Setup Gradle -*** -You may skip this entire section and use the provided Gradle wrapper instead (use `gradlew` instead of `gradle`). -*** -Gradle is used to execute the various build tasks when compiling Schematica. - -1. Download and install Gradle. - * [Windows/Mac download link](http://www.gradle.org/downloads). You only need the binaries, but choose whatever flavor you want. - * Unzip the package and put it wherever you want, eg `C:\Gradle`. - * Linux: Installation methods for certain popular flavors of Linux are listed below. If your distribution is not listed, follow the instructions specific to your package manager or install it manually [here](http://www.gradle.org/downloads). - * Gentoo: `emerge dev-java/gradle-bin` - * Archlinux: You'll have to install it from the [AUR](https://aur.archlinux.org/packages/gradle). - * Ubuntu/Debian: `apt-get install gradle` - * Fedora: Install Gradle manually from its website (see above), as Fedora ships a "broken" version of Gradle. Use `yum install gradle` only if you know what you're doing. -2. Set up the environment. - * Windows: Set environment variables for Gradle. - 1. Go back to `Environment Variables` and then create a new system variable. - 2. For `Variable Name`, input `GRADLE_HOME`. - 3. For `Variable Value`, input something similar to `C:\Gradle-1.10` exactly as shown (or wherever your Gradle installation is), and click `Ok`. - 4. Scroll down to `Path` again, and append `;%GRADLE_HOME%\bin` EXACTLY AS SHOWN and click `Ok`. Once again, double-check the location. -3. Open up your command line and run `gradle`. If it says "Welcome to Gradle [version].", then you're good to go. If not try the steps again. - #### Setup Git Git is used to clone Schematica and update your local copy. @@ -80,9 +56,9 @@ This section assumes that you're using the command-line version of Git. *** #### Compile Schematica -1. Execute `gradle setupDevWorkspace`. This sets up Forge and downloads the necessary libraries to build Schematica. This might take some time, be patient. +1. Execute `gradlew setupDevWorkspace`. This sets up Forge and downloads the necessary libraries to build Schematica. This might take some time, be patient. * You will generally only have to do this once until the Forge version in `build.properties` changes. -2. Execute `gradle build`. If you did everything right, `BUILD SUCCESSFUL` will be displayed after it finishes. This should be relatively quick. +2. Execute `gradlew build`. If you did everything right, `BUILD SUCCESSFUL` will be displayed after it finishes. This should be relatively quick. * If you see `BUILD FAILED`, check the error output (it should be right around `BUILD FAILED`), fix everything (if possible), and try again. 3. Go to `mcdev\Schematica\build\libs`. * You should see a `.jar` file named `Schematica-#.#.#-#.#.#.#-universal.jar`. From 3b45e8c266f3e27edfe47a38acb770b34b2c890a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Sep 2014 21:54:44 +0200 Subject: [PATCH 091/314] Converted all tabs to spaces. --- .../schematica/FileFilterSchematic.java | 24 +- .../schematica/SchematicPrinter.java | 780 +++++++-------- .../lunatrius/schematica/Schematica.java | 62 +- .../schematica/client/gui/GuiFactory.java | 30 +- .../schematica/client/gui/GuiHelper.java | 44 +- .../schematica/client/gui/GuiModConfig.java | 20 +- .../client/gui/GuiSchematicControl.java | 432 ++++---- .../client/gui/GuiSchematicEntry.java | 78 +- .../client/gui/GuiSchematicLoad.java | 290 +++--- .../client/gui/GuiSchematicLoadSlot.java | 92 +- .../client/gui/GuiSchematicMaterials.java | 98 +- .../client/gui/GuiSchematicMaterialsSlot.java | 82 +- .../client/gui/GuiSchematicSave.java | 482 ++++----- .../client/renderer/RenderHelper.java | 930 +++++++++--------- .../renderer/RendererSchematicChunk.java | 698 ++++++------- .../RendererSchematicChunkSorter.java | 46 +- .../renderer/RendererSchematicGlobal.java | 348 +++---- .../client/renderer/shader/ShaderProgram.java | 218 ++-- .../schematica/config/BlockInfo.java | 672 ++++++------- .../schematica/config/PlacementData.java | 188 ++-- .../handler/ConfigurationHandler.java | 298 +++--- .../handler/client/ChatEventHandler.java | 42 +- .../handler/client/KeyInputHandler.java | 222 ++--- .../handler/client/TickHandler.java | 110 +-- .../schematica/proxy/ClientProxy.java | 470 ++++----- .../schematica/proxy/CommonProxy.java | 172 ++-- .../schematica/proxy/ServerProxy.java | 82 +- .../lunatrius/schematica/reference/Names.java | 128 +-- .../schematica/reference/Reference.java | 18 +- .../schematica/world/SchematicWorld.java | 782 +++++++-------- .../world/schematic/SchematicAlpha.java | 294 +++--- .../world/schematic/SchematicClassic.java | 16 +- .../world/schematic/SchematicFormat.java | 90 +- .../world/schematic/SchematicUtil.java | 100 +- .../schematic/UnsupportedFormatException.java | 6 +- 35 files changed, 4222 insertions(+), 4222 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java b/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java index a198b8f8..85bdff69 100644 --- a/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java @@ -3,19 +3,19 @@ import java.io.File; public class FileFilterSchematic implements java.io.FileFilter { - private final boolean directory; + private final boolean directory; - public FileFilterSchematic(boolean dir) { - super(); - this.directory = dir; - } + public FileFilterSchematic(boolean dir) { + super(); + this.directory = dir; + } - @Override - public boolean accept(File file) { - if (this.directory) { - return file.isDirectory(); - } + @Override + public boolean accept(File file) { + if (this.directory) { + return file.isDirectory(); + } - return file.getName().toLowerCase().endsWith(".schematic"); - } + return file.getName().toLowerCase().endsWith(".schematic"); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index f3827303..9e79bff6 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -30,396 +30,396 @@ import java.util.List; public class SchematicPrinter { - public static final int WILDCARD_METADATA = -1; - public static final int SIZE_CRAFTING_OUT = 1; - public static final int SIZE_CRAFTING_IN = 4; - public static final int SIZE_ARMOR = 4; - public static final int SIZE_INVENTORY = 3 * 9; - public static final int SIZE_HOTBAR = 9; - - public static final int SLOT_OFFSET_CRAFTING_OUT = 0; - public static final int SLOT_OFFSET_CRAFTING_IN = SLOT_OFFSET_CRAFTING_OUT + SIZE_CRAFTING_OUT; - public static final int SLOT_OFFSET_ARMOR = SLOT_OFFSET_CRAFTING_IN + SIZE_CRAFTING_IN; - public static final int SLOT_OFFSET_INVENTORY = SLOT_OFFSET_ARMOR + SIZE_ARMOR; - public static final int SLOT_OFFSET_HOTBAR = SLOT_OFFSET_INVENTORY + SIZE_INVENTORY; - - public static final int INV_OFFSET_HOTBAR = 0; - public static final int INV_OFFSET_INVENTORY = INV_OFFSET_HOTBAR + 9; - - public static final SchematicPrinter INSTANCE = new SchematicPrinter(); - - private final Minecraft minecraft = Minecraft.getMinecraft(); - - private boolean isEnabled; - private boolean isPrinting; - - private SchematicWorld schematic = null; - private byte[][][] timeout = null; - - public boolean isEnabled() { - return this.isEnabled; - } - - public void setEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - } - - public boolean togglePrinting() { - this.isPrinting = !this.isPrinting; - return this.isPrinting; - } - - public boolean isPrinting() { - return this.isPrinting; - } - - public void setPrinting(boolean isPrinting) { - this.isPrinting = isPrinting; - } - - public SchematicWorld getSchematic() { - return this.schematic; - } - - public void setSchematic(SchematicWorld schematic) { - this.isPrinting = false; - this.schematic = schematic; - refresh(); - } - - public void refresh() { - if (this.schematic != null) { - this.timeout = new byte[this.schematic.getWidth()][this.schematic.getHeight()][this.schematic.getLength()]; - } else { - this.timeout = null; - } - } - - public boolean print() { - final EntityClientPlayerMP player = this.minecraft.thePlayer; - final World world = this.minecraft.theWorld; - - syncSneaking(player, true); - - final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); - final int minX = Math.max(0, trans.x - 3); - final int maxX = Math.min(this.schematic.getWidth(), trans.x + 4); - final int minY = Math.max(0, trans.y - 3); - final int maxY = Math.min(this.schematic.getHeight(), trans.y + 4); - final int minZ = Math.max(0, trans.z - 3); - final int maxZ = Math.min(this.schematic.getLength(), trans.z + 4); - - final int slot = player.inventory.currentItem; - final boolean isSneaking = player.isSneaking(); - - final int renderingLayer = this.schematic.renderingLayer; - for (int y = minY; y < maxY; y++) { - if (renderingLayer >= 0) { - if (y != renderingLayer) { - continue; - } - } - - for (int x = minX; x < maxX; x++) { - for (int z = minZ; z < maxZ; z++) { - try { - if (placeBlock(world, player, x, y, z)) { - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return true; - } - } catch (Exception e) { - Reference.logger.error("Could not place block!", e); - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return false; - } - } - } - } - - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return true; - } - - private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z) { - if (this.timeout[x][y][z] > 0) { - this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; - return false; - } - - final int wx = this.schematic.position.x + x; - final int wy = this.schematic.position.y + y; - final int wz = this.schematic.position.z + z; - - final Block block = this.schematic.getBlock(x, y, z); - final Block realBlock = world.getBlock(wx, wy, wz); - final int metadata = this.schematic.getBlockMetadata(x, y, z); - final int realMetadata = world.getBlockMetadata(wx, wy, wz); - - if (block == realBlock && metadata == realMetadata) { - return false; - } - - if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { - this.minecraft.playerController.clickBlock(wx, wy, wz, 0); - - this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; - - return !ConfigurationHandler.destroyInstantly; - } - - if (this.schematic.isAirBlock(x, y, z)) { - return false; - } - - if (!realBlock.isReplaceable(world, wx, wy, wz)) { - return false; - } - - final Item item = BlockInfo.getItemFromBlock(block); - if (item == null) { - Reference.logger.debug(GameData.getBlockRegistry().getNameForObject(block) + " is missing a mapping!"); - return false; - } - - if (placeBlock(this.minecraft, world, player, wx, wy, wz, item, metadata)) { - this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; - - if (!ConfigurationHandler.placeInstantly) { - return true; - } - } - - return false; - } - - private boolean isSolid(World world, int x, int y, int z, ForgeDirection side) { - x += side.offsetX; - y += side.offsetY; - z += side.offsetZ; - - Block block = world.getBlock(x, y, z); - - if (block == null) { - return false; - } - - if (block.isAir(world, x, y, z)) { - return false; - } - - if (block instanceof BlockFluidBase) { - return false; - } - - if (block.isReplaceable(world, x, y, z)) { - return false; - } - - return true; - } - - private ForgeDirection[] getSolidSides(World world, int x, int y, int z) { - List list = new ArrayList(); - - for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - if (isSolid(world, x, y, z, side)) { - list.add(side); - } - } - - ForgeDirection[] sides = new ForgeDirection[list.size()]; - return list.toArray(sides); - } - - private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player, int x, int y, int z, Item item, int itemDamage) { - if (item instanceof ItemBucket || item == Items.sign) { - return false; - } - - PlacementData data = BlockInfo.getPlacementDataFromItem(item); - - if (!isValidOrientation(player, x, y, z, data, itemDamage)) { - return false; - } - - ForgeDirection[] solidSides = getSolidSides(world, x, y, z); - ForgeDirection direction = ForgeDirection.UNKNOWN; - float offsetY = 0.0f; - - if (solidSides.length > 0) { - int metadata = WILDCARD_METADATA; - - if (data != null) { - ForgeDirection[] validDirections = data.getValidDirections(solidSides, itemDamage); - if (validDirections.length > 0) { - direction = validDirections[0]; - } - - offsetY = data.getOffsetFromMetadata(itemDamage); - - if (data.maskMetaInHand != -1) { - metadata = data.getMetaInHand(itemDamage); - } - } else { - direction = solidSides[0]; - } - - if (!swapToItem(player.inventory, item, metadata)) { - return false; - } - } - - if (direction != ForgeDirection.UNKNOWN || !ConfigurationHandler.placeAdjacent) { - return placeBlock(minecraft, world, player, x, y, z, direction, 0.0f, offsetY, 0.0f); - } - - return false; - } - - private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, PlacementData data, int metadata) { - if (data != null) { - switch (data.type) { - case BLOCK: { - return true; - } - - case PLAYER: { - Integer integer = data.mapping.get(ClientProxy.orientation); - if (integer != null) { - return integer == (metadata & data.maskMeta); - } - break; - } - - case PISTON: { - Integer integer = data.mapping.get(ClientProxy.orientation); - if (integer != null) { - return BlockPistonBase.determineOrientation(null, x, y, z, player) == BlockPistonBase.getPistonOrientation(metadata); - } - break; - } - } - return false; - } - - return true; - } - - private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player, int x, int y, int z, ForgeDirection direction, float offsetX, float offsetY, float offsetZ) { - ItemStack itemStack = player.getCurrentEquippedItem(); - boolean success = false; - - x += direction.offsetX; - y += direction.offsetY; - z += direction.offsetZ; - - int side = direction.getOpposite().ordinal(); + public static final int WILDCARD_METADATA = -1; + public static final int SIZE_CRAFTING_OUT = 1; + public static final int SIZE_CRAFTING_IN = 4; + public static final int SIZE_ARMOR = 4; + public static final int SIZE_INVENTORY = 3 * 9; + public static final int SIZE_HOTBAR = 9; + + public static final int SLOT_OFFSET_CRAFTING_OUT = 0; + public static final int SLOT_OFFSET_CRAFTING_IN = SLOT_OFFSET_CRAFTING_OUT + SIZE_CRAFTING_OUT; + public static final int SLOT_OFFSET_ARMOR = SLOT_OFFSET_CRAFTING_IN + SIZE_CRAFTING_IN; + public static final int SLOT_OFFSET_INVENTORY = SLOT_OFFSET_ARMOR + SIZE_ARMOR; + public static final int SLOT_OFFSET_HOTBAR = SLOT_OFFSET_INVENTORY + SIZE_INVENTORY; + + public static final int INV_OFFSET_HOTBAR = 0; + public static final int INV_OFFSET_INVENTORY = INV_OFFSET_HOTBAR + 9; + + public static final SchematicPrinter INSTANCE = new SchematicPrinter(); + + private final Minecraft minecraft = Minecraft.getMinecraft(); + + private boolean isEnabled; + private boolean isPrinting; + + private SchematicWorld schematic = null; + private byte[][][] timeout = null; + + public boolean isEnabled() { + return this.isEnabled; + } + + public void setEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + } + + public boolean togglePrinting() { + this.isPrinting = !this.isPrinting; + return this.isPrinting; + } + + public boolean isPrinting() { + return this.isPrinting; + } + + public void setPrinting(boolean isPrinting) { + this.isPrinting = isPrinting; + } + + public SchematicWorld getSchematic() { + return this.schematic; + } + + public void setSchematic(SchematicWorld schematic) { + this.isPrinting = false; + this.schematic = schematic; + refresh(); + } + + public void refresh() { + if (this.schematic != null) { + this.timeout = new byte[this.schematic.getWidth()][this.schematic.getHeight()][this.schematic.getLength()]; + } else { + this.timeout = null; + } + } + + public boolean print() { + final EntityClientPlayerMP player = this.minecraft.thePlayer; + final World world = this.minecraft.theWorld; + + syncSneaking(player, true); + + final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); + final int minX = Math.max(0, trans.x - 3); + final int maxX = Math.min(this.schematic.getWidth(), trans.x + 4); + final int minY = Math.max(0, trans.y - 3); + final int maxY = Math.min(this.schematic.getHeight(), trans.y + 4); + final int minZ = Math.max(0, trans.z - 3); + final int maxZ = Math.min(this.schematic.getLength(), trans.z + 4); + + final int slot = player.inventory.currentItem; + final boolean isSneaking = player.isSneaking(); + + final int renderingLayer = this.schematic.renderingLayer; + for (int y = minY; y < maxY; y++) { + if (renderingLayer >= 0) { + if (y != renderingLayer) { + continue; + } + } + + for (int x = minX; x < maxX; x++) { + for (int z = minZ; z < maxZ; z++) { + try { + if (placeBlock(world, player, x, y, z)) { + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return true; + } + } catch (Exception e) { + Reference.logger.error("Could not place block!", e); + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return false; + } + } + } + } + + player.inventory.currentItem = slot; + syncSneaking(player, isSneaking); + return true; + } + + private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z) { + if (this.timeout[x][y][z] > 0) { + this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; + return false; + } + + final int wx = this.schematic.position.x + x; + final int wy = this.schematic.position.y + y; + final int wz = this.schematic.position.z + z; + + final Block block = this.schematic.getBlock(x, y, z); + final Block realBlock = world.getBlock(wx, wy, wz); + final int metadata = this.schematic.getBlockMetadata(x, y, z); + final int realMetadata = world.getBlockMetadata(wx, wy, wz); + + if (block == realBlock && metadata == realMetadata) { + return false; + } + + if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { + this.minecraft.playerController.clickBlock(wx, wy, wz, 0); + + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + + return !ConfigurationHandler.destroyInstantly; + } + + if (this.schematic.isAirBlock(x, y, z)) { + return false; + } + + if (!realBlock.isReplaceable(world, wx, wy, wz)) { + return false; + } + + final Item item = BlockInfo.getItemFromBlock(block); + if (item == null) { + Reference.logger.debug(GameData.getBlockRegistry().getNameForObject(block) + " is missing a mapping!"); + return false; + } + + if (placeBlock(this.minecraft, world, player, wx, wy, wz, item, metadata)) { + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + + if (!ConfigurationHandler.placeInstantly) { + return true; + } + } + + return false; + } + + private boolean isSolid(World world, int x, int y, int z, ForgeDirection side) { + x += side.offsetX; + y += side.offsetY; + z += side.offsetZ; + + Block block = world.getBlock(x, y, z); + + if (block == null) { + return false; + } + + if (block.isAir(world, x, y, z)) { + return false; + } + + if (block instanceof BlockFluidBase) { + return false; + } + + if (block.isReplaceable(world, x, y, z)) { + return false; + } + + return true; + } + + private ForgeDirection[] getSolidSides(World world, int x, int y, int z) { + List list = new ArrayList(); + + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { + if (isSolid(world, x, y, z, side)) { + list.add(side); + } + } + + ForgeDirection[] sides = new ForgeDirection[list.size()]; + return list.toArray(sides); + } + + private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player, int x, int y, int z, Item item, int itemDamage) { + if (item instanceof ItemBucket || item == Items.sign) { + return false; + } + + PlacementData data = BlockInfo.getPlacementDataFromItem(item); + + if (!isValidOrientation(player, x, y, z, data, itemDamage)) { + return false; + } + + ForgeDirection[] solidSides = getSolidSides(world, x, y, z); + ForgeDirection direction = ForgeDirection.UNKNOWN; + float offsetY = 0.0f; + + if (solidSides.length > 0) { + int metadata = WILDCARD_METADATA; + + if (data != null) { + ForgeDirection[] validDirections = data.getValidDirections(solidSides, itemDamage); + if (validDirections.length > 0) { + direction = validDirections[0]; + } + + offsetY = data.getOffsetFromMetadata(itemDamage); + + if (data.maskMetaInHand != -1) { + metadata = data.getMetaInHand(itemDamage); + } + } else { + direction = solidSides[0]; + } + + if (!swapToItem(player.inventory, item, metadata)) { + return false; + } + } + + if (direction != ForgeDirection.UNKNOWN || !ConfigurationHandler.placeAdjacent) { + return placeBlock(minecraft, world, player, x, y, z, direction, 0.0f, offsetY, 0.0f); + } + + return false; + } + + private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, PlacementData data, int metadata) { + if (data != null) { + switch (data.type) { + case BLOCK: { + return true; + } + + case PLAYER: { + Integer integer = data.mapping.get(ClientProxy.orientation); + if (integer != null) { + return integer == (metadata & data.maskMeta); + } + break; + } + + case PISTON: { + Integer integer = data.mapping.get(ClientProxy.orientation); + if (integer != null) { + return BlockPistonBase.determineOrientation(null, x, y, z, player) == BlockPistonBase.getPistonOrientation(metadata); + } + break; + } + } + return false; + } + + return true; + } + + private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player, int x, int y, int z, ForgeDirection direction, float offsetX, float offsetY, float offsetZ) { + ItemStack itemStack = player.getCurrentEquippedItem(); + boolean success = false; + + x += direction.offsetX; + y += direction.offsetY; + z += direction.offsetZ; + + int side = direction.getOpposite().ordinal(); /* copypasted from n.m.client.Minecraft to sooth finicky servers */ - success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, x, y, z, side, world).isCanceled(); - if (success) { - // still not assured! - success = minecraft.playerController.onPlayerRightClick(player, world, itemStack, x, y, z, side, Vec3.createVectorHelper(x + offsetX, y + offsetY, z + offsetZ)); - if (success) { - // yes, some servers actually care about this. - minecraft.thePlayer.swingItem(); - } - } - - if (itemStack != null && itemStack.stackSize == 0 && success) { - player.inventory.mainInventory[player.inventory.currentItem] = null; - } - - return success; - } - - private void syncSneaking(EntityClientPlayerMP player, boolean isSneaking) { - player.setSneaking(isSneaking); - player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? 1 : 2)); - } - - private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) { - return swapToItem(inventory, item, itemDamage, true); - } - - private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage, boolean swapSlots) { - int slot = getInventorySlotWithItem(inventory, item, itemDamage); - - if (this.minecraft.playerController.isInCreativeMode() && (slot < INV_OFFSET_HOTBAR || slot >= INV_OFFSET_HOTBAR + SIZE_HOTBAR) && ConfigurationHandler.swapSlotsQueue.size() > 0) { - inventory.currentItem = getNextSlot(); - inventory.setInventorySlotContents(inventory.currentItem, new ItemStack(item, 1, itemDamage)); - this.minecraft.playerController.sendSlotPacket(inventory.getStackInSlot(inventory.currentItem), SLOT_OFFSET_HOTBAR + inventory.currentItem); - return true; - } - - if (slot >= INV_OFFSET_HOTBAR && slot < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { - inventory.currentItem = slot; - return true; - } else if (swapSlots && slot >= INV_OFFSET_INVENTORY && slot < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { - if (swapSlots(inventory, slot)) { - return swapToItem(inventory, item, itemDamage, false); - } - } - return false; - } - - private int getInventorySlotWithItem(InventoryPlayer inventory, Item item, int itemDamage) { - for (int i = 0; i < inventory.mainInventory.length; i++) { - if (inventory.mainInventory[i] != null && inventory.mainInventory[i].getItem() == item && (itemDamage == WILDCARD_METADATA || inventory.mainInventory[i].getItemDamage() == itemDamage)) { - return i; - } - } - return -1; - } - - private boolean swapSlots(InventoryPlayer inventory, int from) { - if (ConfigurationHandler.swapSlotsQueue.size() > 0) { - int slot = getNextSlot(); - - ItemStack itemStack = inventory.mainInventory[slot + INV_OFFSET_HOTBAR]; - swapSlots(from, slot, itemStack == null || itemStack.stackSize == 0); - return true; - } - - return false; - } - - private int getNextSlot() { - int slot = ConfigurationHandler.swapSlotsQueue.poll() % SIZE_HOTBAR; - ConfigurationHandler.swapSlotsQueue.offer(slot); - return slot; - } - - private boolean swapSlots(int from, int to, boolean targetEmpty) { - if (from >= INV_OFFSET_HOTBAR && from < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { - from = SLOT_OFFSET_HOTBAR + (from - INV_OFFSET_HOTBAR); - } else if (from >= INV_OFFSET_INVENTORY && from < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { - from = SLOT_OFFSET_INVENTORY + (from - INV_OFFSET_INVENTORY); - } else { - return false; - } - - if (to >= INV_OFFSET_HOTBAR && to < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { - to = SLOT_OFFSET_HOTBAR + (to - INV_OFFSET_HOTBAR); - } else if (to >= INV_OFFSET_INVENTORY && to < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { - to = SLOT_OFFSET_INVENTORY + (to - INV_OFFSET_INVENTORY); - } else { - return false; - } - - clickSlot(from); - clickSlot(to); - if (!targetEmpty) { - clickSlot(from); - } - - return true; - } - - private ItemStack clickSlot(int slot) { - return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, slot, 0, 0, this.minecraft.thePlayer); - } + success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, x, y, z, side, world).isCanceled(); + if (success) { + // still not assured! + success = minecraft.playerController.onPlayerRightClick(player, world, itemStack, x, y, z, side, Vec3.createVectorHelper(x + offsetX, y + offsetY, z + offsetZ)); + if (success) { + // yes, some servers actually care about this. + minecraft.thePlayer.swingItem(); + } + } + + if (itemStack != null && itemStack.stackSize == 0 && success) { + player.inventory.mainInventory[player.inventory.currentItem] = null; + } + + return success; + } + + private void syncSneaking(EntityClientPlayerMP player, boolean isSneaking) { + player.setSneaking(isSneaking); + player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? 1 : 2)); + } + + private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) { + return swapToItem(inventory, item, itemDamage, true); + } + + private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage, boolean swapSlots) { + int slot = getInventorySlotWithItem(inventory, item, itemDamage); + + if (this.minecraft.playerController.isInCreativeMode() && (slot < INV_OFFSET_HOTBAR || slot >= INV_OFFSET_HOTBAR + SIZE_HOTBAR) && ConfigurationHandler.swapSlotsQueue.size() > 0) { + inventory.currentItem = getNextSlot(); + inventory.setInventorySlotContents(inventory.currentItem, new ItemStack(item, 1, itemDamage)); + this.minecraft.playerController.sendSlotPacket(inventory.getStackInSlot(inventory.currentItem), SLOT_OFFSET_HOTBAR + inventory.currentItem); + return true; + } + + if (slot >= INV_OFFSET_HOTBAR && slot < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { + inventory.currentItem = slot; + return true; + } else if (swapSlots && slot >= INV_OFFSET_INVENTORY && slot < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + if (swapSlots(inventory, slot)) { + return swapToItem(inventory, item, itemDamage, false); + } + } + return false; + } + + private int getInventorySlotWithItem(InventoryPlayer inventory, Item item, int itemDamage) { + for (int i = 0; i < inventory.mainInventory.length; i++) { + if (inventory.mainInventory[i] != null && inventory.mainInventory[i].getItem() == item && (itemDamage == WILDCARD_METADATA || inventory.mainInventory[i].getItemDamage() == itemDamage)) { + return i; + } + } + return -1; + } + + private boolean swapSlots(InventoryPlayer inventory, int from) { + if (ConfigurationHandler.swapSlotsQueue.size() > 0) { + int slot = getNextSlot(); + + ItemStack itemStack = inventory.mainInventory[slot + INV_OFFSET_HOTBAR]; + swapSlots(from, slot, itemStack == null || itemStack.stackSize == 0); + return true; + } + + return false; + } + + private int getNextSlot() { + int slot = ConfigurationHandler.swapSlotsQueue.poll() % SIZE_HOTBAR; + ConfigurationHandler.swapSlotsQueue.offer(slot); + return slot; + } + + private boolean swapSlots(int from, int to, boolean targetEmpty) { + if (from >= INV_OFFSET_HOTBAR && from < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { + from = SLOT_OFFSET_HOTBAR + (from - INV_OFFSET_HOTBAR); + } else if (from >= INV_OFFSET_INVENTORY && from < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + from = SLOT_OFFSET_INVENTORY + (from - INV_OFFSET_INVENTORY); + } else { + return false; + } + + if (to >= INV_OFFSET_HOTBAR && to < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { + to = SLOT_OFFSET_HOTBAR + (to - INV_OFFSET_HOTBAR); + } else if (to >= INV_OFFSET_INVENTORY && to < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + to = SLOT_OFFSET_INVENTORY + (to - INV_OFFSET_INVENTORY); + } else { + return false; + } + + clickSlot(from); + clickSlot(to); + if (!targetEmpty) { + clickSlot(from); + } + + return true; + } + + private ItemStack clickSlot(int slot) { + return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, slot, 0, 0, this.minecraft.thePlayer); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index d63be3ee..f625800a 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -14,35 +14,35 @@ @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY) public class Schematica { - @Instance(Reference.MODID) - public static Schematica instance; - - @SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT) - public static CommonProxy proxy; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - Reference.logger = event.getModLog(); - ConfigurationHandler.init(event.getSuggestedConfigurationFile()); - proxy.setConfigEntryClasses(); - - proxy.registerKeybindings(); - proxy.createFolders(); - - VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); - } - - @EventHandler - public void init(FMLInitializationEvent event) { - try { - proxy.registerEvents(); - } catch (Exception e) { - Reference.logger.fatal("Could not initialize the mod!", e); - throw new RuntimeException(e); - } - } - - @EventHandler - public void postInit(FMLPostInitializationEvent event) { - } + @Instance(Reference.MODID) + public static Schematica instance; + + @SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT) + public static CommonProxy proxy; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + Reference.logger = event.getModLog(); + ConfigurationHandler.init(event.getSuggestedConfigurationFile()); + proxy.setConfigEntryClasses(); + + proxy.registerKeybindings(); + proxy.createFolders(); + + VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); + } + + @EventHandler + public void init(FMLInitializationEvent event) { + try { + proxy.registerEvents(); + } catch (Exception e) { + Reference.logger.fatal("Could not initialize the mod!", e); + throw new RuntimeException(e); + } + } + + @EventHandler + public void postInit(FMLPostInitializationEvent event) { + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java index dc38a39a..000423a2 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java @@ -7,22 +7,22 @@ import java.util.Set; public class GuiFactory implements IModGuiFactory { - @Override - public void initialize(Minecraft minecraftInstance) { - } + @Override + public void initialize(Minecraft minecraftInstance) { + } - @Override - public Class mainConfigGuiClass() { - return GuiModConfig.class; - } + @Override + public Class mainConfigGuiClass() { + return GuiModConfig.class; + } - @Override - public Set runtimeGuiCategories() { - return null; - } + @Override + public Set runtimeGuiCategories() { + return null; + } - @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { - return null; - } + @Override + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { + return null; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java index 354d93a9..3a228f60 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java @@ -11,29 +11,29 @@ import org.lwjgl.opengl.GL12; public class GuiHelper { - private static final RenderItem renderItem = new RenderItem(); + private static final RenderItem renderItem = new RenderItem(); - public static void drawItemStack(TextureManager textureManager, FontRenderer fontRenderer, int x, int y, ItemStack itemStack) { - drawItemStackSlot(textureManager, x, y); + public static void drawItemStack(TextureManager textureManager, FontRenderer fontRenderer, int x, int y, ItemStack itemStack) { + drawItemStackSlot(textureManager, x, y); - if (itemStack != null && itemStack.getItem() != null) { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - RenderHelper.enableGUIStandardItemLighting(); - renderItem.renderItemIntoGUI(fontRenderer, textureManager, itemStack, x + 2, y + 2); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - } - } + if (itemStack != null && itemStack.getItem() != null) { + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + renderItem.renderItemIntoGUI(fontRenderer, textureManager, itemStack, x + 2, y + 2); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + } - public static void drawItemStackSlot(TextureManager textureManager, int x, int y) { - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - textureManager.bindTexture(Gui.statIcons); - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125f, 18 * 0.0078125f); - tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125f, 18 * 0.0078125f); - tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125f, 0 * 0.0078125f); - tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125f, 0 * 0.0078125f); - tessellator.draw(); - } + public static void drawItemStackSlot(TextureManager textureManager, int x, int y) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + textureManager.bindTexture(Gui.statIcons); + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125f, 18 * 0.0078125f); + tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125f, 18 * 0.0078125f); + tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125f, 0 * 0.0078125f); + tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125f, 0 * 0.0078125f); + tessellator.draw(); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java index 7b6955a4..a1e2f568 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java @@ -12,15 +12,15 @@ import java.util.List; public class GuiModConfig extends GuiConfig { - public GuiModConfig(GuiScreen guiScreen) { - super(guiScreen, getConfigElements(), Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())); - } + public GuiModConfig(GuiScreen guiScreen) { + super(guiScreen, getConfigElements(), Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())); + } - private static List getConfigElements() { - List elements = new ArrayList(); - for (String name : ConfigurationHandler.configuration.getCategoryNames()) { - elements.add(new ConfigElement(ConfigurationHandler.configuration.getCategory(name).setLanguageKey(Names.Config.LANG_PREFIX + ".category." + name))); - } - return elements; - } + private static List getConfigElements() { + List elements = new ArrayList(); + for (String name : ConfigurationHandler.configuration.getCategoryNames()) { + elements.add(new ConfigElement(ConfigurationHandler.configuration.getCategory(name).setLanguageKey(Names.Config.LANG_PREFIX + ".category." + name))); + } + return elements; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 34e7a5d4..385edc76 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -10,232 +10,232 @@ import net.minecraft.client.resources.I18n; public class GuiSchematicControl extends GuiScreen { - private static final Vector3i ZERO = new Vector3i(); + private static final Vector3i ZERO = new Vector3i(); - @SuppressWarnings("unused") - private final GuiScreen prevGuiScreen; + @SuppressWarnings("unused") + private final GuiScreen prevGuiScreen; - private final SchematicWorld schematic; - private final SchematicPrinter printer; + private final SchematicWorld schematic; + private final SchematicPrinter printer; - private int centerX = 0; - private int centerY = 0; + private int centerX = 0; + private int centerY = 0; - private GuiButton btnDecX = null; - private GuiButton btnAmountX = null; - private GuiButton btnIncX = null; + private GuiButton btnDecX = null; + private GuiButton btnAmountX = null; + private GuiButton btnIncX = null; - private GuiButton btnDecY = null; - private GuiButton btnAmountY = null; - private GuiButton btnIncY = null; + private GuiButton btnDecY = null; + private GuiButton btnAmountY = null; + private GuiButton btnIncY = null; - private GuiButton btnDecZ = null; - private GuiButton btnAmountZ = null; - private GuiButton btnIncZ = null; + private GuiButton btnDecZ = null; + private GuiButton btnAmountZ = null; + private GuiButton btnIncZ = null; - private GuiButton btnDecLayer = null; - private GuiButton btnIncLayer = null; + private GuiButton btnDecLayer = null; + private GuiButton btnIncLayer = null; - private GuiButton btnHide = null; - private GuiButton btnMove = null; - private GuiButton btnFlip = null; - private GuiButton btnRotate = null; + private GuiButton btnHide = null; + private GuiButton btnMove = null; + private GuiButton btnFlip = null; + private GuiButton btnRotate = null; - private GuiButton btnMaterials = null; - private GuiButton btnPrint = null; + private GuiButton btnMaterials = null; + private GuiButton btnPrint = null; - private int incrementX = 0; - private int incrementY = 0; - private int incrementZ = 0; + private int incrementX = 0; + private int incrementY = 0; + private int incrementZ = 0; - private final String strMoveSchematic = I18n.format("schematica.gui.moveschematic"); - private final String strLayers = I18n.format("schematica.gui.layers"); - private final String strOperations = I18n.format("schematica.gui.operations"); - private final String strAll = I18n.format("schematica.gui.all"); - private final String strX = I18n.format("schematica.gui.x"); - private final String strY = I18n.format("schematica.gui.y"); - private final String strZ = I18n.format("schematica.gui.z"); - private final String strMaterials = I18n.format("schematica.gui.materials"); - private final String strPrinter = I18n.format("schematica.gui.printer"); + private final String strMoveSchematic = I18n.format("schematica.gui.moveschematic"); + private final String strLayers = I18n.format("schematica.gui.layers"); + private final String strOperations = I18n.format("schematica.gui.operations"); + private final String strAll = I18n.format("schematica.gui.all"); + private final String strX = I18n.format("schematica.gui.x"); + private final String strY = I18n.format("schematica.gui.y"); + private final String strZ = I18n.format("schematica.gui.z"); + private final String strMaterials = I18n.format("schematica.gui.materials"); + private final String strPrinter = I18n.format("schematica.gui.printer"); - public GuiSchematicControl(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; - this.schematic = Schematica.proxy.getActiveSchematic(); - this.printer = SchematicPrinter.INSTANCE; - } - - @Override - public void initGui() { - this.centerX = this.width / 2; - this.centerY = this.height / 2; - - this.buttonList.clear(); - - int id = 0; - - this.btnDecX = new GuiButton(id++, this.centerX - 50, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecX); - - this.btnAmountX = new GuiButton(id++, this.centerX - 15, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementX])); - this.buttonList.add(this.btnAmountX); - - this.btnIncX = new GuiButton(id++, this.centerX + 20, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncX); - - this.btnDecY = new GuiButton(id++, this.centerX - 50, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecY); - - this.btnAmountY = new GuiButton(id++, this.centerX - 15, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementY])); - this.buttonList.add(this.btnAmountY); - - this.btnIncY = new GuiButton(id++, this.centerX + 20, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncY); - - this.btnDecZ = new GuiButton(id++, this.centerX - 50, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecZ); - - this.btnAmountZ = new GuiButton(id++, this.centerX - 15, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementZ])); - this.buttonList.add(this.btnAmountZ); - - this.btnIncZ = new GuiButton(id++, this.centerX + 20, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncZ); - - this.btnDecLayer = new GuiButton(id++, this.width - 90, this.height - 150, 25, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecLayer); - - this.btnIncLayer = new GuiButton(id++, this.width - 35, this.height - 150, 25, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncLayer); - - this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, I18n.format(this.schematic != null && this.schematic.isRendering ? "schematica.gui.hide" : "schematica.gui.show")); - this.buttonList.add(this.btnHide); - - this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format("schematica.gui.movehere")); - this.buttonList.add(this.btnMove); - - this.btnFlip = new GuiButton(id++, this.width - 90, this.height - 55, 80, 20, I18n.format("schematica.gui.flip")); - this.buttonList.add(this.btnFlip); - - this.btnRotate = new GuiButton(id++, this.width - 90, this.height - 30, 80, 20, I18n.format("schematica.gui.rotate")); - this.buttonList.add(this.btnRotate); - - this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, I18n.format("schematica.gui.materials")); - this.buttonList.add(this.btnMaterials); - - this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, I18n.format(this.printer.isPrinting() ? "schematica.gui.on" : "schematica.gui.off")); - this.buttonList.add(this.btnPrint); - - this.btnDecX.enabled = this.schematic != null; - this.btnAmountX.enabled = this.schematic != null; - this.btnIncX.enabled = this.schematic != null; - - this.btnDecY.enabled = this.schematic != null; - this.btnAmountY.enabled = this.schematic != null; - this.btnIncY.enabled = this.schematic != null; - - this.btnDecZ.enabled = this.schematic != null; - this.btnAmountZ.enabled = this.schematic != null; - this.btnIncZ.enabled = this.schematic != null; - - this.btnDecLayer.enabled = this.schematic != null; - this.btnIncLayer.enabled = this.schematic != null; - this.btnHide.enabled = this.schematic != null; - this.btnMove.enabled = this.schematic != null; - // this.btnFlip.enabled = this.settings.schematic != null; - this.btnFlip.enabled = false; - this.btnRotate.enabled = this.schematic != null; - this.btnMaterials.enabled = this.schematic != null; - this.btnPrint.enabled = this.schematic != null && this.printer.isEnabled(); - } - - @Override - protected void actionPerformed(GuiButton guiButton) { - if (guiButton.enabled) { - if (guiButton.id == this.btnDecX.id) { - this.schematic.position.x -= ClientProxy.INCREMENTS[this.incrementX]; - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnIncX.id) { - this.schematic.position.x += ClientProxy.INCREMENTS[this.incrementX]; - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnAmountX.id) { - this.incrementX = (this.incrementX + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementX]); - } else if (guiButton.id == this.btnDecY.id) { - this.schematic.position.y -= ClientProxy.INCREMENTS[this.incrementY]; - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnIncY.id) { - this.schematic.position.y += ClientProxy.INCREMENTS[this.incrementY]; - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnAmountY.id) { - this.incrementY = (this.incrementY + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementY]); - } else if (guiButton.id == this.btnDecZ.id) { - this.schematic.position.z -= ClientProxy.INCREMENTS[this.incrementZ]; - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnIncZ.id) { - this.schematic.position.z += ClientProxy.INCREMENTS[this.incrementZ]; - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnAmountZ.id) { - this.incrementZ = (this.incrementZ + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementZ]); - } else if (guiButton.id == this.btnDecLayer.id) { - if (this.schematic != null) { - this.schematic.decrementRenderingLayer(); - } - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnIncLayer.id) { - if (this.schematic != null) { - this.schematic.incrementRenderingLayer(); - } - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnHide.id) { - this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); - } else if (guiButton.id == this.btnMove.id) { - ClientProxy.moveSchematicToPlayer(this.schematic); - ClientProxy.rendererSchematicGlobal.refresh(); - } else if (guiButton.id == this.btnFlip.id) { - if (this.schematic != null) { - this.schematic.flip(); - ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); - SchematicPrinter.INSTANCE.refresh(); - } - } else if (guiButton.id == this.btnRotate.id) { - if (this.schematic != null) { - this.schematic.rotate(); - ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); - SchematicPrinter.INSTANCE.refresh(); - } - } else if (guiButton.id == this.btnMaterials.id) { - this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); - } else if (guiButton.id == this.btnPrint.id && this.printer.isEnabled()) { - boolean isPrinting = this.printer.togglePrinting(); - this.btnPrint.displayString = I18n.format(isPrinting ? "schematica.gui.on" : "schematica.gui.off"); - } - } - } - - @Override - public void drawScreen(int par1, int par2, float par3) { - // drawDefaultBackground(); - - drawCenteredString(this.fontRendererObj, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strMaterials, 50, this.height - 85, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strPrinter, 50, this.height - 45, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); - - int renderingLayer = this.schematic != null ? this.schematic.renderingLayer : -1; - drawCenteredString(this.fontRendererObj, renderingLayer < 0 ? this.strAll : Integer.toString(renderingLayer + 1), this.width - 50, this.height - 145, 0xFFFFFF); - - Vector3i position = this.schematic != null ? this.schematic.position : ZERO; - drawString(this.fontRendererObj, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(position.x), this.centerX + 55, this.centerY - 24, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(position.y), this.centerX + 55, this.centerY + 1, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(position.z), this.centerX + 55, this.centerY + 26, 0xFFFFFF); - - super.drawScreen(par1, par2, par3); - } + public GuiSchematicControl(GuiScreen guiScreen) { + this.prevGuiScreen = guiScreen; + this.schematic = Schematica.proxy.getActiveSchematic(); + this.printer = SchematicPrinter.INSTANCE; + } + + @Override + public void initGui() { + this.centerX = this.width / 2; + this.centerY = this.height / 2; + + this.buttonList.clear(); + + int id = 0; + + this.btnDecX = new GuiButton(id++, this.centerX - 50, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecX); + + this.btnAmountX = new GuiButton(id++, this.centerX - 15, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementX])); + this.buttonList.add(this.btnAmountX); + + this.btnIncX = new GuiButton(id++, this.centerX + 20, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncX); + + this.btnDecY = new GuiButton(id++, this.centerX - 50, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecY); + + this.btnAmountY = new GuiButton(id++, this.centerX - 15, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementY])); + this.buttonList.add(this.btnAmountY); + + this.btnIncY = new GuiButton(id++, this.centerX + 20, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncY); + + this.btnDecZ = new GuiButton(id++, this.centerX - 50, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecZ); + + this.btnAmountZ = new GuiButton(id++, this.centerX - 15, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementZ])); + this.buttonList.add(this.btnAmountZ); + + this.btnIncZ = new GuiButton(id++, this.centerX + 20, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncZ); + + this.btnDecLayer = new GuiButton(id++, this.width - 90, this.height - 150, 25, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecLayer); + + this.btnIncLayer = new GuiButton(id++, this.width - 35, this.height - 150, 25, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncLayer); + + this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, I18n.format(this.schematic != null && this.schematic.isRendering ? "schematica.gui.hide" : "schematica.gui.show")); + this.buttonList.add(this.btnHide); + + this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format("schematica.gui.movehere")); + this.buttonList.add(this.btnMove); + + this.btnFlip = new GuiButton(id++, this.width - 90, this.height - 55, 80, 20, I18n.format("schematica.gui.flip")); + this.buttonList.add(this.btnFlip); + + this.btnRotate = new GuiButton(id++, this.width - 90, this.height - 30, 80, 20, I18n.format("schematica.gui.rotate")); + this.buttonList.add(this.btnRotate); + + this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, I18n.format("schematica.gui.materials")); + this.buttonList.add(this.btnMaterials); + + this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, I18n.format(this.printer.isPrinting() ? "schematica.gui.on" : "schematica.gui.off")); + this.buttonList.add(this.btnPrint); + + this.btnDecX.enabled = this.schematic != null; + this.btnAmountX.enabled = this.schematic != null; + this.btnIncX.enabled = this.schematic != null; + + this.btnDecY.enabled = this.schematic != null; + this.btnAmountY.enabled = this.schematic != null; + this.btnIncY.enabled = this.schematic != null; + + this.btnDecZ.enabled = this.schematic != null; + this.btnAmountZ.enabled = this.schematic != null; + this.btnIncZ.enabled = this.schematic != null; + + this.btnDecLayer.enabled = this.schematic != null; + this.btnIncLayer.enabled = this.schematic != null; + this.btnHide.enabled = this.schematic != null; + this.btnMove.enabled = this.schematic != null; + // this.btnFlip.enabled = this.settings.schematic != null; + this.btnFlip.enabled = false; + this.btnRotate.enabled = this.schematic != null; + this.btnMaterials.enabled = this.schematic != null; + this.btnPrint.enabled = this.schematic != null && this.printer.isEnabled(); + } + + @Override + protected void actionPerformed(GuiButton guiButton) { + if (guiButton.enabled) { + if (guiButton.id == this.btnDecX.id) { + this.schematic.position.x -= ClientProxy.INCREMENTS[this.incrementX]; + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnIncX.id) { + this.schematic.position.x += ClientProxy.INCREMENTS[this.incrementX]; + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnAmountX.id) { + this.incrementX = (this.incrementX + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementX]); + } else if (guiButton.id == this.btnDecY.id) { + this.schematic.position.y -= ClientProxy.INCREMENTS[this.incrementY]; + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnIncY.id) { + this.schematic.position.y += ClientProxy.INCREMENTS[this.incrementY]; + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnAmountY.id) { + this.incrementY = (this.incrementY + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementY]); + } else if (guiButton.id == this.btnDecZ.id) { + this.schematic.position.z -= ClientProxy.INCREMENTS[this.incrementZ]; + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnIncZ.id) { + this.schematic.position.z += ClientProxy.INCREMENTS[this.incrementZ]; + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnAmountZ.id) { + this.incrementZ = (this.incrementZ + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementZ]); + } else if (guiButton.id == this.btnDecLayer.id) { + if (this.schematic != null) { + this.schematic.decrementRenderingLayer(); + } + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnIncLayer.id) { + if (this.schematic != null) { + this.schematic.incrementRenderingLayer(); + } + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnHide.id) { + this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); + } else if (guiButton.id == this.btnMove.id) { + ClientProxy.moveSchematicToPlayer(this.schematic); + ClientProxy.rendererSchematicGlobal.refresh(); + } else if (guiButton.id == this.btnFlip.id) { + if (this.schematic != null) { + this.schematic.flip(); + ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); + SchematicPrinter.INSTANCE.refresh(); + } + } else if (guiButton.id == this.btnRotate.id) { + if (this.schematic != null) { + this.schematic.rotate(); + ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); + SchematicPrinter.INSTANCE.refresh(); + } + } else if (guiButton.id == this.btnMaterials.id) { + this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); + } else if (guiButton.id == this.btnPrint.id && this.printer.isEnabled()) { + boolean isPrinting = this.printer.togglePrinting(); + this.btnPrint.displayString = I18n.format(isPrinting ? "schematica.gui.on" : "schematica.gui.off"); + } + } + } + + @Override + public void drawScreen(int par1, int par2, float par3) { + // drawDefaultBackground(); + + drawCenteredString(this.fontRendererObj, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); + drawCenteredString(this.fontRendererObj, this.strMaterials, 50, this.height - 85, 0xFFFFFF); + drawCenteredString(this.fontRendererObj, this.strPrinter, 50, this.height - 45, 0xFFFFFF); + drawCenteredString(this.fontRendererObj, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); + drawCenteredString(this.fontRendererObj, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); + + int renderingLayer = this.schematic != null ? this.schematic.renderingLayer : -1; + drawCenteredString(this.fontRendererObj, renderingLayer < 0 ? this.strAll : Integer.toString(renderingLayer + 1), this.width - 50, this.height - 145, 0xFFFFFF); + + Vector3i position = this.schematic != null ? this.schematic.position : ZERO; + drawString(this.fontRendererObj, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(position.x), this.centerX + 55, this.centerY - 24, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(position.y), this.centerX + 55, this.centerY + 1, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(position.z), this.centerX + 55, this.centerY + 26, 0xFFFFFF); + + super.drawScreen(par1, par2, par3); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java index ed4faaf1..1414ad19 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java @@ -5,43 +5,43 @@ import net.minecraft.item.ItemStack; public class GuiSchematicEntry { - private final String name; - private final ItemStack itemStack; - private final boolean isDirectory; - - public GuiSchematicEntry(String name, ItemStack itemStack, boolean isDirectory) { - this(name, itemStack.getItem(), itemStack.getItemDamage(), isDirectory); - } - - public GuiSchematicEntry(String name, Item item, int itemDamage, boolean isDirectory) { - this.name = name; - this.isDirectory = isDirectory; - this.itemStack = new ItemStack(item, 1, itemDamage); - } - - public GuiSchematicEntry(String name, Block block, int itemDamage, boolean isDirectory) { - this.name = name; - this.isDirectory = isDirectory; - this.itemStack = new ItemStack(block, 1, itemDamage); - } - - public String getName() { - return this.name; - } - - public Item getItem() { - return this.itemStack.getItem(); - } - - public int getItemDamage() { - return this.itemStack.getItemDamage(); - } - - public boolean isDirectory() { - return this.isDirectory; - } - - public ItemStack getItemStack() { - return this.itemStack; - } + private final String name; + private final ItemStack itemStack; + private final boolean isDirectory; + + public GuiSchematicEntry(String name, ItemStack itemStack, boolean isDirectory) { + this(name, itemStack.getItem(), itemStack.getItemDamage(), isDirectory); + } + + public GuiSchematicEntry(String name, Item item, int itemDamage, boolean isDirectory) { + this.name = name; + this.isDirectory = isDirectory; + this.itemStack = new ItemStack(item, 1, itemDamage); + } + + public GuiSchematicEntry(String name, Block block, int itemDamage, boolean isDirectory) { + this.name = name; + this.isDirectory = isDirectory; + this.itemStack = new ItemStack(block, 1, itemDamage); + } + + public String getName() { + return this.name; + } + + public Item getItem() { + return this.itemStack.getItem(); + } + + public int getItemDamage() { + return this.itemStack.getItemDamage(); + } + + public boolean isDirectory() { + return this.isDirectory; + } + + public ItemStack getItemStack() { + return this.itemStack; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 3dfdbc43..7dc9e887 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -22,149 +22,149 @@ import java.util.List; public class GuiSchematicLoad extends GuiScreen { - private static final FileFilterSchematic FILE_FILTER_FOLDER = new FileFilterSchematic(true); - private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); - - private final GuiScreen prevGuiScreen; - private GuiSchematicLoadSlot guiSchematicLoadSlot; - - private GuiButton btnOpenDir = null; - private GuiButton btnDone = null; - - private final String strTitle = I18n.format("schematica.gui.title"); - private final String strFolderInfo = I18n.format("schematica.gui.folderInfo"); - - protected File currentDirectory = ConfigurationHandler.schematicDirectory; - protected final List schematicFiles = new ArrayList(); - - public GuiSchematicLoad(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; - } - - @Override - public void initGui() { - int id = 0; - - this.btnOpenDir = new GuiButton(id++, this.width / 2 - 154, this.height - 36, 150, 20, I18n.format("schematica.gui.openFolder")); - this.buttonList.add(this.btnOpenDir); - - this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 36, 150, 20, I18n.format("schematica.gui.done")); - this.buttonList.add(this.btnDone); - - this.guiSchematicLoadSlot = new GuiSchematicLoadSlot(this); - - reloadSchematics(); - } - - @Override - protected void actionPerformed(GuiButton guiButton) { - if (guiButton.enabled) { - if (guiButton.id == this.btnOpenDir.id) { - boolean retry = false; - - try { - Class c = Class.forName("java.awt.Desktop"); - Object m = c.getMethod("getDesktop").invoke(null); - c.getMethod("browse", URI.class).invoke(m, ConfigurationHandler.schematicDirectory.toURI()); - } catch (Throwable e) { - retry = true; - } - - if (retry) { - Reference.logger.info("Opening via Sys class!"); - Sys.openURL("file://" + ConfigurationHandler.schematicDirectory.getAbsolutePath()); - } - } else if (guiButton.id == this.btnDone.id) { - if (Schematica.proxy.isLoadEnabled) { - loadSchematic(); - } - this.mc.displayGuiScreen(this.prevGuiScreen); - } else { - this.guiSchematicLoadSlot.actionPerformed(guiButton); - } - } - } - - @Override - public void drawScreen(int x, int y, float partialTicks) { - this.guiSchematicLoadSlot.drawScreen(x, y, partialTicks); - - drawCenteredString(this.fontRendererObj, this.strTitle, this.width / 2, 4, 0x00FFFFFF); - drawCenteredString(this.fontRendererObj, this.strFolderInfo, this.width / 2 - 78, this.height - 12, 0x00808080); - - super.drawScreen(x, y, partialTicks); - } - - @Override - public void onGuiClosed() { - // loadSchematic(); - } - - protected void changeDirectory(String directory) { - this.currentDirectory = new File(this.currentDirectory, directory); - - reloadSchematics(); - } - - protected void reloadSchematics() { - String name = null; - Item item = null; - - this.schematicFiles.clear(); - - try { - if (!this.currentDirectory.getCanonicalPath().equals(ConfigurationHandler.schematicDirectory.getCanonicalPath())) { - this.schematicFiles.add(new GuiSchematicEntry("..", Items.lava_bucket, 0, true)); - } - } catch (IOException e) { - Reference.logger.error("Failed to add GuiSchematicEntry!", e); - } - - File[] filesFolders = this.currentDirectory.listFiles(FILE_FILTER_FOLDER); - if (filesFolders == null) { - Reference.logger.error(String.format("listFiles returned null (directory: %s)!", this.currentDirectory)); - } else { - for (File file : filesFolders) { - if (file == null) { - continue; - } - - name = file.getName(); - - File[] files = file.listFiles(); - item = (files == null || files.length == 0) ? Items.bucket : Items.water_bucket; - - this.schematicFiles.add(new GuiSchematicEntry(name, item, 0, file.isDirectory())); - } - } - - File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); - if (filesSchematics == null || filesSchematics.length == 0) { - this.schematicFiles.add(new GuiSchematicEntry(I18n.format("schematica.gui.noschematic"), Blocks.dirt, 0, false)); - } else { - for (File file : filesSchematics) { - name = file.getName(); - - this.schematicFiles.add(new GuiSchematicEntry(name, SchematicUtil.getIconFromFile(file), file.isDirectory())); - } - } - } - - private void loadSchematic() { - int selectedIndex = this.guiSchematicLoadSlot.selectedIndex; - - try { - if (selectedIndex >= 0 && selectedIndex < this.schematicFiles.size()) { - GuiSchematicEntry schematicEntry = this.schematicFiles.get(selectedIndex); - if (Schematica.proxy.loadSchematic(null, this.currentDirectory, schematicEntry.getName())) { - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (schematic != null) { - ClientProxy.moveSchematicToPlayer(schematic); - } - } - } - } catch (Exception e) { - Reference.logger.error("Failed to load schematic!", e); - } - } + private static final FileFilterSchematic FILE_FILTER_FOLDER = new FileFilterSchematic(true); + private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); + + private final GuiScreen prevGuiScreen; + private GuiSchematicLoadSlot guiSchematicLoadSlot; + + private GuiButton btnOpenDir = null; + private GuiButton btnDone = null; + + private final String strTitle = I18n.format("schematica.gui.title"); + private final String strFolderInfo = I18n.format("schematica.gui.folderInfo"); + + protected File currentDirectory = ConfigurationHandler.schematicDirectory; + protected final List schematicFiles = new ArrayList(); + + public GuiSchematicLoad(GuiScreen guiScreen) { + this.prevGuiScreen = guiScreen; + } + + @Override + public void initGui() { + int id = 0; + + this.btnOpenDir = new GuiButton(id++, this.width / 2 - 154, this.height - 36, 150, 20, I18n.format("schematica.gui.openFolder")); + this.buttonList.add(this.btnOpenDir); + + this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 36, 150, 20, I18n.format("schematica.gui.done")); + this.buttonList.add(this.btnDone); + + this.guiSchematicLoadSlot = new GuiSchematicLoadSlot(this); + + reloadSchematics(); + } + + @Override + protected void actionPerformed(GuiButton guiButton) { + if (guiButton.enabled) { + if (guiButton.id == this.btnOpenDir.id) { + boolean retry = false; + + try { + Class c = Class.forName("java.awt.Desktop"); + Object m = c.getMethod("getDesktop").invoke(null); + c.getMethod("browse", URI.class).invoke(m, ConfigurationHandler.schematicDirectory.toURI()); + } catch (Throwable e) { + retry = true; + } + + if (retry) { + Reference.logger.info("Opening via Sys class!"); + Sys.openURL("file://" + ConfigurationHandler.schematicDirectory.getAbsolutePath()); + } + } else if (guiButton.id == this.btnDone.id) { + if (Schematica.proxy.isLoadEnabled) { + loadSchematic(); + } + this.mc.displayGuiScreen(this.prevGuiScreen); + } else { + this.guiSchematicLoadSlot.actionPerformed(guiButton); + } + } + } + + @Override + public void drawScreen(int x, int y, float partialTicks) { + this.guiSchematicLoadSlot.drawScreen(x, y, partialTicks); + + drawCenteredString(this.fontRendererObj, this.strTitle, this.width / 2, 4, 0x00FFFFFF); + drawCenteredString(this.fontRendererObj, this.strFolderInfo, this.width / 2 - 78, this.height - 12, 0x00808080); + + super.drawScreen(x, y, partialTicks); + } + + @Override + public void onGuiClosed() { + // loadSchematic(); + } + + protected void changeDirectory(String directory) { + this.currentDirectory = new File(this.currentDirectory, directory); + + reloadSchematics(); + } + + protected void reloadSchematics() { + String name = null; + Item item = null; + + this.schematicFiles.clear(); + + try { + if (!this.currentDirectory.getCanonicalPath().equals(ConfigurationHandler.schematicDirectory.getCanonicalPath())) { + this.schematicFiles.add(new GuiSchematicEntry("..", Items.lava_bucket, 0, true)); + } + } catch (IOException e) { + Reference.logger.error("Failed to add GuiSchematicEntry!", e); + } + + File[] filesFolders = this.currentDirectory.listFiles(FILE_FILTER_FOLDER); + if (filesFolders == null) { + Reference.logger.error(String.format("listFiles returned null (directory: %s)!", this.currentDirectory)); + } else { + for (File file : filesFolders) { + if (file == null) { + continue; + } + + name = file.getName(); + + File[] files = file.listFiles(); + item = (files == null || files.length == 0) ? Items.bucket : Items.water_bucket; + + this.schematicFiles.add(new GuiSchematicEntry(name, item, 0, file.isDirectory())); + } + } + + File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); + if (filesSchematics == null || filesSchematics.length == 0) { + this.schematicFiles.add(new GuiSchematicEntry(I18n.format("schematica.gui.noschematic"), Blocks.dirt, 0, false)); + } else { + for (File file : filesSchematics) { + name = file.getName(); + + this.schematicFiles.add(new GuiSchematicEntry(name, SchematicUtil.getIconFromFile(file), file.isDirectory())); + } + } + } + + private void loadSchematic() { + int selectedIndex = this.guiSchematicLoadSlot.selectedIndex; + + try { + if (selectedIndex >= 0 && selectedIndex < this.schematicFiles.size()) { + GuiSchematicEntry schematicEntry = this.schematicFiles.get(selectedIndex); + if (Schematica.proxy.loadSchematic(null, this.currentDirectory, schematicEntry.getName())) { + SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null) { + ClientProxy.moveSchematicToPlayer(schematic); + } + } + } + } catch (Exception e) { + Reference.logger.error("Failed to load schematic!", e); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java index 602d16de..b5e78817 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java @@ -5,63 +5,63 @@ import net.minecraft.client.renderer.Tessellator; public class GuiSchematicLoadSlot extends GuiSlot { - private final Minecraft minecraft = Minecraft.getMinecraft(); + private final Minecraft minecraft = Minecraft.getMinecraft(); - private final GuiSchematicLoad guiSchematicLoad; + private final GuiSchematicLoad guiSchematicLoad; - protected int selectedIndex = -1; + protected int selectedIndex = -1; - public GuiSchematicLoadSlot(GuiSchematicLoad guiSchematicLoad) { - super(Minecraft.getMinecraft(), guiSchematicLoad.width, guiSchematicLoad.height, 16, guiSchematicLoad.height - 40, 24); - this.guiSchematicLoad = guiSchematicLoad; - } + public GuiSchematicLoadSlot(GuiSchematicLoad guiSchematicLoad) { + super(Minecraft.getMinecraft(), guiSchematicLoad.width, guiSchematicLoad.height, 16, guiSchematicLoad.height - 40, 24); + this.guiSchematicLoad = guiSchematicLoad; + } - @Override - protected int getSize() { - return this.guiSchematicLoad.schematicFiles.size(); - } + @Override + protected int getSize() { + return this.guiSchematicLoad.schematicFiles.size(); + } - @Override - protected void elementClicked(int index, boolean par2, int par3, int par4) { - GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); - if (schematic.isDirectory()) { - this.guiSchematicLoad.changeDirectory(schematic.getName()); - this.selectedIndex = -1; - } else { - this.selectedIndex = index; - } - } + @Override + protected void elementClicked(int index, boolean par2, int par3, int par4) { + GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); + if (schematic.isDirectory()) { + this.guiSchematicLoad.changeDirectory(schematic.getName()); + this.selectedIndex = -1; + } else { + this.selectedIndex = index; + } + } - @Override - protected boolean isSelected(int index) { - return index == this.selectedIndex; - } + @Override + protected boolean isSelected(int index) { + return index == this.selectedIndex; + } - @Override - protected void drawBackground() { - } + @Override + protected void drawBackground() { + } - @Override - protected void drawContainerBackground(Tessellator tessellator) { - } + @Override + protected void drawContainerBackground(Tessellator tessellator) { + } - @Override - protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellator, int par6, int par7) { - if (index < 0 || index >= this.guiSchematicLoad.schematicFiles.size()) { - return; - } + @Override + protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellator, int par6, int par7) { + if (index < 0 || index >= this.guiSchematicLoad.schematicFiles.size()) { + return; + } - GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); - String schematicName = schematic.getName(); + GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); + String schematicName = schematic.getName(); - if (schematic.isDirectory()) { - schematicName += "/"; - } else { - schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); - } + if (schematic.isDirectory()) { + schematicName += "/"; + } else { + schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); + } - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, schematic.getItemStack()); + GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, schematic.getItemStack()); - this.guiSchematicLoad.drawString(this.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); - } + this.guiSchematicLoad.drawString(this.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java index e1cab739..673da284 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java @@ -11,53 +11,53 @@ import java.util.List; public class GuiSchematicMaterials extends GuiScreen { - private final GuiScreen prevGuiScreen; - private GuiSchematicMaterialsSlot guiSchematicMaterialsSlot; - - private GuiButton btnDone = null; - - private final String strMaterialName = I18n.format("schematica.gui.materialname"); - private final String strMaterialAmount = I18n.format("schematica.gui.materialamount"); - - protected final List blockList; - - public GuiSchematicMaterials(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (schematic != null) { - this.blockList = schematic.getBlockList(); - } else { - this.blockList = new ArrayList(); - } - } - - @Override - public void initGui() { - int id = 0; - - this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 30, 150, 20, I18n.format("schematica.gui.done")); - this.buttonList.add(this.btnDone); - - this.guiSchematicMaterialsSlot = new GuiSchematicMaterialsSlot(this); - } - - @Override - protected void actionPerformed(GuiButton guiButton) { - if (guiButton.enabled) { - if (guiButton.id == this.btnDone.id) { - this.mc.displayGuiScreen(this.prevGuiScreen); - } else { - this.guiSchematicMaterialsSlot.actionPerformed(guiButton); - } - } - } - - @Override - public void drawScreen(int x, int y, float partialTicks) { - this.guiSchematicMaterialsSlot.drawScreen(x, y, partialTicks); - - drawString(this.fontRendererObj, this.strMaterialName, this.width / 2 - 108, 4, 0x00FFFFFF); - drawString(this.fontRendererObj, this.strMaterialAmount, this.width / 2 + 108 - this.fontRendererObj.getStringWidth(this.strMaterialAmount), 4, 0x00FFFFFF); - super.drawScreen(x, y, partialTicks); - } + private final GuiScreen prevGuiScreen; + private GuiSchematicMaterialsSlot guiSchematicMaterialsSlot; + + private GuiButton btnDone = null; + + private final String strMaterialName = I18n.format("schematica.gui.materialname"); + private final String strMaterialAmount = I18n.format("schematica.gui.materialamount"); + + protected final List blockList; + + public GuiSchematicMaterials(GuiScreen guiScreen) { + this.prevGuiScreen = guiScreen; + SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null) { + this.blockList = schematic.getBlockList(); + } else { + this.blockList = new ArrayList(); + } + } + + @Override + public void initGui() { + int id = 0; + + this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 30, 150, 20, I18n.format("schematica.gui.done")); + this.buttonList.add(this.btnDone); + + this.guiSchematicMaterialsSlot = new GuiSchematicMaterialsSlot(this); + } + + @Override + protected void actionPerformed(GuiButton guiButton) { + if (guiButton.enabled) { + if (guiButton.id == this.btnDone.id) { + this.mc.displayGuiScreen(this.prevGuiScreen); + } else { + this.guiSchematicMaterialsSlot.actionPerformed(guiButton); + } + } + } + + @Override + public void drawScreen(int x, int y, float partialTicks) { + this.guiSchematicMaterialsSlot.drawScreen(x, y, partialTicks); + + drawString(this.fontRendererObj, this.strMaterialName, this.width / 2 - 108, 4, 0x00FFFFFF); + drawString(this.fontRendererObj, this.strMaterialAmount, this.width / 2 + 108 - this.fontRendererObj.getStringWidth(this.strMaterialAmount), 4, 0x00FFFFFF); + super.drawScreen(x, y, partialTicks); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index 052d628e..0b36a1f9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -7,59 +7,59 @@ import net.minecraft.item.ItemStack; class GuiSchematicMaterialsSlot extends GuiSlot { - private final Minecraft minecraft = Minecraft.getMinecraft(); + private final Minecraft minecraft = Minecraft.getMinecraft(); - private final GuiSchematicMaterials guiSchematicMaterials; + private final GuiSchematicMaterials guiSchematicMaterials; - protected int selectedIndex = -1; + protected int selectedIndex = -1; - private final String strUnknownBlock = I18n.format("schematica.gui.unknownblock"); + private final String strUnknownBlock = I18n.format("schematica.gui.unknownblock"); - public GuiSchematicMaterialsSlot(GuiSchematicMaterials par1) { - super(Minecraft.getMinecraft(), par1.width, par1.height, 16, par1.height - 34, 24); - this.guiSchematicMaterials = par1; - this.selectedIndex = -1; - } + public GuiSchematicMaterialsSlot(GuiSchematicMaterials par1) { + super(Minecraft.getMinecraft(), par1.width, par1.height, 16, par1.height - 34, 24); + this.guiSchematicMaterials = par1; + this.selectedIndex = -1; + } - @Override - protected int getSize() { - return this.guiSchematicMaterials.blockList.size(); - } + @Override + protected int getSize() { + return this.guiSchematicMaterials.blockList.size(); + } - @Override - protected void elementClicked(int index, boolean par2, int par3, int par4) { - this.selectedIndex = index; - } + @Override + protected void elementClicked(int index, boolean par2, int par3, int par4) { + this.selectedIndex = index; + } - @Override - protected boolean isSelected(int index) { - return index == this.selectedIndex; - } + @Override + protected boolean isSelected(int index) { + return index == this.selectedIndex; + } - @Override - protected void drawBackground() { - } + @Override + protected void drawBackground() { + } - @Override - protected void drawContainerBackground(Tessellator tessellator) { - } + @Override + protected void drawContainerBackground(Tessellator tessellator) { + } - @Override - protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellator, int par6, int par7) { - ItemStack itemStack = this.guiSchematicMaterials.blockList.get(index); + @Override + protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellator, int par6, int par7) { + ItemStack itemStack = this.guiSchematicMaterials.blockList.get(index); - String itemName; - String amount = Integer.toString(itemStack.stackSize); + String itemName; + String amount = Integer.toString(itemStack.stackSize); - if (itemStack != null && itemStack.getItem() != null) { - itemName = itemStack.getItem().getItemStackDisplayName(itemStack); - } else { - itemName = this.strUnknownBlock; - } + if (itemStack != null && itemStack.getItem() != null) { + itemName = itemStack.getItem().getItemStackDisplayName(itemStack); + } else { + itemName = this.strUnknownBlock; + } - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, itemStack); + GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, itemStack); - this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 16777215); - this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 6, 16777215); - } + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 16777215); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 6, 16777215); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 760bf506..c715a216 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -9,267 +9,267 @@ import net.minecraft.client.resources.I18n; public class GuiSchematicSave extends GuiScreen { - @SuppressWarnings("unused") - private final GuiScreen prevGuiScreen; + @SuppressWarnings("unused") + private final GuiScreen prevGuiScreen; - private int centerX = 0; - private int centerY = 0; + private int centerX = 0; + private int centerY = 0; - private GuiButton btnPointA = null; + private GuiButton btnPointA = null; - private GuiButton btnDecAX = null; - private GuiButton btnAmountAX = null; - private GuiButton btnIncAX = null; + private GuiButton btnDecAX = null; + private GuiButton btnAmountAX = null; + private GuiButton btnIncAX = null; - private GuiButton btnDecAY = null; - private GuiButton btnAmountAY = null; - private GuiButton btnIncAY = null; + private GuiButton btnDecAY = null; + private GuiButton btnAmountAY = null; + private GuiButton btnIncAY = null; - private GuiButton btnDecAZ = null; - private GuiButton btnAmountAZ = null; - private GuiButton btnIncAZ = null; + private GuiButton btnDecAZ = null; + private GuiButton btnAmountAZ = null; + private GuiButton btnIncAZ = null; - private GuiButton btnPointB = null; + private GuiButton btnPointB = null; - private GuiButton btnDecBX = null; - private GuiButton btnAmountBX = null; - private GuiButton btnIncBX = null; + private GuiButton btnDecBX = null; + private GuiButton btnAmountBX = null; + private GuiButton btnIncBX = null; - private GuiButton btnDecBY = null; - private GuiButton btnAmountBY = null; - private GuiButton btnIncBY = null; + private GuiButton btnDecBY = null; + private GuiButton btnAmountBY = null; + private GuiButton btnIncBY = null; - private GuiButton btnDecBZ = null; - private GuiButton btnAmountBZ = null; - private GuiButton btnIncBZ = null; + private GuiButton btnDecBZ = null; + private GuiButton btnAmountBZ = null; + private GuiButton btnIncBZ = null; - private int incrementAX = 0; - private int incrementAY = 0; - private int incrementAZ = 0; + private int incrementAX = 0; + private int incrementAY = 0; + private int incrementAZ = 0; - private int incrementBX = 0; - private int incrementBY = 0; - private int incrementBZ = 0; + private int incrementBX = 0; + private int incrementBY = 0; + private int incrementBZ = 0; - private GuiButton btnEnable = null; - private GuiButton btnSave = null; - private GuiTextField tfFilename = null; + private GuiButton btnEnable = null; + private GuiButton btnSave = null; + private GuiTextField tfFilename = null; - private String filename = ""; + private String filename = ""; - private final String strSaveSelection = I18n.format("schematica.gui.saveselection"); - private final String strX = I18n.format("schematica.gui.x"); - private final String strY = I18n.format("schematica.gui.y"); - private final String strZ = I18n.format("schematica.gui.z"); + private final String strSaveSelection = I18n.format("schematica.gui.saveselection"); + private final String strX = I18n.format("schematica.gui.x"); + private final String strY = I18n.format("schematica.gui.y"); + private final String strZ = I18n.format("schematica.gui.z"); - public GuiSchematicSave(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; - } + public GuiSchematicSave(GuiScreen guiScreen) { + this.prevGuiScreen = guiScreen; + } - @Override - public void initGui() { - this.centerX = this.width / 2; - this.centerY = this.height / 2; + @Override + public void initGui() { + this.centerX = this.width / 2; + this.centerY = this.height / 2; - this.buttonList.clear(); + this.buttonList.clear(); - int id = 0; + int id = 0; - this.btnPointA = new GuiButton(id++, this.centerX - 130, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.red")); - this.buttonList.add(this.btnPointA); + this.btnPointA = new GuiButton(id++, this.centerX - 130, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.red")); + this.buttonList.add(this.btnPointA); - this.btnDecAX = new GuiButton(id++, this.centerX - 130, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecAX); + this.btnDecAX = new GuiButton(id++, this.centerX - 130, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecAX); - this.btnAmountAX = new GuiButton(id++, this.centerX - 95, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAX])); - this.buttonList.add(this.btnAmountAX); + this.btnAmountAX = new GuiButton(id++, this.centerX - 95, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAX])); + this.buttonList.add(this.btnAmountAX); - this.btnIncAX = new GuiButton(id++, this.centerX - 60, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncAX); - - this.btnDecAY = new GuiButton(id++, this.centerX - 130, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecAY); - - this.btnAmountAY = new GuiButton(id++, this.centerX - 95, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAY])); - this.buttonList.add(this.btnAmountAY); - - this.btnIncAY = new GuiButton(id++, this.centerX - 60, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncAY); - - this.btnDecAZ = new GuiButton(id++, this.centerX - 130, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecAZ); - - this.btnAmountAZ = new GuiButton(id++, this.centerX - 95, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ])); - this.buttonList.add(this.btnAmountAZ); - - this.btnIncAZ = new GuiButton(id++, this.centerX - 60, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncAZ); - - this.btnPointB = new GuiButton(id++, this.centerX + 30, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.blue")); - this.buttonList.add(this.btnPointB); - - this.btnDecBX = new GuiButton(id++, this.centerX + 30, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecBX); - - this.btnAmountBX = new GuiButton(id++, this.centerX + 65, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBX])); - this.buttonList.add(this.btnAmountBX); - - this.btnIncBX = new GuiButton(id++, this.centerX + 100, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncBX); - - this.btnDecBY = new GuiButton(id++, this.centerX + 30, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecBY); - - this.btnAmountBY = new GuiButton(id++, this.centerX + 65, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBY])); - this.buttonList.add(this.btnAmountBY); - - this.btnIncBY = new GuiButton(id++, this.centerX + 100, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncBY); - - this.btnDecBZ = new GuiButton(id++, this.centerX + 30, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecBZ); - - this.btnAmountBZ = new GuiButton(id++, this.centerX + 65, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ])); - this.buttonList.add(this.btnAmountBZ); - - this.btnIncBZ = new GuiButton(id++, this.centerX + 100, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncBZ); - - this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off")); - this.buttonList.add(this.btnEnable); - - this.tfFilename = new GuiTextField(this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); - - this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format("schematica.gui.save")); - this.btnSave.enabled = ClientProxy.isRenderingGuide; - this.buttonList.add(this.btnSave); - - this.tfFilename.setMaxStringLength(1024); - this.tfFilename.setText(this.filename); - } - - @Override - protected void actionPerformed(GuiButton guiButton) { - if (guiButton.enabled) { - if (guiButton.id == this.btnPointA.id) { - ClientProxy.movePointToPlayer(ClientProxy.pointA); - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnDecAX.id) { - ClientProxy.pointA.x -= ClientProxy.INCREMENTS[this.incrementAX]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncAX.id) { - ClientProxy.pointA.x += ClientProxy.INCREMENTS[this.incrementAX]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountAX.id) { - this.incrementAX = (this.incrementAX + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountAX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAX]); - } else if (guiButton.id == this.btnDecAY.id) { - ClientProxy.pointA.y -= ClientProxy.INCREMENTS[this.incrementAY]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncAY.id) { - ClientProxy.pointA.y += ClientProxy.INCREMENTS[this.incrementAY]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountAY.id) { - this.incrementAY = (this.incrementAY + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountAY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAY]); - } else if (guiButton.id == this.btnDecAZ.id) { - ClientProxy.pointA.z -= ClientProxy.INCREMENTS[this.incrementAZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncAZ.id) { - ClientProxy.pointA.z += ClientProxy.INCREMENTS[this.incrementAZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountAZ.id) { - this.incrementAZ = (this.incrementAZ + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountAZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ]); - } else if (guiButton.id == this.btnPointB.id) { - ClientProxy.movePointToPlayer(ClientProxy.pointB); - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnDecBX.id) { - ClientProxy.pointB.x -= ClientProxy.INCREMENTS[this.incrementBX]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncBX.id) { - ClientProxy.pointB.x += ClientProxy.INCREMENTS[this.incrementBX]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountBX.id) { - this.incrementBX = (this.incrementBX + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountBX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBX]); - } else if (guiButton.id == this.btnDecBY.id) { - ClientProxy.pointB.y -= ClientProxy.INCREMENTS[this.incrementBY]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncBY.id) { - ClientProxy.pointB.y += ClientProxy.INCREMENTS[this.incrementBY]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountBY.id) { - this.incrementBY = (this.incrementBY + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountBY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBY]); - } else if (guiButton.id == this.btnDecBZ.id) { - ClientProxy.pointB.z -= ClientProxy.INCREMENTS[this.incrementBZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncBZ.id) { - ClientProxy.pointB.z += ClientProxy.INCREMENTS[this.incrementBZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountBZ.id) { - this.incrementBZ = (this.incrementBZ + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountBZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ]); - } else if (guiButton.id == this.btnEnable.id) { - ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; - this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off"); - this.btnSave.enabled = ClientProxy.isRenderingGuide; - } else if (guiButton.id == this.btnSave.id) { - String path = this.tfFilename.getText() + ".schematic"; - if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { - this.filename = ""; - this.tfFilename.setText(this.filename); - } - } - } - } - - @Override - protected void mouseClicked(int x, int y, int action) { - this.tfFilename.mouseClicked(x, y, action); - super.mouseClicked(x, y, action); - } - - @Override - protected void keyTyped(char character, int code) { - this.tfFilename.textboxKeyTyped(character, code); - this.filename = this.tfFilename.getText(); - super.keyTyped(character, code); - } - - @Override - public void updateScreen() { - this.tfFilename.updateCursorCounter(); - super.updateScreen(); - } - - @Override - public void drawScreen(int par1, int par2, float par3) { - // drawDefaultBackground(); - - drawString(this.fontRendererObj, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strX, this.centerX - 145, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strY, this.centerX - 145, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.y), this.centerX - 25, this.centerY + 1, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strZ, this.centerX - 145, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.z), this.centerX - 25, this.centerY + 26, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strX, this.centerX + 15, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.x), this.centerX + 135, this.centerY - 24, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strY, this.centerX + 15, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.y), this.centerX + 135, this.centerY + 1, 0xFFFFFF); - - drawString(this.fontRendererObj, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); - - this.tfFilename.drawTextBox(); - - super.drawScreen(par1, par2, par3); - } + this.btnIncAX = new GuiButton(id++, this.centerX - 60, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncAX); + + this.btnDecAY = new GuiButton(id++, this.centerX - 130, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecAY); + + this.btnAmountAY = new GuiButton(id++, this.centerX - 95, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAY])); + this.buttonList.add(this.btnAmountAY); + + this.btnIncAY = new GuiButton(id++, this.centerX - 60, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncAY); + + this.btnDecAZ = new GuiButton(id++, this.centerX - 130, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecAZ); + + this.btnAmountAZ = new GuiButton(id++, this.centerX - 95, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ])); + this.buttonList.add(this.btnAmountAZ); + + this.btnIncAZ = new GuiButton(id++, this.centerX - 60, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncAZ); + + this.btnPointB = new GuiButton(id++, this.centerX + 30, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.blue")); + this.buttonList.add(this.btnPointB); + + this.btnDecBX = new GuiButton(id++, this.centerX + 30, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecBX); + + this.btnAmountBX = new GuiButton(id++, this.centerX + 65, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBX])); + this.buttonList.add(this.btnAmountBX); + + this.btnIncBX = new GuiButton(id++, this.centerX + 100, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncBX); + + this.btnDecBY = new GuiButton(id++, this.centerX + 30, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecBY); + + this.btnAmountBY = new GuiButton(id++, this.centerX + 65, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBY])); + this.buttonList.add(this.btnAmountBY); + + this.btnIncBY = new GuiButton(id++, this.centerX + 100, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncBY); + + this.btnDecBZ = new GuiButton(id++, this.centerX + 30, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); + this.buttonList.add(this.btnDecBZ); + + this.btnAmountBZ = new GuiButton(id++, this.centerX + 65, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ])); + this.buttonList.add(this.btnAmountBZ); + + this.btnIncBZ = new GuiButton(id++, this.centerX + 100, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); + this.buttonList.add(this.btnIncBZ); + + this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off")); + this.buttonList.add(this.btnEnable); + + this.tfFilename = new GuiTextField(this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); + + this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format("schematica.gui.save")); + this.btnSave.enabled = ClientProxy.isRenderingGuide; + this.buttonList.add(this.btnSave); + + this.tfFilename.setMaxStringLength(1024); + this.tfFilename.setText(this.filename); + } + + @Override + protected void actionPerformed(GuiButton guiButton) { + if (guiButton.enabled) { + if (guiButton.id == this.btnPointA.id) { + ClientProxy.movePointToPlayer(ClientProxy.pointA); + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnDecAX.id) { + ClientProxy.pointA.x -= ClientProxy.INCREMENTS[this.incrementAX]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnIncAX.id) { + ClientProxy.pointA.x += ClientProxy.INCREMENTS[this.incrementAX]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnAmountAX.id) { + this.incrementAX = (this.incrementAX + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountAX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAX]); + } else if (guiButton.id == this.btnDecAY.id) { + ClientProxy.pointA.y -= ClientProxy.INCREMENTS[this.incrementAY]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnIncAY.id) { + ClientProxy.pointA.y += ClientProxy.INCREMENTS[this.incrementAY]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnAmountAY.id) { + this.incrementAY = (this.incrementAY + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountAY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAY]); + } else if (guiButton.id == this.btnDecAZ.id) { + ClientProxy.pointA.z -= ClientProxy.INCREMENTS[this.incrementAZ]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnIncAZ.id) { + ClientProxy.pointA.z += ClientProxy.INCREMENTS[this.incrementAZ]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnAmountAZ.id) { + this.incrementAZ = (this.incrementAZ + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountAZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ]); + } else if (guiButton.id == this.btnPointB.id) { + ClientProxy.movePointToPlayer(ClientProxy.pointB); + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnDecBX.id) { + ClientProxy.pointB.x -= ClientProxy.INCREMENTS[this.incrementBX]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnIncBX.id) { + ClientProxy.pointB.x += ClientProxy.INCREMENTS[this.incrementBX]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnAmountBX.id) { + this.incrementBX = (this.incrementBX + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountBX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBX]); + } else if (guiButton.id == this.btnDecBY.id) { + ClientProxy.pointB.y -= ClientProxy.INCREMENTS[this.incrementBY]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnIncBY.id) { + ClientProxy.pointB.y += ClientProxy.INCREMENTS[this.incrementBY]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnAmountBY.id) { + this.incrementBY = (this.incrementBY + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountBY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBY]); + } else if (guiButton.id == this.btnDecBZ.id) { + ClientProxy.pointB.z -= ClientProxy.INCREMENTS[this.incrementBZ]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnIncBZ.id) { + ClientProxy.pointB.z += ClientProxy.INCREMENTS[this.incrementBZ]; + ClientProxy.updatePoints(); + } else if (guiButton.id == this.btnAmountBZ.id) { + this.incrementBZ = (this.incrementBZ + 1) % ClientProxy.INCREMENTS.length; + this.btnAmountBZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ]); + } else if (guiButton.id == this.btnEnable.id) { + ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; + this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off"); + this.btnSave.enabled = ClientProxy.isRenderingGuide; + } else if (guiButton.id == this.btnSave.id) { + String path = this.tfFilename.getText() + ".schematic"; + if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { + this.filename = ""; + this.tfFilename.setText(this.filename); + } + } + } + } + + @Override + protected void mouseClicked(int x, int y, int action) { + this.tfFilename.mouseClicked(x, y, action); + super.mouseClicked(x, y, action); + } + + @Override + protected void keyTyped(char character, int code) { + this.tfFilename.textboxKeyTyped(character, code); + this.filename = this.tfFilename.getText(); + super.keyTyped(character, code); + } + + @Override + public void updateScreen() { + this.tfFilename.updateCursorCounter(); + super.updateScreen(); + } + + @Override + public void drawScreen(int par1, int par2, float par3) { + // drawDefaultBackground(); + + drawString(this.fontRendererObj, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strX, this.centerX - 145, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strY, this.centerX - 145, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.y), this.centerX - 25, this.centerY + 1, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strZ, this.centerX - 145, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.z), this.centerX - 25, this.centerY + 26, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strX, this.centerX + 15, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.x), this.centerX + 135, this.centerY - 24, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strY, this.centerX + 15, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.y), this.centerX + 135, this.centerY + 1, 0xFFFFFF); + + drawString(this.fontRendererObj, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); + + this.tfFilename.drawTextBox(); + + super.drawScreen(par1, par2, par3); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java index 60515b99..0bb3657e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java @@ -7,469 +7,469 @@ import java.nio.FloatBuffer; public class RenderHelper { - public static final int QUAD_DOWN = 0x01; - public static final int QUAD_UP = 0x02; - public static final int QUAD_NORTH = 0x04; - public static final int QUAD_SOUTH = 0x08; - public static final int QUAD_WEST = 0x10; - public static final int QUAD_EAST = 0x20; - public static final int QUAD_ALL = QUAD_DOWN | QUAD_UP | QUAD_NORTH | QUAD_SOUTH | QUAD_WEST | QUAD_EAST; - - public static final int LINE_DOWN_WEST = 0x11; - public static final int LINE_UP_WEST = 0x12; - public static final int LINE_DOWN_EAST = 0x21; - public static final int LINE_UP_EAST = 0x22; - public static final int LINE_DOWN_NORTH = 0x05; - public static final int LINE_UP_NORTH = 0x06; - public static final int LINE_DOWN_SOUTH = 0x09; - public static final int LINE_UP_SOUTH = 0x0A; - public static final int LINE_NORTH_WEST = 0x14; - public static final int LINE_NORTH_EAST = 0x24; - public static final int LINE_SOUTH_WEST = 0x18; - public static final int LINE_SOUTH_EAST = 0x28; - public static final int LINE_ALL = LINE_DOWN_WEST | LINE_UP_WEST | LINE_DOWN_EAST | LINE_UP_EAST | LINE_DOWN_NORTH | LINE_UP_NORTH | LINE_DOWN_SOUTH | LINE_UP_SOUTH | LINE_NORTH_WEST | LINE_NORTH_EAST | LINE_SOUTH_WEST | LINE_SOUTH_EAST; - - public static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0); - - private static int quadSize = 0; - private static float[] quadVertexBuffer = null; - private static float[] quadColorBuffer = null; - private static int quadVertexIndex = 0; - private static int quadColorIndex = 0; - private static int quadCount = 0; - - private static int lineSize = 0; - private static float[] lineVertexBuffer = null; - private static float[] lineColorBuffer = null; - private static int lineVertexIndex = 0; - private static int lineColorIndex = 0; - private static int lineCount = 0; - - private static final Vector3f vecZero = new Vector3f(); - private static final Vector3f vecSize = new Vector3f(); - - public static void createBuffers() { - quadSize = 240; - quadVertexBuffer = new float[quadSize * 3]; - quadColorBuffer = new float[quadSize * 4]; - - lineSize = 240; - lineVertexBuffer = new float[lineSize * 3]; - lineColorBuffer = new float[lineSize * 4]; - - initBuffers(); - } - - public static void initBuffers() { - quadVertexIndex = 0; - quadColorIndex = 0; - quadCount = 0; - - lineVertexIndex = 0; - lineColorIndex = 0; - lineCount = 0; - } - - public static void destroyBuffers() { - quadSize = 0; - quadVertexBuffer = null; - quadColorBuffer = null; - - lineSize = 0; - lineVertexBuffer = null; - lineColorBuffer = null; - } - - public static FloatBuffer getQuadVertexBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(quadVertexBuffer.length).put(quadVertexBuffer); - buffer.flip(); - return buffer; - } - - public static FloatBuffer getQuadColorBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(quadColorBuffer.length).put(quadColorBuffer); - buffer.flip(); - return buffer; - } - - public static int getQuadCount() { - return quadCount; - } - - public static FloatBuffer getLineVertexBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(lineVertexBuffer.length).put(lineVertexBuffer); - buffer.flip(); - return buffer; - } - - public static FloatBuffer getLineColorBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(lineColorBuffer.length).put(lineColorBuffer); - buffer.flip(); - return buffer; - } - - public static int getLineCount() { - return lineCount; - } - - private static float[] createAndCopyBuffer(int newSize, float[] oldBuffer) { - float[] tempBuffer = new float[newSize]; - System.arraycopy(oldBuffer, 0, tempBuffer, 0, oldBuffer.length); - return tempBuffer; - } - - public static void drawCuboidSurface(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { - vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); - vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); - - if (quadCount + 24 >= quadSize) { - quadSize *= 2; - - quadVertexBuffer = createAndCopyBuffer(quadSize * 3, quadVertexBuffer); - quadColorBuffer = createAndCopyBuffer(quadSize * 4, quadColorBuffer); - } - - int total = 0; - - if ((sides & QUAD_DOWN) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_UP) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_NORTH) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_SOUTH) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_WEST) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_EAST) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - total += 4; - } - - for (int i = 0; i < total; i++) { - quadColorBuffer[quadColorIndex++] = red; - quadColorBuffer[quadColorIndex++] = green; - quadColorBuffer[quadColorIndex++] = blue; - quadColorBuffer[quadColorIndex++] = alpha; - } - } - - public static void drawCuboidOutline(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { - vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); - vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); - - if (lineCount + 24 >= lineSize) { - lineSize *= 2; - - lineVertexBuffer = createAndCopyBuffer(lineSize * 3, lineVertexBuffer); - lineColorBuffer = createAndCopyBuffer(lineSize * 4, lineColorBuffer); - } - - int total = 0; - - if ((sides & LINE_DOWN_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_DOWN_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - - if ((sides & LINE_DOWN_NORTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_NORTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_DOWN_SOUTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_SOUTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_NORTH_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_NORTH_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_SOUTH_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_SOUTH_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - for (int i = 0; i < total; i++) { - lineColorBuffer[lineColorIndex++] = red; - lineColorBuffer[lineColorIndex++] = green; - lineColorBuffer[lineColorIndex++] = blue; - lineColorBuffer[lineColorIndex++] = alpha; - } - } + public static final int QUAD_DOWN = 0x01; + public static final int QUAD_UP = 0x02; + public static final int QUAD_NORTH = 0x04; + public static final int QUAD_SOUTH = 0x08; + public static final int QUAD_WEST = 0x10; + public static final int QUAD_EAST = 0x20; + public static final int QUAD_ALL = QUAD_DOWN | QUAD_UP | QUAD_NORTH | QUAD_SOUTH | QUAD_WEST | QUAD_EAST; + + public static final int LINE_DOWN_WEST = 0x11; + public static final int LINE_UP_WEST = 0x12; + public static final int LINE_DOWN_EAST = 0x21; + public static final int LINE_UP_EAST = 0x22; + public static final int LINE_DOWN_NORTH = 0x05; + public static final int LINE_UP_NORTH = 0x06; + public static final int LINE_DOWN_SOUTH = 0x09; + public static final int LINE_UP_SOUTH = 0x0A; + public static final int LINE_NORTH_WEST = 0x14; + public static final int LINE_NORTH_EAST = 0x24; + public static final int LINE_SOUTH_WEST = 0x18; + public static final int LINE_SOUTH_EAST = 0x28; + public static final int LINE_ALL = LINE_DOWN_WEST | LINE_UP_WEST | LINE_DOWN_EAST | LINE_UP_EAST | LINE_DOWN_NORTH | LINE_UP_NORTH | LINE_DOWN_SOUTH | LINE_UP_SOUTH | LINE_NORTH_WEST | LINE_NORTH_EAST | LINE_SOUTH_WEST | LINE_SOUTH_EAST; + + public static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0); + + private static int quadSize = 0; + private static float[] quadVertexBuffer = null; + private static float[] quadColorBuffer = null; + private static int quadVertexIndex = 0; + private static int quadColorIndex = 0; + private static int quadCount = 0; + + private static int lineSize = 0; + private static float[] lineVertexBuffer = null; + private static float[] lineColorBuffer = null; + private static int lineVertexIndex = 0; + private static int lineColorIndex = 0; + private static int lineCount = 0; + + private static final Vector3f vecZero = new Vector3f(); + private static final Vector3f vecSize = new Vector3f(); + + public static void createBuffers() { + quadSize = 240; + quadVertexBuffer = new float[quadSize * 3]; + quadColorBuffer = new float[quadSize * 4]; + + lineSize = 240; + lineVertexBuffer = new float[lineSize * 3]; + lineColorBuffer = new float[lineSize * 4]; + + initBuffers(); + } + + public static void initBuffers() { + quadVertexIndex = 0; + quadColorIndex = 0; + quadCount = 0; + + lineVertexIndex = 0; + lineColorIndex = 0; + lineCount = 0; + } + + public static void destroyBuffers() { + quadSize = 0; + quadVertexBuffer = null; + quadColorBuffer = null; + + lineSize = 0; + lineVertexBuffer = null; + lineColorBuffer = null; + } + + public static FloatBuffer getQuadVertexBuffer() { + FloatBuffer buffer = BufferUtils.createFloatBuffer(quadVertexBuffer.length).put(quadVertexBuffer); + buffer.flip(); + return buffer; + } + + public static FloatBuffer getQuadColorBuffer() { + FloatBuffer buffer = BufferUtils.createFloatBuffer(quadColorBuffer.length).put(quadColorBuffer); + buffer.flip(); + return buffer; + } + + public static int getQuadCount() { + return quadCount; + } + + public static FloatBuffer getLineVertexBuffer() { + FloatBuffer buffer = BufferUtils.createFloatBuffer(lineVertexBuffer.length).put(lineVertexBuffer); + buffer.flip(); + return buffer; + } + + public static FloatBuffer getLineColorBuffer() { + FloatBuffer buffer = BufferUtils.createFloatBuffer(lineColorBuffer.length).put(lineColorBuffer); + buffer.flip(); + return buffer; + } + + public static int getLineCount() { + return lineCount; + } + + private static float[] createAndCopyBuffer(int newSize, float[] oldBuffer) { + float[] tempBuffer = new float[newSize]; + System.arraycopy(oldBuffer, 0, tempBuffer, 0, oldBuffer.length); + return tempBuffer; + } + + public static void drawCuboidSurface(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { + vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); + vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); + + if (quadCount + 24 >= quadSize) { + quadSize *= 2; + + quadVertexBuffer = createAndCopyBuffer(quadSize * 3, quadVertexBuffer); + quadColorBuffer = createAndCopyBuffer(quadSize * 4, quadColorBuffer); + } + + int total = 0; + + if ((sides & QUAD_DOWN) != 0) { + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + total += 4; + } + + if ((sides & QUAD_UP) != 0) { + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + total += 4; + } + + if ((sides & QUAD_NORTH) != 0) { + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + total += 4; + } + + if ((sides & QUAD_SOUTH) != 0) { + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + total += 4; + } + + if ((sides & QUAD_WEST) != 0) { + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecZero.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + total += 4; + } + + if ((sides & QUAD_EAST) != 0) { + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecZero.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecZero.z; + quadCount++; + + quadVertexBuffer[quadVertexIndex++] = vecSize.x; + quadVertexBuffer[quadVertexIndex++] = vecSize.y; + quadVertexBuffer[quadVertexIndex++] = vecSize.z; + quadCount++; + + total += 4; + } + + for (int i = 0; i < total; i++) { + quadColorBuffer[quadColorIndex++] = red; + quadColorBuffer[quadColorIndex++] = green; + quadColorBuffer[quadColorIndex++] = blue; + quadColorBuffer[quadColorIndex++] = alpha; + } + } + + public static void drawCuboidOutline(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { + vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); + vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); + + if (lineCount + 24 >= lineSize) { + lineSize *= 2; + + lineVertexBuffer = createAndCopyBuffer(lineSize * 3, lineVertexBuffer); + lineColorBuffer = createAndCopyBuffer(lineSize * 4, lineColorBuffer); + } + + int total = 0; + + if ((sides & LINE_DOWN_WEST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_UP_WEST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_DOWN_EAST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_UP_EAST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + + if ((sides & LINE_DOWN_NORTH) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_UP_NORTH) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_DOWN_SOUTH) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_UP_SOUTH) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_NORTH_WEST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_NORTH_EAST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecZero.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_SOUTH_WEST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecZero.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + if ((sides & LINE_SOUTH_EAST) != 0) { + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecZero.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + lineVertexBuffer[lineVertexIndex++] = vecSize.x; + lineVertexBuffer[lineVertexIndex++] = vecSize.y; + lineVertexBuffer[lineVertexIndex++] = vecSize.z; + lineCount++; + + total += 2; + } + + for (int i = 0; i < total; i++) { + lineColorBuffer[lineColorIndex++] = red; + lineColorBuffer[lineColorIndex++] = green; + lineColorBuffer[lineColorIndex++] = blue; + lineColorBuffer[lineColorIndex++] = alpha; + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 3068bcae..60f6e2a3 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -26,362 +26,362 @@ import java.util.List; public class RendererSchematicChunk { - public static final int CHUNK_WIDTH = 16; - public static final int CHUNK_HEIGHT = 16; - public static final int CHUNK_LENGTH = 16; - - private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); - - private static boolean canUpdate = false; - - public boolean isInFrustrum = false; - - public final Vector3f centerPosition = new Vector3f(); - - private final Minecraft minecraft = Minecraft.getMinecraft(); - private final Profiler profiler = this.minecraft.mcProfiler; - private final SchematicWorld schematic; - private final List tileEntities = new ArrayList(); - private final Vector3f distance = new Vector3f(); - - private final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); - - private boolean needsUpdate = true; - private int glList = -1; - // TODO: move this away from GL lists - private int glListHighlight = -1; - - public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int baseY, int baseZ) { - this.schematic = schematicWorld; - this.boundingBox.setBounds(baseX * CHUNK_WIDTH, baseY * CHUNK_HEIGHT, baseZ * CHUNK_LENGTH, (baseX + 1) * CHUNK_WIDTH, (baseY + 1) * CHUNK_HEIGHT, (baseZ + 1) * CHUNK_LENGTH); - - this.centerPosition.x = (int) ((baseX + 0.5) * CHUNK_WIDTH); - this.centerPosition.y = (int) ((baseY + 0.5) * CHUNK_HEIGHT); - this.centerPosition.z = (int) ((baseZ + 0.5) * CHUNK_LENGTH); - - int x, y, z; - for (TileEntity tileEntity : this.schematic.getTileEntities()) { - x = tileEntity.xCoord; - y = tileEntity.yCoord; - z = tileEntity.zCoord; - - if (x < this.boundingBox.minX || x >= this.boundingBox.maxX) { - continue; - } else if (z < this.boundingBox.minZ || z >= this.boundingBox.maxZ) { - continue; - } else if (y < this.boundingBox.minY || y >= this.boundingBox.maxY) { - continue; - } - - this.tileEntities.add(tileEntity); - } - - this.glList = GL11.glGenLists(3); - this.glListHighlight = GL11.glGenLists(3); - } - - public void delete() { - if (this.glList != -1) { - GL11.glDeleteLists(this.glList, 3); - } - if (this.glListHighlight != -1) { - GL11.glDeleteLists(this.glListHighlight, 3); - } - } - - public AxisAlignedBB getBoundingBox() { - return this.boundingBox; - } - - public static void setCanUpdate(boolean parCanUpdate) { - canUpdate = parCanUpdate; - } - - public static boolean getCanUpdate() { - return canUpdate; - } + public static final int CHUNK_WIDTH = 16; + public static final int CHUNK_HEIGHT = 16; + public static final int CHUNK_LENGTH = 16; + + private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); + + private static boolean canUpdate = false; + + public boolean isInFrustrum = false; + + public final Vector3f centerPosition = new Vector3f(); + + private final Minecraft minecraft = Minecraft.getMinecraft(); + private final Profiler profiler = this.minecraft.mcProfiler; + private final SchematicWorld schematic; + private final List tileEntities = new ArrayList(); + private final Vector3f distance = new Vector3f(); + + private final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); + + private boolean needsUpdate = true; + private int glList = -1; + // TODO: move this away from GL lists + private int glListHighlight = -1; + + public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int baseY, int baseZ) { + this.schematic = schematicWorld; + this.boundingBox.setBounds(baseX * CHUNK_WIDTH, baseY * CHUNK_HEIGHT, baseZ * CHUNK_LENGTH, (baseX + 1) * CHUNK_WIDTH, (baseY + 1) * CHUNK_HEIGHT, (baseZ + 1) * CHUNK_LENGTH); + + this.centerPosition.x = (int) ((baseX + 0.5) * CHUNK_WIDTH); + this.centerPosition.y = (int) ((baseY + 0.5) * CHUNK_HEIGHT); + this.centerPosition.z = (int) ((baseZ + 0.5) * CHUNK_LENGTH); + + int x, y, z; + for (TileEntity tileEntity : this.schematic.getTileEntities()) { + x = tileEntity.xCoord; + y = tileEntity.yCoord; + z = tileEntity.zCoord; + + if (x < this.boundingBox.minX || x >= this.boundingBox.maxX) { + continue; + } else if (z < this.boundingBox.minZ || z >= this.boundingBox.maxZ) { + continue; + } else if (y < this.boundingBox.minY || y >= this.boundingBox.maxY) { + continue; + } + + this.tileEntities.add(tileEntity); + } + + this.glList = GL11.glGenLists(3); + this.glListHighlight = GL11.glGenLists(3); + } + + public void delete() { + if (this.glList != -1) { + GL11.glDeleteLists(this.glList, 3); + } + if (this.glListHighlight != -1) { + GL11.glDeleteLists(this.glListHighlight, 3); + } + } + + public AxisAlignedBB getBoundingBox() { + return this.boundingBox; + } + + public static void setCanUpdate(boolean parCanUpdate) { + canUpdate = parCanUpdate; + } + + public static boolean getCanUpdate() { + return canUpdate; + } - public void setDirty() { - this.needsUpdate = true; - } + public void setDirty() { + this.needsUpdate = true; + } - public boolean getDirty() { - return this.needsUpdate; - } + public boolean getDirty() { + return this.needsUpdate; + } - public void updateRenderer() { - if (this.needsUpdate) { - this.needsUpdate = false; - setCanUpdate(false); - - RenderHelper.createBuffers(); + public void updateRenderer() { + if (this.needsUpdate) { + this.needsUpdate = false; + setCanUpdate(false); + + RenderHelper.createBuffers(); - for (int pass = 0; pass < 3; pass++) { - RenderHelper.initBuffers(); + for (int pass = 0; pass < 3; pass++) { + RenderHelper.initBuffers(); - int minX, maxX, minY, maxY, minZ, maxZ; + int minX, maxX, minY, maxY, minZ, maxZ; - minX = (int) this.boundingBox.minX; - maxX = Math.min((int) this.boundingBox.maxX, this.schematic.getWidth()); - minY = (int) this.boundingBox.minY; - maxY = Math.min((int) this.boundingBox.maxY, this.schematic.getHeight()); - minZ = (int) this.boundingBox.minZ; - maxZ = Math.min((int) this.boundingBox.maxZ, this.schematic.getLength()); + minX = (int) this.boundingBox.minX; + maxX = Math.min((int) this.boundingBox.maxX, this.schematic.getWidth()); + minY = (int) this.boundingBox.minY; + maxY = Math.min((int) this.boundingBox.maxY, this.schematic.getHeight()); + minZ = (int) this.boundingBox.minZ; + maxZ = Math.min((int) this.boundingBox.maxZ, this.schematic.getLength()); - int renderingLayer = this.schematic.renderingLayer; - if (renderingLayer >= 0) { - if (renderingLayer >= minY && renderingLayer < maxY) { - minY = renderingLayer; - maxY = renderingLayer + 1; - } else { - minY = maxY = 0; - } - } - - GL11.glNewList(this.glList + pass, GL11.GL_COMPILE); - renderBlocks(pass, minX, minY, minZ, maxX, maxY, maxZ); - GL11.glEndList(); - - GL11.glNewList(this.glListHighlight + pass, GL11.GL_COMPILE); - int quadCount = RenderHelper.getQuadCount(); - int lineCount = RenderHelper.getLineCount(); - - if (quadCount > 0 || lineCount > 0) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - - GL11.glLineWidth(1.5f); - - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - - if (quadCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getQuadVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getQuadColorBuffer()); - GL11.glDrawArrays(GL11.GL_QUADS, 0, quadCount); - } - - if (lineCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getLineVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getLineColorBuffer()); - GL11.glDrawArrays(GL11.GL_LINES, 0, lineCount); - } - - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - } + int renderingLayer = this.schematic.renderingLayer; + if (renderingLayer >= 0) { + if (renderingLayer >= minY && renderingLayer < maxY) { + minY = renderingLayer; + maxY = renderingLayer + 1; + } else { + minY = maxY = 0; + } + } + + GL11.glNewList(this.glList + pass, GL11.GL_COMPILE); + renderBlocks(pass, minX, minY, minZ, maxX, maxY, maxZ); + GL11.glEndList(); + + GL11.glNewList(this.glListHighlight + pass, GL11.GL_COMPILE); + int quadCount = RenderHelper.getQuadCount(); + int lineCount = RenderHelper.getLineCount(); + + if (quadCount > 0 || lineCount > 0) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + + GL11.glLineWidth(1.5f); + + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + + if (quadCount > 0) { + GL11.glVertexPointer(3, 0, RenderHelper.getQuadVertexBuffer()); + GL11.glColorPointer(4, 0, RenderHelper.getQuadColorBuffer()); + GL11.glDrawArrays(GL11.GL_QUADS, 0, quadCount); + } + + if (lineCount > 0) { + GL11.glVertexPointer(3, 0, RenderHelper.getLineVertexBuffer()); + GL11.glColorPointer(4, 0, RenderHelper.getLineColorBuffer()); + GL11.glDrawArrays(GL11.GL_LINES, 0, lineCount); + } + + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + + GL11.glEnable(GL11.GL_TEXTURE_2D); + } - GL11.glEndList(); - } - - RenderHelper.destroyBuffers(); - } - } + GL11.glEndList(); + } + + RenderHelper.destroyBuffers(); + } + } - public void render(int renderPass) { - if (!this.isInFrustrum) { - return; - } - - if (this.distance.set(ClientProxy.playerPosition).sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).sub(this.centerPosition).lengthSquared() > 25600) { - return; - } - - // some mods enable this, beats me why - it's supposed to be disabled! - GL11.glDisable(GL11.GL_LIGHTING); - - this.profiler.startSection("blocks"); - this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - - if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { - GL20.glUseProgram(SHADER_ALPHA.getProgram()); - GL20.glUniform1f(GL20.glGetUniformLocation(SHADER_ALPHA.getProgram(), "alpha_multiplier"), ConfigurationHandler.alpha); - } - - GL11.glCallList(this.glList + renderPass); - - if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { - GL20.glUseProgram(0); - } - - this.profiler.endStartSection("highlight"); - GL11.glCallList(this.glListHighlight + renderPass); - - this.profiler.endStartSection("tileEntities"); - renderTileEntities(renderPass); - - // re-enable blending... spawners disable it, somewhere... - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - // re-set alpha func... beacons set it to (GL_GREATER, 0.5f) - // EntityRenderer sets it to (GL_GREATER, 0.1f) before dispatching the event - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - - this.profiler.endSection(); - } - - public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { - IBlockAccess mcWorld = this.minecraft.theWorld; - RenderBlocks renderBlocks = ClientProxy.rendererSchematicGlobal.renderBlocks; - - int x, y, z, wx, wy, wz; - int sides; - Block block, mcBlock; - Vector3f zero = new Vector3f(); - Vector3f size = new Vector3f(); - - int ambientOcclusion = this.minecraft.gameSettings.ambientOcclusion; - this.minecraft.gameSettings.ambientOcclusion = 0; - - Tessellator.instance.startDrawingQuads(); - - for (y = minY; y < maxY; y++) { - for (z = minZ; z < maxZ; z++) { - for (x = minX; x < maxX; x++) { - try { - block = this.schematic.getBlock(x, y, z); - - wx = this.schematic.position.x + x; - wy = this.schematic.position.y + y; - wz = this.schematic.position.z + z; - - mcBlock = mcWorld.getBlock(wx, wy, wz); - - sides = 0; - if (block != null) { - if (block.shouldSideBeRendered(this.schematic, x, y - 1, z, 0)) { - sides |= RenderHelper.QUAD_DOWN; - } - - if (block.shouldSideBeRendered(this.schematic, x, y + 1, z, 1)) { - sides |= RenderHelper.QUAD_UP; - } - - if (block.shouldSideBeRendered(this.schematic, x, y, z - 1, 2)) { - sides |= RenderHelper.QUAD_NORTH; - } - - if (block.shouldSideBeRendered(this.schematic, x, y, z + 1, 3)) { - sides |= RenderHelper.QUAD_SOUTH; - } - - if (block.shouldSideBeRendered(this.schematic, x - 1, y, z, 4)) { - sides |= RenderHelper.QUAD_WEST; - } - - if (block.shouldSideBeRendered(this.schematic, x + 1, y, z, 5)) { - sides |= RenderHelper.QUAD_EAST; - } - } - - boolean isAirBlock = mcWorld.isAirBlock(wx, wy, wz); - - if (!isAirBlock) { - if (ConfigurationHandler.highlight && renderPass == 2) { - if (block == Blocks.air && ConfigurationHandler.highlightAir) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.75f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); - } - } else if (block != mcBlock) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); - } - } else if (this.schematic.getBlockMetadata(x, y, z) != mcWorld.getBlockMetadata(wx, wy, wz)) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); - } - } - } - } else if (block != Blocks.air) { - if (ConfigurationHandler.highlight && renderPass == 2) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); - } - } - - if (block != null && block.canRenderInPass(renderPass)) { - renderBlocks.renderBlockByRenderType(block, x, y, z); - } - } - } catch (Exception e) { - Reference.logger.error("Failed to render block!", e); - } - } - } - } - - Tessellator.instance.draw(); - - this.minecraft.gameSettings.ambientOcclusion = ambientOcclusion; - } - - public void renderTileEntities(int renderPass) { - if (renderPass != 0) { - return; - } - - IBlockAccess mcWorld = this.minecraft.theWorld; - - int x, y, z; - Block mcBlock; - - GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); - - try { - for (TileEntity tileEntity : this.tileEntities) { - x = tileEntity.xCoord; - y = tileEntity.yCoord; - z = tileEntity.zCoord; - - int renderingLayer = this.schematic.renderingLayer; - if (renderingLayer >= 0) { - if (renderingLayer != y) { - continue; - } - } - - mcBlock = mcWorld.getBlock(x + this.schematic.position.x, y + this.schematic.position.y, z + this.schematic.position.z); - - if (mcBlock == Blocks.air) { - TileEntitySpecialRenderer tileEntitySpecialRenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntity); - if (tileEntitySpecialRenderer != null) { - try { - tileEntitySpecialRenderer.renderTileEntityAt(tileEntity, x, y, z, 0); - - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } catch (Exception e) { - Reference.logger.error("Failed to render a tile entity!", e); - } - GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); - } - } - } - } catch (Exception ex) { - Reference.logger.error("Failed to render tile entities!", ex); - } - } + public void render(int renderPass) { + if (!this.isInFrustrum) { + return; + } + + if (this.distance.set(ClientProxy.playerPosition).sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).sub(this.centerPosition).lengthSquared() > 25600) { + return; + } + + // some mods enable this, beats me why - it's supposed to be disabled! + GL11.glDisable(GL11.GL_LIGHTING); + + this.profiler.startSection("blocks"); + this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + + if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { + GL20.glUseProgram(SHADER_ALPHA.getProgram()); + GL20.glUniform1f(GL20.glGetUniformLocation(SHADER_ALPHA.getProgram(), "alpha_multiplier"), ConfigurationHandler.alpha); + } + + GL11.glCallList(this.glList + renderPass); + + if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { + GL20.glUseProgram(0); + } + + this.profiler.endStartSection("highlight"); + GL11.glCallList(this.glListHighlight + renderPass); + + this.profiler.endStartSection("tileEntities"); + renderTileEntities(renderPass); + + // re-enable blending... spawners disable it, somewhere... + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + // re-set alpha func... beacons set it to (GL_GREATER, 0.5f) + // EntityRenderer sets it to (GL_GREATER, 0.1f) before dispatching the event + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + + this.profiler.endSection(); + } + + public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { + IBlockAccess mcWorld = this.minecraft.theWorld; + RenderBlocks renderBlocks = ClientProxy.rendererSchematicGlobal.renderBlocks; + + int x, y, z, wx, wy, wz; + int sides; + Block block, mcBlock; + Vector3f zero = new Vector3f(); + Vector3f size = new Vector3f(); + + int ambientOcclusion = this.minecraft.gameSettings.ambientOcclusion; + this.minecraft.gameSettings.ambientOcclusion = 0; + + Tessellator.instance.startDrawingQuads(); + + for (y = minY; y < maxY; y++) { + for (z = minZ; z < maxZ; z++) { + for (x = minX; x < maxX; x++) { + try { + block = this.schematic.getBlock(x, y, z); + + wx = this.schematic.position.x + x; + wy = this.schematic.position.y + y; + wz = this.schematic.position.z + z; + + mcBlock = mcWorld.getBlock(wx, wy, wz); + + sides = 0; + if (block != null) { + if (block.shouldSideBeRendered(this.schematic, x, y - 1, z, 0)) { + sides |= RenderHelper.QUAD_DOWN; + } + + if (block.shouldSideBeRendered(this.schematic, x, y + 1, z, 1)) { + sides |= RenderHelper.QUAD_UP; + } + + if (block.shouldSideBeRendered(this.schematic, x, y, z - 1, 2)) { + sides |= RenderHelper.QUAD_NORTH; + } + + if (block.shouldSideBeRendered(this.schematic, x, y, z + 1, 3)) { + sides |= RenderHelper.QUAD_SOUTH; + } + + if (block.shouldSideBeRendered(this.schematic, x - 1, y, z, 4)) { + sides |= RenderHelper.QUAD_WEST; + } + + if (block.shouldSideBeRendered(this.schematic, x + 1, y, z, 5)) { + sides |= RenderHelper.QUAD_EAST; + } + } + + boolean isAirBlock = mcWorld.isAirBlock(wx, wy, wz); + + if (!isAirBlock) { + if (ConfigurationHandler.highlight && renderPass == 2) { + if (block == Blocks.air && ConfigurationHandler.highlightAir) { + zero.set(x, y, z); + size.set(x + 1, y + 1, z + 1); + if (ConfigurationHandler.drawQuads) { + RenderHelper.drawCuboidSurface(zero, size, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.75f, 0.25f); + } + if (ConfigurationHandler.drawLines) { + RenderHelper.drawCuboidOutline(zero, size, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); + } + } else if (block != mcBlock) { + zero.set(x, y, z); + size.set(x + 1, y + 1, z + 1); + if (ConfigurationHandler.drawQuads) { + RenderHelper.drawCuboidSurface(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); + } + if (ConfigurationHandler.drawLines) { + RenderHelper.drawCuboidOutline(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); + } + } else if (this.schematic.getBlockMetadata(x, y, z) != mcWorld.getBlockMetadata(wx, wy, wz)) { + zero.set(x, y, z); + size.set(x + 1, y + 1, z + 1); + if (ConfigurationHandler.drawQuads) { + RenderHelper.drawCuboidSurface(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); + } + if (ConfigurationHandler.drawLines) { + RenderHelper.drawCuboidOutline(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); + } + } + } + } else if (block != Blocks.air) { + if (ConfigurationHandler.highlight && renderPass == 2) { + zero.set(x, y, z); + size.set(x + 1, y + 1, z + 1); + if (ConfigurationHandler.drawQuads) { + RenderHelper.drawCuboidSurface(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); + } + if (ConfigurationHandler.drawLines) { + RenderHelper.drawCuboidOutline(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); + } + } + + if (block != null && block.canRenderInPass(renderPass)) { + renderBlocks.renderBlockByRenderType(block, x, y, z); + } + } + } catch (Exception e) { + Reference.logger.error("Failed to render block!", e); + } + } + } + } + + Tessellator.instance.draw(); + + this.minecraft.gameSettings.ambientOcclusion = ambientOcclusion; + } + + public void renderTileEntities(int renderPass) { + if (renderPass != 0) { + return; + } + + IBlockAccess mcWorld = this.minecraft.theWorld; + + int x, y, z; + Block mcBlock; + + GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); + + try { + for (TileEntity tileEntity : this.tileEntities) { + x = tileEntity.xCoord; + y = tileEntity.yCoord; + z = tileEntity.zCoord; + + int renderingLayer = this.schematic.renderingLayer; + if (renderingLayer >= 0) { + if (renderingLayer != y) { + continue; + } + } + + mcBlock = mcWorld.getBlock(x + this.schematic.position.x, y + this.schematic.position.y, z + this.schematic.position.z); + + if (mcBlock == Blocks.air) { + TileEntitySpecialRenderer tileEntitySpecialRenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntity); + if (tileEntitySpecialRenderer != null) { + try { + tileEntitySpecialRenderer.renderTileEntityAt(tileEntity, x, y, z, 0); + + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } catch (Exception e) { + Reference.logger.error("Failed to render a tile entity!", e); + } + GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); + } + } + } + } catch (Exception ex) { + Reference.logger.error("Failed to render tile entities!", ex); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java index d920a204..8b30abb4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java @@ -7,30 +7,30 @@ import java.util.Comparator; public class RendererSchematicChunkSorter implements Comparator { - private final Vector3f position = new Vector3f(); - private final Vector3f schematicPosition = new Vector3f(); - private SchematicWorld schematic = null; + private final Vector3f position = new Vector3f(); + private final Vector3f schematicPosition = new Vector3f(); + private SchematicWorld schematic = null; - public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { - if (rendererSchematicChunk1.isInFrustrum && !rendererSchematicChunk2.isInFrustrum) { - return -1; - } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { - return 1; - } else { - this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); - double dist1 = this.position.clone().sub(rendererSchematicChunk1.centerPosition).lengthSquared(); - double dist2 = this.position.sub(rendererSchematicChunk2.centerPosition).lengthSquared(); - return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); - } - } + public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { + if (rendererSchematicChunk1.isInFrustrum && !rendererSchematicChunk2.isInFrustrum) { + return -1; + } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { + return 1; + } else { + this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); + double dist1 = this.position.clone().sub(rendererSchematicChunk1.centerPosition).lengthSquared(); + double dist2 = this.position.sub(rendererSchematicChunk2.centerPosition).lengthSquared(); + return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); + } + } - @Override - public int compare(Object obj1, Object obj2) { - return doCompare((RendererSchematicChunk) obj1, (RendererSchematicChunk) obj2); - } + @Override + public int compare(Object obj1, Object obj2) { + return doCompare((RendererSchematicChunk) obj1, (RendererSchematicChunk) obj2); + } - public void setSchematic(SchematicWorld schematic) { - this.schematic = schematic; - this.schematicPosition.set(schematic.position.toVector3f()); - } + public void setSchematic(SchematicWorld schematic) { + this.schematic = schematic; + this.schematicPosition.set(schematic.position.toVector3f()); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 632476ba..3cc9f0d8 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -18,178 +18,178 @@ import java.util.List; public class RendererSchematicGlobal { - private final Minecraft minecraft = Minecraft.getMinecraft(); - private final Profiler profiler = this.minecraft.mcProfiler; - - private final Frustrum frustrum = new Frustrum(); - public RenderBlocks renderBlocks = null; - public final List sortedRendererSchematicChunk = new ArrayList(); - private final RendererSchematicChunkSorter rendererSchematicChunkSorter = new RendererSchematicChunkSorter(); - - @SubscribeEvent - public void onRender(RenderWorldLastEvent event) { - EntityPlayerSP player = this.minecraft.thePlayer; - if (player != null) { - ClientProxy.setPlayerData(player, event.partialTicks); - - this.profiler.startSection("schematica"); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if ((schematic != null && schematic.isRendering) || ClientProxy.isRenderingGuide) { - render(schematic); - } - - this.profiler.endSection(); - } - } - - public void render(SchematicWorld schematic) { - GL11.glPushMatrix(); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_BLEND); - - Vector3f playerPosition = ClientProxy.playerPosition.clone(); - Vector3f extra = new Vector3f(); - if (schematic != null) { - extra.add(schematic.position.toVector3f()); - playerPosition.sub(extra); - } - - GL11.glTranslatef(-playerPosition.x, -playerPosition.y, -playerPosition.z); - - this.profiler.startSection("schematic"); - if (schematic != null && schematic.isRendering) { - this.profiler.startSection("updateFrustrum"); - updateFrustrum(schematic); - - this.profiler.endStartSection("sortAndUpdate"); - if (RendererSchematicChunk.getCanUpdate()) { - sortAndUpdate(schematic); - } - - this.profiler.endStartSection("render"); - int pass; - for (pass = 0; pass < 3; pass++) { - for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { - renderer.render(pass); - } - } - this.profiler.endSection(); - } - - this.profiler.endStartSection("guide"); - - RenderHelper.createBuffers(); - - this.profiler.startSection("dataPrep"); - if (schematic != null && schematic.isRendering) { - RenderHelper.drawCuboidOutline(RenderHelper.VEC_ZERO, schematic.dimensions(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); - } - - if (ClientProxy.isRenderingGuide) { - Vector3f start; - Vector3f end; - - start = ClientProxy.pointMin.toVector3f().sub(extra); - end = ClientProxy.pointMax.toVector3f().sub(extra).add(1, 1, 1); - RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); - - start = ClientProxy.pointA.toVector3f().sub(extra); - end = start.clone().add(1, 1, 1); - RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - - start = ClientProxy.pointB.toVector3f().sub(extra); - end = start.clone().add(1, 1, 1); - RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - } - - int quadCount = RenderHelper.getQuadCount(); - int lineCount = RenderHelper.getLineCount(); - - if (quadCount > 0 || lineCount > 0) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - - GL11.glLineWidth(1.5f); - - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - - this.profiler.endStartSection("quad"); - if (quadCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getQuadVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getQuadColorBuffer()); - GL11.glDrawArrays(GL11.GL_QUADS, 0, quadCount); - } - - this.profiler.endStartSection("line"); - if (lineCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getLineVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getLineColorBuffer()); - GL11.glDrawArrays(GL11.GL_LINES, 0, lineCount); - } - - this.profiler.endSection(); - - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - this.profiler.endSection(); - - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL11.glPopMatrix(); - } - - private void updateFrustrum(SchematicWorld schematic) { - this.frustrum.setPosition(ClientProxy.playerPosition.x - schematic.position.x, ClientProxy.playerPosition.y - schematic.position.y, ClientProxy.playerPosition.z - schematic.position.z); - for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { - rendererSchematicChunk.isInFrustrum = this.frustrum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); - } - } - - private void sortAndUpdate(SchematicWorld schematic) { - this.rendererSchematicChunkSorter.setSchematic(schematic); - Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkSorter); - - for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { - if (rendererSchematicChunk.getDirty()) { - rendererSchematicChunk.updateRenderer(); - break; - } - } - } - - public void createRendererSchematicChunks(SchematicWorld schematic) { - int width = (schematic.getWidth() - 1) / RendererSchematicChunk.CHUNK_WIDTH + 1; - int height = (schematic.getHeight() - 1) / RendererSchematicChunk.CHUNK_HEIGHT + 1; - int length = (schematic.getLength() - 1) / RendererSchematicChunk.CHUNK_LENGTH + 1; - - destroyRendererSchematicChunks(); - - this.renderBlocks = new RenderBlocks(schematic); - for (int y = 0; y < height; y++) { - for (int z = 0; z < length; z++) { - for (int x = 0; x < width; x++) { - this.sortedRendererSchematicChunk.add(new RendererSchematicChunk(schematic, x, y, z)); - } - } - } - } - - public void destroyRendererSchematicChunks() { - this.renderBlocks = null; - while (this.sortedRendererSchematicChunk.size() > 0) { - this.sortedRendererSchematicChunk.remove(0).delete(); - } - } - - public void refresh() { - for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { - renderer.setDirty(); - } - } + private final Minecraft minecraft = Minecraft.getMinecraft(); + private final Profiler profiler = this.minecraft.mcProfiler; + + private final Frustrum frustrum = new Frustrum(); + public RenderBlocks renderBlocks = null; + public final List sortedRendererSchematicChunk = new ArrayList(); + private final RendererSchematicChunkSorter rendererSchematicChunkSorter = new RendererSchematicChunkSorter(); + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + EntityPlayerSP player = this.minecraft.thePlayer; + if (player != null) { + ClientProxy.setPlayerData(player, event.partialTicks); + + this.profiler.startSection("schematica"); + SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if ((schematic != null && schematic.isRendering) || ClientProxy.isRenderingGuide) { + render(schematic); + } + + this.profiler.endSection(); + } + } + + public void render(SchematicWorld schematic) { + GL11.glPushMatrix(); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_BLEND); + + Vector3f playerPosition = ClientProxy.playerPosition.clone(); + Vector3f extra = new Vector3f(); + if (schematic != null) { + extra.add(schematic.position.toVector3f()); + playerPosition.sub(extra); + } + + GL11.glTranslatef(-playerPosition.x, -playerPosition.y, -playerPosition.z); + + this.profiler.startSection("schematic"); + if (schematic != null && schematic.isRendering) { + this.profiler.startSection("updateFrustrum"); + updateFrustrum(schematic); + + this.profiler.endStartSection("sortAndUpdate"); + if (RendererSchematicChunk.getCanUpdate()) { + sortAndUpdate(schematic); + } + + this.profiler.endStartSection("render"); + int pass; + for (pass = 0; pass < 3; pass++) { + for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { + renderer.render(pass); + } + } + this.profiler.endSection(); + } + + this.profiler.endStartSection("guide"); + + RenderHelper.createBuffers(); + + this.profiler.startSection("dataPrep"); + if (schematic != null && schematic.isRendering) { + RenderHelper.drawCuboidOutline(RenderHelper.VEC_ZERO, schematic.dimensions(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); + } + + if (ClientProxy.isRenderingGuide) { + Vector3f start; + Vector3f end; + + start = ClientProxy.pointMin.toVector3f().sub(extra); + end = ClientProxy.pointMax.toVector3f().sub(extra).add(1, 1, 1); + RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); + + start = ClientProxy.pointA.toVector3f().sub(extra); + end = start.clone().add(1, 1, 1); + RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); + RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); + + start = ClientProxy.pointB.toVector3f().sub(extra); + end = start.clone().add(1, 1, 1); + RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); + RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); + } + + int quadCount = RenderHelper.getQuadCount(); + int lineCount = RenderHelper.getLineCount(); + + if (quadCount > 0 || lineCount > 0) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + + GL11.glLineWidth(1.5f); + + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + + this.profiler.endStartSection("quad"); + if (quadCount > 0) { + GL11.glVertexPointer(3, 0, RenderHelper.getQuadVertexBuffer()); + GL11.glColorPointer(4, 0, RenderHelper.getQuadColorBuffer()); + GL11.glDrawArrays(GL11.GL_QUADS, 0, quadCount); + } + + this.profiler.endStartSection("line"); + if (lineCount > 0) { + GL11.glVertexPointer(3, 0, RenderHelper.getLineVertexBuffer()); + GL11.glColorPointer(4, 0, RenderHelper.getLineColorBuffer()); + GL11.glDrawArrays(GL11.GL_LINES, 0, lineCount); + } + + this.profiler.endSection(); + + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.profiler.endSection(); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GL11.glPopMatrix(); + } + + private void updateFrustrum(SchematicWorld schematic) { + this.frustrum.setPosition(ClientProxy.playerPosition.x - schematic.position.x, ClientProxy.playerPosition.y - schematic.position.y, ClientProxy.playerPosition.z - schematic.position.z); + for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { + rendererSchematicChunk.isInFrustrum = this.frustrum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); + } + } + + private void sortAndUpdate(SchematicWorld schematic) { + this.rendererSchematicChunkSorter.setSchematic(schematic); + Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkSorter); + + for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { + if (rendererSchematicChunk.getDirty()) { + rendererSchematicChunk.updateRenderer(); + break; + } + } + } + + public void createRendererSchematicChunks(SchematicWorld schematic) { + int width = (schematic.getWidth() - 1) / RendererSchematicChunk.CHUNK_WIDTH + 1; + int height = (schematic.getHeight() - 1) / RendererSchematicChunk.CHUNK_HEIGHT + 1; + int length = (schematic.getLength() - 1) / RendererSchematicChunk.CHUNK_LENGTH + 1; + + destroyRendererSchematicChunks(); + + this.renderBlocks = new RenderBlocks(schematic); + for (int y = 0; y < height; y++) { + for (int z = 0; z < length; z++) { + for (int x = 0; x < width; x++) { + this.sortedRendererSchematicChunk.add(new RendererSchematicChunk(schematic, x, y, z)); + } + } + } + } + + public void destroyRendererSchematicChunks() { + this.renderBlocks = null; + while (this.sortedRendererSchematicChunk.size() > 0) { + this.sortedRendererSchematicChunk.remove(0).delete(); + } + } + + public void refresh() { + for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { + renderer.setDirty(); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java index 21b1309a..673a92ae 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java @@ -12,113 +12,113 @@ import java.io.InputStreamReader; public class ShaderProgram { - private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); - - private int program; - - public ShaderProgram(String domain, String vertShaderFilename, String fragShaderFilename) { - try { - init(domain, vertShaderFilename, fragShaderFilename); - if (this.program > 0) { - GL20.glUseProgram(this.program); - GL20.glUniform1i(GL20.glGetUniformLocation(this.program, "texture"), 0); - GL20.glUseProgram(0); - } - } catch (Exception e) { - Reference.logger.error("Could not initialize shader program!", e); - this.program = 0; - } - } - - private void init(String domain, String vertShaderFilename, String fragShaderFilename) { - if (!OpenGlHelper.shadersSupported) { - this.program = 0; - return; - } - - this.program = GL20.glCreateProgram(); - - int vertShader = loadAndCompileShader(domain, vertShaderFilename, GL20.GL_VERTEX_SHADER); - int fragShader = loadAndCompileShader(domain, fragShaderFilename, GL20.GL_FRAGMENT_SHADER); - - if (vertShader != 0) { - GL20.glAttachShader(this.program, vertShader); - } - - if (fragShader != 0) { - GL20.glAttachShader(this.program, fragShader); - } - - GL20.glLinkProgram(this.program); - - if (GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) { - Reference.logger.error(String.format("Could not link shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); - GL20.glDeleteProgram(this.program); - this.program = 0; - return; - } - - GL20.glValidateProgram(this.program); - - if (GL20.glGetProgrami(this.program, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) { - Reference.logger.error(String.format("Could not validate shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); - GL20.glDeleteProgram(this.program); - this.program = 0; - } - } - - private int loadAndCompileShader(String domain, String filename, int shaderType) { - if (filename == null) { - return 0; - } - - final int handle = GL20.glCreateShader(shaderType); - - if (handle == 0) { - Reference.logger.error(String.format("Could not create shader of type %d for %s: %s", shaderType, filename, GL20.glGetProgramInfoLog(this.program, 1024))); - return 0; - } - - String code = loadFile(new ResourceLocation(domain, filename)); - if (code == null) { - GL20.glDeleteShader(handle); - return 0; - } - - GL20.glShaderSource(handle, code); - GL20.glCompileShader(handle); - - if (GL20.glGetShaderi(handle, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) { - Reference.logger.error(String.format("Could not compile shader %s: %s", filename, GL20.glGetShaderInfoLog(this.program, 1024))); - GL20.glDeleteShader(handle); - return 0; - } - - return handle; - } - - private String loadFile(ResourceLocation resourceLocation) { - try { - final StringBuilder code = new StringBuilder(); - final InputStream inputStream = MINECRAFT.getResourceManager().getResource(resourceLocation).getInputStream(); - final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); - - String line; - while ((line = reader.readLine()) != null) { - code.append(line); - code.append('\n'); - } - reader.close(); - - return code.toString(); - } catch (Exception e) { - Reference.logger.error("Could not load shader file!", e); - } - - return null; - } - - public int getProgram() { - return this.program; - } + private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); + + private int program; + + public ShaderProgram(String domain, String vertShaderFilename, String fragShaderFilename) { + try { + init(domain, vertShaderFilename, fragShaderFilename); + if (this.program > 0) { + GL20.glUseProgram(this.program); + GL20.glUniform1i(GL20.glGetUniformLocation(this.program, "texture"), 0); + GL20.glUseProgram(0); + } + } catch (Exception e) { + Reference.logger.error("Could not initialize shader program!", e); + this.program = 0; + } + } + + private void init(String domain, String vertShaderFilename, String fragShaderFilename) { + if (!OpenGlHelper.shadersSupported) { + this.program = 0; + return; + } + + this.program = GL20.glCreateProgram(); + + int vertShader = loadAndCompileShader(domain, vertShaderFilename, GL20.GL_VERTEX_SHADER); + int fragShader = loadAndCompileShader(domain, fragShaderFilename, GL20.GL_FRAGMENT_SHADER); + + if (vertShader != 0) { + GL20.glAttachShader(this.program, vertShader); + } + + if (fragShader != 0) { + GL20.glAttachShader(this.program, fragShader); + } + + GL20.glLinkProgram(this.program); + + if (GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) { + Reference.logger.error(String.format("Could not link shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); + GL20.glDeleteProgram(this.program); + this.program = 0; + return; + } + + GL20.glValidateProgram(this.program); + + if (GL20.glGetProgrami(this.program, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) { + Reference.logger.error(String.format("Could not validate shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); + GL20.glDeleteProgram(this.program); + this.program = 0; + } + } + + private int loadAndCompileShader(String domain, String filename, int shaderType) { + if (filename == null) { + return 0; + } + + final int handle = GL20.glCreateShader(shaderType); + + if (handle == 0) { + Reference.logger.error(String.format("Could not create shader of type %d for %s: %s", shaderType, filename, GL20.glGetProgramInfoLog(this.program, 1024))); + return 0; + } + + String code = loadFile(new ResourceLocation(domain, filename)); + if (code == null) { + GL20.glDeleteShader(handle); + return 0; + } + + GL20.glShaderSource(handle, code); + GL20.glCompileShader(handle); + + if (GL20.glGetShaderi(handle, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) { + Reference.logger.error(String.format("Could not compile shader %s: %s", filename, GL20.glGetShaderInfoLog(this.program, 1024))); + GL20.glDeleteShader(handle); + return 0; + } + + return handle; + } + + private String loadFile(ResourceLocation resourceLocation) { + try { + final StringBuilder code = new StringBuilder(); + final InputStream inputStream = MINECRAFT.getResourceManager().getResource(resourceLocation).getInputStream(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + + String line; + while ((line = reader.readLine()) != null) { + code.append(line); + code.append('\n'); + } + reader.close(); + + return code.toString(); + } catch (Exception e) { + Reference.logger.error("Could not load shader file!", e); + } + + return null; + } + + public int getProgram() { + return this.program; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 995afdad..6dd9bd9e 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -27,340 +27,340 @@ import static com.github.lunatrius.schematica.config.PlacementData.PlacementType; public class BlockInfo { - public static final List BLOCK_LIST_IGNORE_BLOCK = new ArrayList(); - public static final List BLOCK_LIST_IGNORE_METADATA = new ArrayList(); - public static final Map BLOCK_ITEM_MAP = new HashMap(); - public static final Map CLASS_PLACEMENT_MAP = new HashMap(); - public static final Map ITEM_PLACEMENT_MAP = new HashMap(); - - private static String modId = Names.ModId.MINECRAFT; - - public static void setModId(String modId) { - BlockInfo.modId = modId; - } - - public static void populateIgnoredBlocks() { - BLOCK_LIST_IGNORE_BLOCK.clear(); - - /** - * minecraft - */ - addIgnoredBlock(Blocks.piston_head); - addIgnoredBlock(Blocks.piston_extension); - addIgnoredBlock(Blocks.portal); - addIgnoredBlock(Blocks.end_portal); - } - - private static boolean addIgnoredBlock(Block block) { - if (block == null) { - return false; - } - - return BLOCK_LIST_IGNORE_BLOCK.add(block); - } - - private static boolean addIgnoredBlock(String blockName) { - if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { - return false; - } - - return addIgnoredBlock(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); - } - - public static void populateIgnoredBlockMetadata() { - BLOCK_LIST_IGNORE_METADATA.clear(); - - /** - * minecraft - */ - addIgnoredBlockMetadata(Blocks.flowing_water); - addIgnoredBlockMetadata(Blocks.water); - addIgnoredBlockMetadata(Blocks.flowing_lava); - addIgnoredBlockMetadata(Blocks.lava); - addIgnoredBlockMetadata(Blocks.dispenser); - addIgnoredBlockMetadata(Blocks.bed); - addIgnoredBlockMetadata(Blocks.golden_rail); - addIgnoredBlockMetadata(Blocks.detector_rail); - addIgnoredBlockMetadata(Blocks.sticky_piston); - addIgnoredBlockMetadata(Blocks.piston); - addIgnoredBlockMetadata(Blocks.torch); - addIgnoredBlockMetadata(Blocks.oak_stairs); - addIgnoredBlockMetadata(Blocks.chest); - addIgnoredBlockMetadata(Blocks.redstone_wire); - addIgnoredBlockMetadata(Blocks.wheat); - addIgnoredBlockMetadata(Blocks.farmland); - addIgnoredBlockMetadata(Blocks.furnace); - addIgnoredBlockMetadata(Blocks.lit_furnace); - addIgnoredBlockMetadata(Blocks.standing_sign); - addIgnoredBlockMetadata(Blocks.wooden_door); - addIgnoredBlockMetadata(Blocks.ladder); - addIgnoredBlockMetadata(Blocks.rail); - addIgnoredBlockMetadata(Blocks.stone_stairs); - addIgnoredBlockMetadata(Blocks.wall_sign); - addIgnoredBlockMetadata(Blocks.lever); - addIgnoredBlockMetadata(Blocks.stone_pressure_plate); - addIgnoredBlockMetadata(Blocks.iron_door); - addIgnoredBlockMetadata(Blocks.wooden_pressure_plate); - addIgnoredBlockMetadata(Blocks.unlit_redstone_torch); - addIgnoredBlockMetadata(Blocks.redstone_torch); - addIgnoredBlockMetadata(Blocks.stone_button); - addIgnoredBlockMetadata(Blocks.cactus); - addIgnoredBlockMetadata(Blocks.reeds); - addIgnoredBlockMetadata(Blocks.pumpkin); - addIgnoredBlockMetadata(Blocks.portal); - addIgnoredBlockMetadata(Blocks.lit_pumpkin); - addIgnoredBlockMetadata(Blocks.cake); - addIgnoredBlockMetadata(Blocks.unpowered_repeater); - addIgnoredBlockMetadata(Blocks.powered_repeater); - addIgnoredBlockMetadata(Blocks.trapdoor); - addIgnoredBlockMetadata(Blocks.vine); - addIgnoredBlockMetadata(Blocks.fence_gate); - addIgnoredBlockMetadata(Blocks.brick_stairs); - addIgnoredBlockMetadata(Blocks.stone_brick_stairs); - addIgnoredBlockMetadata(Blocks.waterlily); - addIgnoredBlockMetadata(Blocks.nether_brick_stairs); - addIgnoredBlockMetadata(Blocks.nether_wart); - addIgnoredBlockMetadata(Blocks.end_portal_frame); - addIgnoredBlockMetadata(Blocks.redstone_lamp); - addIgnoredBlockMetadata(Blocks.lit_redstone_lamp); - addIgnoredBlockMetadata(Blocks.sandstone_stairs); - addIgnoredBlockMetadata(Blocks.ender_chest); - addIgnoredBlockMetadata(Blocks.tripwire_hook); - addIgnoredBlockMetadata(Blocks.tripwire); - addIgnoredBlockMetadata(Blocks.spruce_stairs); - addIgnoredBlockMetadata(Blocks.birch_stairs); - addIgnoredBlockMetadata(Blocks.jungle_stairs); - addIgnoredBlockMetadata(Blocks.command_block); - addIgnoredBlockMetadata(Blocks.flower_pot); - addIgnoredBlockMetadata(Blocks.carrots); - addIgnoredBlockMetadata(Blocks.potatoes); - addIgnoredBlockMetadata(Blocks.wooden_button); - addIgnoredBlockMetadata(Blocks.anvil); - addIgnoredBlockMetadata(Blocks.trapped_chest); - addIgnoredBlockMetadata(Blocks.hopper); - addIgnoredBlockMetadata(Blocks.quartz_stairs); - addIgnoredBlockMetadata(Blocks.dropper); - } - - private static boolean addIgnoredBlockMetadata(Block block) { - if (block == null) { - return false; - } - - return BLOCK_LIST_IGNORE_METADATA.add(block); - } - - private static boolean addIgnoredBlockMetadata(String blockName) { - if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { - return false; - } - - return addIgnoredBlockMetadata(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); - } - - public static void populateBlockItemMap() { - BLOCK_ITEM_MAP.clear(); - - /** - * minecraft - */ - addBlockItemMapping(Blocks.flowing_water, Items.water_bucket); - addBlockItemMapping(Blocks.water, Items.water_bucket); - addBlockItemMapping(Blocks.flowing_lava, Items.lava_bucket); - addBlockItemMapping(Blocks.lava, Items.lava_bucket); - addBlockItemMapping(Blocks.bed, Items.bed); - addBlockItemMapping(Blocks.redstone_wire, Items.redstone); - addBlockItemMapping(Blocks.wheat, Items.wheat_seeds); - addBlockItemMapping(Blocks.lit_furnace, Blocks.furnace); - addBlockItemMapping(Blocks.standing_sign, Items.sign); - addBlockItemMapping(Blocks.wooden_door, Items.wooden_door); - addBlockItemMapping(Blocks.iron_door, Items.iron_door); - addBlockItemMapping(Blocks.wall_sign, Items.sign); - addBlockItemMapping(Blocks.unlit_redstone_torch, Blocks.redstone_torch); - addBlockItemMapping(Blocks.reeds, Items.reeds); - addBlockItemMapping(Blocks.unpowered_repeater, Items.repeater); - addBlockItemMapping(Blocks.powered_repeater, Items.repeater); - addBlockItemMapping(Blocks.pumpkin_stem, Items.pumpkin_seeds); - addBlockItemMapping(Blocks.melon_stem, Items.melon_seeds); - addBlockItemMapping(Blocks.nether_wart, Items.nether_wart); - addBlockItemMapping(Blocks.brewing_stand, Items.brewing_stand); - addBlockItemMapping(Blocks.cauldron, Items.cauldron); - addBlockItemMapping(Blocks.lit_redstone_lamp, Blocks.redstone_lamp); - addBlockItemMapping(Blocks.cocoa, Items.dye); - addBlockItemMapping(Blocks.tripwire, Items.string); - addBlockItemMapping(Blocks.flower_pot, Items.flower_pot); - addBlockItemMapping(Blocks.carrots, Items.carrot); - addBlockItemMapping(Blocks.potatoes, Items.potato); - addBlockItemMapping(Blocks.skull, Items.skull); - addBlockItemMapping(Blocks.unpowered_comparator, Items.comparator); - addBlockItemMapping(Blocks.powered_comparator, Items.comparator); - } - - private static Item addBlockItemMapping(Block block, Item item) { - if (block == null || item == null) { - return null; - } - - return BLOCK_ITEM_MAP.put(block, item); - } - - private static Item addBlockItemMapping(Block block, Block item) { - return addBlockItemMapping(block, Item.getItemFromBlock(item)); - } - - private static Item addBlockItemMapping(Object blockObj, Object itemObj) { - if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { - return null; - } - - Block block = null; - Item item = null; - - if (blockObj instanceof Block) { - block = (Block) blockObj; - } else if (blockObj instanceof String) { - block = GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockObj)); - } - - if (itemObj instanceof Item) { - item = (Item) itemObj; - } else if (itemObj instanceof Block) { - item = Item.getItemFromBlock((Block) itemObj); - } else if (itemObj instanceof String) { - String formattedName = String.format("%s:%s", modId, itemObj); - item = GameData.getItemRegistry().getObject(formattedName); - if (item == null) { - item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); - } - } - - return addBlockItemMapping(block, item); - } - - public static Item getItemFromBlock(Block block) { - Item item = BLOCK_ITEM_MAP.get(block); - if (item != null) { - return item; - } - - return Item.getItemFromBlock(block); - } - - public static void populatePlacementMaps() { - ITEM_PLACEMENT_MAP.clear(); - - /** - * minecraft - */ - addPlacementMapping(BlockButton.class, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); - addPlacementMapping(BlockChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(BlockDispenser.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockEnderChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(BlockFurnace.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(BlockHopper.class, new PlacementData(PlacementType.BLOCK, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockLog.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC).setMaskMetaInHand(0x3)); - addPlacementMapping(BlockPistonBase.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockPumpkin.class, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0xF)); - addPlacementMapping(BlockStairs.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 1, 0).setOffset(0x4, 0.0f, 1.0f).setMaskMeta(0x3)); - addPlacementMapping(BlockTorch.class, new PlacementData(PlacementType.BLOCK, 5, -1, 3, 4, 1, 2).setMaskMeta(0xF)); - - addPlacementMapping(Blocks.dirt, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.planks, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.sandstone, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.wool, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.yellow_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.red_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.double_stone_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.stone_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); - addPlacementMapping(Blocks.stained_glass, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.ladder, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(Blocks.lever, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); - addPlacementMapping(Blocks.snow_layer, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0x7)); - addPlacementMapping(Blocks.trapdoor, new PlacementData(PlacementType.BLOCK, -1, -1, 1, 0, 3, 2).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x3)); - addPlacementMapping(Blocks.monster_egg, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.stonebrick, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.tripwire_hook, new PlacementData(PlacementType.BLOCK, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); - addPlacementMapping(Blocks.quartz_block, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.fence_gate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3)); - addPlacementMapping(Blocks.double_wooden_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.wooden_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); - addPlacementMapping(Blocks.anvil, new PlacementData(PlacementType.PLAYER, -1, -1, 1, 3, 0, 2).setMaskMeta(0x3).setMaskMetaInHand(0xC).setBitShiftMetaInHand(2)); - addPlacementMapping(Blocks.stained_hardened_clay, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.carpet, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.stained_glass_pane, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Items.wooden_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); - addPlacementMapping(Items.iron_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); - addPlacementMapping(Items.repeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); - addPlacementMapping(Items.comparator, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); - } - - public static PlacementData addPlacementMapping(Class clazz, PlacementData data) { - if (clazz == null || data == null) { - return null; - } - - return CLASS_PLACEMENT_MAP.put(clazz, data); - } - - public static PlacementData addPlacementMapping(Item item, PlacementData data) { - if (item == null || data == null) { - return null; - } - - return ITEM_PLACEMENT_MAP.put(item, data); - } - - public static PlacementData addPlacementMapping(Block block, PlacementData data) { - return addPlacementMapping(Item.getItemFromBlock(block), data); - } - - public static PlacementData addPlacementMapping(Object itemObj, PlacementData data) { - if (itemObj == null || data == null) { - return null; - } - - Item item = null; - - if (itemObj instanceof Item) { - item = (Item) itemObj; - } else if (itemObj instanceof Block) { - item = Item.getItemFromBlock((Block) itemObj); - } else if (itemObj instanceof String) { - String formattedName = String.format("%s:%s", modId, itemObj); - item = GameData.getItemRegistry().getObject(formattedName); - if (item == null) { - item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); - } - } - - return addPlacementMapping(item, data); - } - - public static PlacementData getPlacementDataFromItem(Item item) { - Block block = Block.getBlockFromItem(item); - PlacementData data = null; - - for (Class clazz : CLASS_PLACEMENT_MAP.keySet()) { - if (clazz.isInstance(block)) { - data = CLASS_PLACEMENT_MAP.get(clazz); - break; - } - } - - for (Item i : ITEM_PLACEMENT_MAP.keySet()) { - if (i == item) { - data = ITEM_PLACEMENT_MAP.get(i); - break; - } - } - - return data; - } - - static { - populateIgnoredBlocks(); - populateIgnoredBlockMetadata(); - populateBlockItemMap(); - populatePlacementMaps(); - } + public static final List BLOCK_LIST_IGNORE_BLOCK = new ArrayList(); + public static final List BLOCK_LIST_IGNORE_METADATA = new ArrayList(); + public static final Map BLOCK_ITEM_MAP = new HashMap(); + public static final Map CLASS_PLACEMENT_MAP = new HashMap(); + public static final Map ITEM_PLACEMENT_MAP = new HashMap(); + + private static String modId = Names.ModId.MINECRAFT; + + public static void setModId(String modId) { + BlockInfo.modId = modId; + } + + public static void populateIgnoredBlocks() { + BLOCK_LIST_IGNORE_BLOCK.clear(); + + /** + * minecraft + */ + addIgnoredBlock(Blocks.piston_head); + addIgnoredBlock(Blocks.piston_extension); + addIgnoredBlock(Blocks.portal); + addIgnoredBlock(Blocks.end_portal); + } + + private static boolean addIgnoredBlock(Block block) { + if (block == null) { + return false; + } + + return BLOCK_LIST_IGNORE_BLOCK.add(block); + } + + private static boolean addIgnoredBlock(String blockName) { + if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + return false; + } + + return addIgnoredBlock(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); + } + + public static void populateIgnoredBlockMetadata() { + BLOCK_LIST_IGNORE_METADATA.clear(); + + /** + * minecraft + */ + addIgnoredBlockMetadata(Blocks.flowing_water); + addIgnoredBlockMetadata(Blocks.water); + addIgnoredBlockMetadata(Blocks.flowing_lava); + addIgnoredBlockMetadata(Blocks.lava); + addIgnoredBlockMetadata(Blocks.dispenser); + addIgnoredBlockMetadata(Blocks.bed); + addIgnoredBlockMetadata(Blocks.golden_rail); + addIgnoredBlockMetadata(Blocks.detector_rail); + addIgnoredBlockMetadata(Blocks.sticky_piston); + addIgnoredBlockMetadata(Blocks.piston); + addIgnoredBlockMetadata(Blocks.torch); + addIgnoredBlockMetadata(Blocks.oak_stairs); + addIgnoredBlockMetadata(Blocks.chest); + addIgnoredBlockMetadata(Blocks.redstone_wire); + addIgnoredBlockMetadata(Blocks.wheat); + addIgnoredBlockMetadata(Blocks.farmland); + addIgnoredBlockMetadata(Blocks.furnace); + addIgnoredBlockMetadata(Blocks.lit_furnace); + addIgnoredBlockMetadata(Blocks.standing_sign); + addIgnoredBlockMetadata(Blocks.wooden_door); + addIgnoredBlockMetadata(Blocks.ladder); + addIgnoredBlockMetadata(Blocks.rail); + addIgnoredBlockMetadata(Blocks.stone_stairs); + addIgnoredBlockMetadata(Blocks.wall_sign); + addIgnoredBlockMetadata(Blocks.lever); + addIgnoredBlockMetadata(Blocks.stone_pressure_plate); + addIgnoredBlockMetadata(Blocks.iron_door); + addIgnoredBlockMetadata(Blocks.wooden_pressure_plate); + addIgnoredBlockMetadata(Blocks.unlit_redstone_torch); + addIgnoredBlockMetadata(Blocks.redstone_torch); + addIgnoredBlockMetadata(Blocks.stone_button); + addIgnoredBlockMetadata(Blocks.cactus); + addIgnoredBlockMetadata(Blocks.reeds); + addIgnoredBlockMetadata(Blocks.pumpkin); + addIgnoredBlockMetadata(Blocks.portal); + addIgnoredBlockMetadata(Blocks.lit_pumpkin); + addIgnoredBlockMetadata(Blocks.cake); + addIgnoredBlockMetadata(Blocks.unpowered_repeater); + addIgnoredBlockMetadata(Blocks.powered_repeater); + addIgnoredBlockMetadata(Blocks.trapdoor); + addIgnoredBlockMetadata(Blocks.vine); + addIgnoredBlockMetadata(Blocks.fence_gate); + addIgnoredBlockMetadata(Blocks.brick_stairs); + addIgnoredBlockMetadata(Blocks.stone_brick_stairs); + addIgnoredBlockMetadata(Blocks.waterlily); + addIgnoredBlockMetadata(Blocks.nether_brick_stairs); + addIgnoredBlockMetadata(Blocks.nether_wart); + addIgnoredBlockMetadata(Blocks.end_portal_frame); + addIgnoredBlockMetadata(Blocks.redstone_lamp); + addIgnoredBlockMetadata(Blocks.lit_redstone_lamp); + addIgnoredBlockMetadata(Blocks.sandstone_stairs); + addIgnoredBlockMetadata(Blocks.ender_chest); + addIgnoredBlockMetadata(Blocks.tripwire_hook); + addIgnoredBlockMetadata(Blocks.tripwire); + addIgnoredBlockMetadata(Blocks.spruce_stairs); + addIgnoredBlockMetadata(Blocks.birch_stairs); + addIgnoredBlockMetadata(Blocks.jungle_stairs); + addIgnoredBlockMetadata(Blocks.command_block); + addIgnoredBlockMetadata(Blocks.flower_pot); + addIgnoredBlockMetadata(Blocks.carrots); + addIgnoredBlockMetadata(Blocks.potatoes); + addIgnoredBlockMetadata(Blocks.wooden_button); + addIgnoredBlockMetadata(Blocks.anvil); + addIgnoredBlockMetadata(Blocks.trapped_chest); + addIgnoredBlockMetadata(Blocks.hopper); + addIgnoredBlockMetadata(Blocks.quartz_stairs); + addIgnoredBlockMetadata(Blocks.dropper); + } + + private static boolean addIgnoredBlockMetadata(Block block) { + if (block == null) { + return false; + } + + return BLOCK_LIST_IGNORE_METADATA.add(block); + } + + private static boolean addIgnoredBlockMetadata(String blockName) { + if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + return false; + } + + return addIgnoredBlockMetadata(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); + } + + public static void populateBlockItemMap() { + BLOCK_ITEM_MAP.clear(); + + /** + * minecraft + */ + addBlockItemMapping(Blocks.flowing_water, Items.water_bucket); + addBlockItemMapping(Blocks.water, Items.water_bucket); + addBlockItemMapping(Blocks.flowing_lava, Items.lava_bucket); + addBlockItemMapping(Blocks.lava, Items.lava_bucket); + addBlockItemMapping(Blocks.bed, Items.bed); + addBlockItemMapping(Blocks.redstone_wire, Items.redstone); + addBlockItemMapping(Blocks.wheat, Items.wheat_seeds); + addBlockItemMapping(Blocks.lit_furnace, Blocks.furnace); + addBlockItemMapping(Blocks.standing_sign, Items.sign); + addBlockItemMapping(Blocks.wooden_door, Items.wooden_door); + addBlockItemMapping(Blocks.iron_door, Items.iron_door); + addBlockItemMapping(Blocks.wall_sign, Items.sign); + addBlockItemMapping(Blocks.unlit_redstone_torch, Blocks.redstone_torch); + addBlockItemMapping(Blocks.reeds, Items.reeds); + addBlockItemMapping(Blocks.unpowered_repeater, Items.repeater); + addBlockItemMapping(Blocks.powered_repeater, Items.repeater); + addBlockItemMapping(Blocks.pumpkin_stem, Items.pumpkin_seeds); + addBlockItemMapping(Blocks.melon_stem, Items.melon_seeds); + addBlockItemMapping(Blocks.nether_wart, Items.nether_wart); + addBlockItemMapping(Blocks.brewing_stand, Items.brewing_stand); + addBlockItemMapping(Blocks.cauldron, Items.cauldron); + addBlockItemMapping(Blocks.lit_redstone_lamp, Blocks.redstone_lamp); + addBlockItemMapping(Blocks.cocoa, Items.dye); + addBlockItemMapping(Blocks.tripwire, Items.string); + addBlockItemMapping(Blocks.flower_pot, Items.flower_pot); + addBlockItemMapping(Blocks.carrots, Items.carrot); + addBlockItemMapping(Blocks.potatoes, Items.potato); + addBlockItemMapping(Blocks.skull, Items.skull); + addBlockItemMapping(Blocks.unpowered_comparator, Items.comparator); + addBlockItemMapping(Blocks.powered_comparator, Items.comparator); + } + + private static Item addBlockItemMapping(Block block, Item item) { + if (block == null || item == null) { + return null; + } + + return BLOCK_ITEM_MAP.put(block, item); + } + + private static Item addBlockItemMapping(Block block, Block item) { + return addBlockItemMapping(block, Item.getItemFromBlock(item)); + } + + private static Item addBlockItemMapping(Object blockObj, Object itemObj) { + if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { + return null; + } + + Block block = null; + Item item = null; + + if (blockObj instanceof Block) { + block = (Block) blockObj; + } else if (blockObj instanceof String) { + block = GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockObj)); + } + + if (itemObj instanceof Item) { + item = (Item) itemObj; + } else if (itemObj instanceof Block) { + item = Item.getItemFromBlock((Block) itemObj); + } else if (itemObj instanceof String) { + String formattedName = String.format("%s:%s", modId, itemObj); + item = GameData.getItemRegistry().getObject(formattedName); + if (item == null) { + item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); + } + } + + return addBlockItemMapping(block, item); + } + + public static Item getItemFromBlock(Block block) { + Item item = BLOCK_ITEM_MAP.get(block); + if (item != null) { + return item; + } + + return Item.getItemFromBlock(block); + } + + public static void populatePlacementMaps() { + ITEM_PLACEMENT_MAP.clear(); + + /** + * minecraft + */ + addPlacementMapping(BlockButton.class, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); + addPlacementMapping(BlockChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); + addPlacementMapping(BlockDispenser.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); + addPlacementMapping(BlockEnderChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); + addPlacementMapping(BlockFurnace.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); + addPlacementMapping(BlockHopper.class, new PlacementData(PlacementType.BLOCK, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); + addPlacementMapping(BlockLog.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC).setMaskMetaInHand(0x3)); + addPlacementMapping(BlockPistonBase.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); + addPlacementMapping(BlockPumpkin.class, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0xF)); + addPlacementMapping(BlockStairs.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 1, 0).setOffset(0x4, 0.0f, 1.0f).setMaskMeta(0x3)); + addPlacementMapping(BlockTorch.class, new PlacementData(PlacementType.BLOCK, 5, -1, 3, 4, 1, 2).setMaskMeta(0xF)); + + addPlacementMapping(Blocks.dirt, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.planks, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.sandstone, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.wool, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.yellow_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.red_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.double_stone_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.stone_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); + addPlacementMapping(Blocks.stained_glass, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.ladder, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 2, 5, 4)); + addPlacementMapping(Blocks.lever, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); + addPlacementMapping(Blocks.snow_layer, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0x7)); + addPlacementMapping(Blocks.trapdoor, new PlacementData(PlacementType.BLOCK, -1, -1, 1, 0, 3, 2).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x3)); + addPlacementMapping(Blocks.monster_egg, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.stonebrick, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.tripwire_hook, new PlacementData(PlacementType.BLOCK, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); + addPlacementMapping(Blocks.quartz_block, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.fence_gate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3)); + addPlacementMapping(Blocks.double_wooden_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.wooden_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); + addPlacementMapping(Blocks.anvil, new PlacementData(PlacementType.PLAYER, -1, -1, 1, 3, 0, 2).setMaskMeta(0x3).setMaskMetaInHand(0xC).setBitShiftMetaInHand(2)); + addPlacementMapping(Blocks.stained_hardened_clay, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.carpet, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Blocks.stained_glass_pane, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); + addPlacementMapping(Items.wooden_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); + addPlacementMapping(Items.iron_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); + addPlacementMapping(Items.repeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); + addPlacementMapping(Items.comparator, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); + } + + public static PlacementData addPlacementMapping(Class clazz, PlacementData data) { + if (clazz == null || data == null) { + return null; + } + + return CLASS_PLACEMENT_MAP.put(clazz, data); + } + + public static PlacementData addPlacementMapping(Item item, PlacementData data) { + if (item == null || data == null) { + return null; + } + + return ITEM_PLACEMENT_MAP.put(item, data); + } + + public static PlacementData addPlacementMapping(Block block, PlacementData data) { + return addPlacementMapping(Item.getItemFromBlock(block), data); + } + + public static PlacementData addPlacementMapping(Object itemObj, PlacementData data) { + if (itemObj == null || data == null) { + return null; + } + + Item item = null; + + if (itemObj instanceof Item) { + item = (Item) itemObj; + } else if (itemObj instanceof Block) { + item = Item.getItemFromBlock((Block) itemObj); + } else if (itemObj instanceof String) { + String formattedName = String.format("%s:%s", modId, itemObj); + item = GameData.getItemRegistry().getObject(formattedName); + if (item == null) { + item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); + } + } + + return addPlacementMapping(item, data); + } + + public static PlacementData getPlacementDataFromItem(Item item) { + Block block = Block.getBlockFromItem(item); + PlacementData data = null; + + for (Class clazz : CLASS_PLACEMENT_MAP.keySet()) { + if (clazz.isInstance(block)) { + data = CLASS_PLACEMENT_MAP.get(clazz); + break; + } + } + + for (Item i : ITEM_PLACEMENT_MAP.keySet()) { + if (i == item) { + data = ITEM_PLACEMENT_MAP.get(i); + break; + } + } + + return data; + } + + static { + populateIgnoredBlocks(); + populateIgnoredBlockMetadata(); + populateBlockItemMap(); + populatePlacementMaps(); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java index ead43d36..bec81f82 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java +++ b/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java @@ -8,98 +8,98 @@ import java.util.Map; public class PlacementData { - public static enum PlacementType { - BLOCK, PLAYER, PISTON - } - - public static final ForgeDirection[] VALID_DIRECTIONS = ForgeDirection.VALID_DIRECTIONS; - - public final PlacementType type; - public int maskOffset = 0x0; - public float offsetLowY = 0.0f; - public float offsetHighY = 1.0f; - public int maskMetaInHand = -1; - public int bitShiftMetaInHand = 0; - public int maskMeta = 0xF; - public final Map mapping = new HashMap(); - - public PlacementData(PlacementType type, int... metadata) { - this.type = type; - - for (int i = 0; i < VALID_DIRECTIONS.length && i < metadata.length; i++) { - if (metadata[i] >= 0x0 && metadata[i] <= 0xF) { - this.mapping.put(VALID_DIRECTIONS[i], metadata[i]); - } - } - } - - public PlacementData setOffset(int maskOffset, float offsetLowY, float offsetHighY) { - this.maskOffset = maskOffset; - this.offsetLowY = offsetLowY; - this.offsetHighY = offsetHighY; - return this; - } - - public PlacementData setMaskMetaInHand(int maskMetaInHand) { - this.maskMetaInHand = maskMetaInHand; - return this; - } - - public PlacementData setBitShiftMetaInHand(int bitShiftMetaInHand) { - this.bitShiftMetaInHand = bitShiftMetaInHand; - return this; - } - - public PlacementData setMaskMeta(int maskMeta) { - this.maskMeta = maskMeta; - return this; - } - - public float getOffsetFromMetadata(int metadata) { - return (metadata & this.maskOffset) == 0 ? this.offsetLowY : this.offsetHighY; - } - - public int getMetaInHand(int metadata) { - if (this.maskMetaInHand != -1) { - metadata &= this.maskMetaInHand; - } - - if (this.bitShiftMetaInHand > 0) { - metadata >>= this.bitShiftMetaInHand; - } else if (this.bitShiftMetaInHand < 0) { - metadata <<= -this.bitShiftMetaInHand; - } - - return metadata; - } - - public ForgeDirection[] getValidDirections(ForgeDirection[] solidSides, int metadata) { - List list = new ArrayList(); - - for (ForgeDirection direction : solidSides) { - if (this.maskOffset != 0) { - if ((metadata & this.maskOffset) == 0) { - if (this.offsetLowY < 0.5f && direction == ForgeDirection.UP) { - continue; - } - } else { - if (this.offsetLowY < 0.5f && direction == ForgeDirection.DOWN) { - continue; - } - } - } - - if (this.type == PlacementType.BLOCK) { - Integer meta = this.mapping.get(direction); - if ((meta != null ? meta : -1) != (this.maskMeta & metadata) && this.mapping.size() != 0) { - continue; - } - } - - list.add(direction); - } - - ForgeDirection[] directions = new ForgeDirection[list.size()]; - return list.toArray(directions); - } + public static enum PlacementType { + BLOCK, PLAYER, PISTON + } + + public static final ForgeDirection[] VALID_DIRECTIONS = ForgeDirection.VALID_DIRECTIONS; + + public final PlacementType type; + public int maskOffset = 0x0; + public float offsetLowY = 0.0f; + public float offsetHighY = 1.0f; + public int maskMetaInHand = -1; + public int bitShiftMetaInHand = 0; + public int maskMeta = 0xF; + public final Map mapping = new HashMap(); + + public PlacementData(PlacementType type, int... metadata) { + this.type = type; + + for (int i = 0; i < VALID_DIRECTIONS.length && i < metadata.length; i++) { + if (metadata[i] >= 0x0 && metadata[i] <= 0xF) { + this.mapping.put(VALID_DIRECTIONS[i], metadata[i]); + } + } + } + + public PlacementData setOffset(int maskOffset, float offsetLowY, float offsetHighY) { + this.maskOffset = maskOffset; + this.offsetLowY = offsetLowY; + this.offsetHighY = offsetHighY; + return this; + } + + public PlacementData setMaskMetaInHand(int maskMetaInHand) { + this.maskMetaInHand = maskMetaInHand; + return this; + } + + public PlacementData setBitShiftMetaInHand(int bitShiftMetaInHand) { + this.bitShiftMetaInHand = bitShiftMetaInHand; + return this; + } + + public PlacementData setMaskMeta(int maskMeta) { + this.maskMeta = maskMeta; + return this; + } + + public float getOffsetFromMetadata(int metadata) { + return (metadata & this.maskOffset) == 0 ? this.offsetLowY : this.offsetHighY; + } + + public int getMetaInHand(int metadata) { + if (this.maskMetaInHand != -1) { + metadata &= this.maskMetaInHand; + } + + if (this.bitShiftMetaInHand > 0) { + metadata >>= this.bitShiftMetaInHand; + } else if (this.bitShiftMetaInHand < 0) { + metadata <<= -this.bitShiftMetaInHand; + } + + return metadata; + } + + public ForgeDirection[] getValidDirections(ForgeDirection[] solidSides, int metadata) { + List list = new ArrayList(); + + for (ForgeDirection direction : solidSides) { + if (this.maskOffset != 0) { + if ((metadata & this.maskOffset) == 0) { + if (this.offsetLowY < 0.5f && direction == ForgeDirection.UP) { + continue; + } + } else { + if (this.offsetLowY < 0.5f && direction == ForgeDirection.DOWN) { + continue; + } + } + } + + if (this.type == PlacementType.BLOCK) { + Integer meta = this.mapping.get(direction); + if ((meta != null ? meta : -1) != (this.maskMeta & metadata) && this.mapping.size() != 0) { + continue; + } + } + + list.add(direction); + } + + ForgeDirection[] directions = new ForgeDirection[list.size()]; + return list.toArray(directions); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 5b42599f..1a09136f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -15,153 +15,153 @@ import java.util.Queue; public class ConfigurationHandler { - public static final String VERSION = "1"; - - public static Configuration configuration; - - public static final boolean ENABLEALPHA_DEFAULT = false; - public static final double ALPHA_DEFAULT = 1.0; - public static final boolean HIGHLIGHT_DEFAULT = true; - public static final boolean HIGHLIGHTAIR_DEFAULT = true; - public static final double BLOCKDELTA_DEFAULT = 0.005; - public static final boolean DRAWQUADS_DEFAULT = true; - public static final boolean DRAWLINES_DEFAULT = true; - public static final int PLACEDELAY_DEFAULT = 1; - public static final int TIMEOUT_DEFAULT = 10; - public static final boolean PLACEINSTANTLY_DEFAULT = false; - public static final boolean DESTROYBLOCKS_DEFAULT = false; - public static final boolean DESTROYINSTANTLY_DEFAULT = false; - public static final boolean PLACEADJACENT_DEFAULT = true; - public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; - public static final String SCHEMATICDIRECTORY_STR = "schematics"; - public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); - - public static boolean enableAlpha = ENABLEALPHA_DEFAULT; - public static float alpha = (float) ALPHA_DEFAULT; - public static boolean highlight = HIGHLIGHT_DEFAULT; - public static boolean highlightAir = HIGHLIGHTAIR_DEFAULT; - public static float blockDelta = (float) BLOCKDELTA_DEFAULT; - public static boolean drawQuads = DRAWQUADS_DEFAULT; - public static boolean drawLines = DRAWLINES_DEFAULT; - public static int placeDelay = PLACEDELAY_DEFAULT; - public static int timeout = TIMEOUT_DEFAULT; - public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; - public static boolean destroyBlocks = DESTROYBLOCKS_DEFAULT; - public static boolean destroyInstantly = DESTROYINSTANTLY_DEFAULT; - public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; - public static int[] swapSlots = SWAPSLOTS_DEFAULT; - public static Queue swapSlotsQueue = new ArrayDeque(); - public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; - - public static Property propEnableAlpha = null; - public static Property propAlpha = null; - public static Property propHighlight = null; - public static Property propHighlightAir = null; - public static Property propBlockDelta = null; - public static Property propDrawQuads = null; - public static Property propDrawLines = null; - public static Property propPlaceDelay = null; - public static Property propTimeout = null; - public static Property propPlaceInstantly = null; - public static Property propDestroyBlocks = null; - public static Property propDestroyInstantly = null; - public static Property propPlaceAdjacent = null; - public static Property propSwapSlots = null; - public static Property propSchematicDirectory = null; - - public static void init(File configFile) { - if (configuration == null) { - configuration = new Configuration(configFile, VERSION); - loadConfiguration(); - } - } - - private static void loadConfiguration() { - propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLEALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); - propEnableAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA_ENABLED); - enableAlpha = propEnableAlpha.getBoolean(ENABLEALPHA_DEFAULT); - - propAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA, ALPHA_DEFAULT, Names.Config.ALPHA_DESC, 0.0, 1.0); - propAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA); - alpha = (float) propAlpha.getDouble(ALPHA_DEFAULT); - - propHighlight = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT, HIGHLIGHT_DEFAULT, Names.Config.HIGHLIGHT_DESC); - propHighlight.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT); - highlight = propHighlight.getBoolean(HIGHLIGHT_DEFAULT); - - propHighlightAir = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT_AIR, HIGHLIGHTAIR_DEFAULT, Names.Config.HIGHLIGHT_AIR_DESC); - propHighlightAir.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT_AIR); - highlightAir = propHighlightAir.getBoolean(HIGHLIGHTAIR_DEFAULT); - - propBlockDelta = configuration.get(Names.Config.Category.RENDER, Names.Config.BLOCK_DELTA, BLOCKDELTA_DEFAULT, Names.Config.BLOCK_DELTA_DESC, 0.0, 0.2); - propBlockDelta.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.BLOCK_DELTA); - blockDelta = (float) propBlockDelta.getDouble(BLOCKDELTA_DEFAULT); - - propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAWQUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); - propDrawQuads.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_QUADS); - drawQuads = propDrawQuads.getBoolean(DRAWQUADS_DEFAULT); - - propDrawLines = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_LINES, DRAWLINES_DEFAULT, Names.Config.DRAW_LINES_DESC); - propDrawLines.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_LINES); - drawLines = propDrawLines.getBoolean(DRAWLINES_DEFAULT); - - propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACEDELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); - propPlaceDelay.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DELAY); - placeDelay = propPlaceDelay.getInt(PLACEDELAY_DEFAULT); - - propTimeout = configuration.get(Names.Config.Category.PRINTER, Names.Config.TIMEOUT, TIMEOUT_DEFAULT, Names.Config.TIMEOUT_DESC, 0, 100); - propTimeout.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TIMEOUT); - timeout = propTimeout.getInt(TIMEOUT_DEFAULT); - - propPlaceInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_INSTANTLY, PLACEINSTANTLY_DEFAULT, Names.Config.PLACE_INSTANTLY_DESC); - propPlaceInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_INSTANTLY); - placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); - - propDestroyBlocks = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_BLOCKS, DESTROYBLOCKS_DEFAULT, Names.Config.DESTROY_BLOCKS_DESC); - propDestroyBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_BLOCKS); - destroyBlocks = propDestroyBlocks.getBoolean(DESTROYBLOCKS_DEFAULT); - - propDestroyInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, Names.Config.DESTROY_INSTANTLY_DESC); - propDestroyInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_INSTANTLY); - destroyInstantly = propDestroyInstantly.getBoolean(DESTROYINSTANTLY_DEFAULT); - - propPlaceAdjacent = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_ADJACENT, PLACEADJACENT_DEFAULT, Names.Config.PLACE_ADJACENT_DESC); - propPlaceAdjacent.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_ADJACENT); - placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); - - propSwapSlots = configuration.get(Names.Config.Category.PRINTER, Names.Config.SWAP_SLOTS, SWAPSLOTS_DEFAULT, Names.Config.SWAP_SLOTS_DESC, 0, 8); - propSwapSlots.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SWAP_SLOTS); - swapSlots = propSwapSlots.getIntList(); - swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); - - propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATICDIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); - propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); - schematicDirectory = new File(propSchematicDirectory.getString()); - - try { - schematicDirectory = schematicDirectory.getCanonicalFile(); - final String schematicPath = schematicDirectory.getAbsolutePath(); - final String dataPath = Schematica.proxy.getDataDirectory().getAbsolutePath(); - if (schematicPath.contains(dataPath)) { - propSchematicDirectory.set(schematicPath.substring(dataPath.length()).replace("\\", "/").replaceAll("^/+", "")); - } else { - propSchematicDirectory.set(schematicPath.replace("\\", "/")); - } - } catch (IOException e) { - Reference.logger.warn("Could not canonize path!", e); - } - - Schematica.proxy.createFolders(); - - if (configuration.hasChanged()) { - configuration.save(); - } - } - - @SubscribeEvent - public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { - if (event.modID.equalsIgnoreCase(Reference.MODID)) { - loadConfiguration(); - } - } + public static final String VERSION = "1"; + + public static Configuration configuration; + + public static final boolean ENABLEALPHA_DEFAULT = false; + public static final double ALPHA_DEFAULT = 1.0; + public static final boolean HIGHLIGHT_DEFAULT = true; + public static final boolean HIGHLIGHTAIR_DEFAULT = true; + public static final double BLOCKDELTA_DEFAULT = 0.005; + public static final boolean DRAWQUADS_DEFAULT = true; + public static final boolean DRAWLINES_DEFAULT = true; + public static final int PLACEDELAY_DEFAULT = 1; + public static final int TIMEOUT_DEFAULT = 10; + public static final boolean PLACEINSTANTLY_DEFAULT = false; + public static final boolean DESTROYBLOCKS_DEFAULT = false; + public static final boolean DESTROYINSTANTLY_DEFAULT = false; + public static final boolean PLACEADJACENT_DEFAULT = true; + public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; + public static final String SCHEMATICDIRECTORY_STR = "schematics"; + public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); + + public static boolean enableAlpha = ENABLEALPHA_DEFAULT; + public static float alpha = (float) ALPHA_DEFAULT; + public static boolean highlight = HIGHLIGHT_DEFAULT; + public static boolean highlightAir = HIGHLIGHTAIR_DEFAULT; + public static float blockDelta = (float) BLOCKDELTA_DEFAULT; + public static boolean drawQuads = DRAWQUADS_DEFAULT; + public static boolean drawLines = DRAWLINES_DEFAULT; + public static int placeDelay = PLACEDELAY_DEFAULT; + public static int timeout = TIMEOUT_DEFAULT; + public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; + public static boolean destroyBlocks = DESTROYBLOCKS_DEFAULT; + public static boolean destroyInstantly = DESTROYINSTANTLY_DEFAULT; + public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; + public static int[] swapSlots = SWAPSLOTS_DEFAULT; + public static Queue swapSlotsQueue = new ArrayDeque(); + public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; + + public static Property propEnableAlpha = null; + public static Property propAlpha = null; + public static Property propHighlight = null; + public static Property propHighlightAir = null; + public static Property propBlockDelta = null; + public static Property propDrawQuads = null; + public static Property propDrawLines = null; + public static Property propPlaceDelay = null; + public static Property propTimeout = null; + public static Property propPlaceInstantly = null; + public static Property propDestroyBlocks = null; + public static Property propDestroyInstantly = null; + public static Property propPlaceAdjacent = null; + public static Property propSwapSlots = null; + public static Property propSchematicDirectory = null; + + public static void init(File configFile) { + if (configuration == null) { + configuration = new Configuration(configFile, VERSION); + loadConfiguration(); + } + } + + private static void loadConfiguration() { + propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLEALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); + propEnableAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA_ENABLED); + enableAlpha = propEnableAlpha.getBoolean(ENABLEALPHA_DEFAULT); + + propAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA, ALPHA_DEFAULT, Names.Config.ALPHA_DESC, 0.0, 1.0); + propAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA); + alpha = (float) propAlpha.getDouble(ALPHA_DEFAULT); + + propHighlight = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT, HIGHLIGHT_DEFAULT, Names.Config.HIGHLIGHT_DESC); + propHighlight.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT); + highlight = propHighlight.getBoolean(HIGHLIGHT_DEFAULT); + + propHighlightAir = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT_AIR, HIGHLIGHTAIR_DEFAULT, Names.Config.HIGHLIGHT_AIR_DESC); + propHighlightAir.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT_AIR); + highlightAir = propHighlightAir.getBoolean(HIGHLIGHTAIR_DEFAULT); + + propBlockDelta = configuration.get(Names.Config.Category.RENDER, Names.Config.BLOCK_DELTA, BLOCKDELTA_DEFAULT, Names.Config.BLOCK_DELTA_DESC, 0.0, 0.2); + propBlockDelta.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.BLOCK_DELTA); + blockDelta = (float) propBlockDelta.getDouble(BLOCKDELTA_DEFAULT); + + propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAWQUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); + propDrawQuads.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_QUADS); + drawQuads = propDrawQuads.getBoolean(DRAWQUADS_DEFAULT); + + propDrawLines = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_LINES, DRAWLINES_DEFAULT, Names.Config.DRAW_LINES_DESC); + propDrawLines.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_LINES); + drawLines = propDrawLines.getBoolean(DRAWLINES_DEFAULT); + + propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACEDELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); + propPlaceDelay.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DELAY); + placeDelay = propPlaceDelay.getInt(PLACEDELAY_DEFAULT); + + propTimeout = configuration.get(Names.Config.Category.PRINTER, Names.Config.TIMEOUT, TIMEOUT_DEFAULT, Names.Config.TIMEOUT_DESC, 0, 100); + propTimeout.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TIMEOUT); + timeout = propTimeout.getInt(TIMEOUT_DEFAULT); + + propPlaceInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_INSTANTLY, PLACEINSTANTLY_DEFAULT, Names.Config.PLACE_INSTANTLY_DESC); + propPlaceInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_INSTANTLY); + placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); + + propDestroyBlocks = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_BLOCKS, DESTROYBLOCKS_DEFAULT, Names.Config.DESTROY_BLOCKS_DESC); + propDestroyBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_BLOCKS); + destroyBlocks = propDestroyBlocks.getBoolean(DESTROYBLOCKS_DEFAULT); + + propDestroyInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, Names.Config.DESTROY_INSTANTLY_DESC); + propDestroyInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_INSTANTLY); + destroyInstantly = propDestroyInstantly.getBoolean(DESTROYINSTANTLY_DEFAULT); + + propPlaceAdjacent = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_ADJACENT, PLACEADJACENT_DEFAULT, Names.Config.PLACE_ADJACENT_DESC); + propPlaceAdjacent.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_ADJACENT); + placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); + + propSwapSlots = configuration.get(Names.Config.Category.PRINTER, Names.Config.SWAP_SLOTS, SWAPSLOTS_DEFAULT, Names.Config.SWAP_SLOTS_DESC, 0, 8); + propSwapSlots.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SWAP_SLOTS); + swapSlots = propSwapSlots.getIntList(); + swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); + + propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATICDIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); + propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); + schematicDirectory = new File(propSchematicDirectory.getString()); + + try { + schematicDirectory = schematicDirectory.getCanonicalFile(); + final String schematicPath = schematicDirectory.getAbsolutePath(); + final String dataPath = Schematica.proxy.getDataDirectory().getAbsolutePath(); + if (schematicPath.contains(dataPath)) { + propSchematicDirectory.set(schematicPath.substring(dataPath.length()).replace("\\", "/").replaceAll("^/+", "")); + } else { + propSchematicDirectory.set(schematicPath.replace("\\", "/")); + } + } catch (IOException e) { + Reference.logger.warn("Could not canonize path!", e); + } + + Schematica.proxy.createFolders(); + + if (configuration.hasChanged()) { + configuration.save(); + } + } + + @SubscribeEvent + public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { + if (event.modID.equalsIgnoreCase(Reference.MODID)) { + loadConfiguration(); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 125996d9..b7aa8bc4 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -9,26 +9,26 @@ public class ChatEventHandler { - public static int chatLines = 0; + public static int chatLines = 0; - @SubscribeEvent - public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { - if (chatLines < 20) { - chatLines++; - String message = event.message.getFormattedText(); - Reference.logger.debug(String.format("Message #%d: %s", chatLines, message)); - if (message.contains(Names.SBC.DISABLE_PRINTER)) { - Reference.logger.info("Printer is disabled on this server."); - SchematicPrinter.INSTANCE.setEnabled(false); - } - if (message.contains(Names.SBC.DISABLE_SAVE)) { - Reference.logger.info("Saving is disabled on this server."); - Schematica.proxy.isSaveEnabled = false; - } - if (message.contains(Names.SBC.DISABLE_LOAD)) { - Reference.logger.info("Loading is disabled on this server."); - Schematica.proxy.isLoadEnabled = false; - } - } - } + @SubscribeEvent + public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { + if (chatLines < 20) { + chatLines++; + String message = event.message.getFormattedText(); + Reference.logger.debug(String.format("Message #%d: %s", chatLines, message)); + if (message.contains(Names.SBC.DISABLE_PRINTER)) { + Reference.logger.info("Printer is disabled on this server."); + SchematicPrinter.INSTANCE.setEnabled(false); + } + if (message.contains(Names.SBC.DISABLE_SAVE)) { + Reference.logger.info("Saving is disabled on this server."); + Schematica.proxy.isSaveEnabled = false; + } + if (message.contains(Names.SBC.DISABLE_LOAD)) { + Reference.logger.info("Loading is disabled on this server."); + Schematica.proxy.isLoadEnabled = false; + } + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index a51f7b4f..9bcb9ac0 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -25,115 +25,115 @@ import static cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent; public class KeyInputHandler { - public static final String CATEGORY = "schematica.key.category"; - public static final String LOAD = "schematica.key.load"; - public static final String SAVE = "schematica.key.save"; - public static final String CONTROL = "schematica.key.control"; - - private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(LOAD, Keyboard.KEY_DIVIDE, CATEGORY); - private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(SAVE, Keyboard.KEY_MULTIPLY, CATEGORY); - private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(CONTROL, Keyboard.KEY_SUBTRACT, CATEGORY); - - public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { - KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL - }; - - private final Minecraft minecraft = Minecraft.getMinecraft(); - - @SubscribeEvent - public void onKeyInput(KeyInputEvent event) { - for (KeyBinding keyBinding : KEY_BINDINGS) { - if (keyBinding.isPressed()) { - if (this.minecraft.currentScreen == null) { - GuiScreen guiScreen = null; - if (keyBinding == KEY_BINDING_LOAD) { - guiScreen = new GuiSchematicLoad(this.minecraft.currentScreen); - } else if (keyBinding == KEY_BINDING_SAVE) { - guiScreen = new GuiSchematicSave(this.minecraft.currentScreen); - } else if (keyBinding == KEY_BINDING_CONTROL) { - guiScreen = new GuiSchematicControl(this.minecraft.currentScreen); - } - - if (guiScreen != null) { - this.minecraft.displayGuiScreen(guiScreen); - } - } - } - } - } - - @SubscribeEvent - public void onMouseInput(MouseInputEvent event) { - if (this.minecraft.gameSettings.keyBindPickBlock.isPressed()) { - try { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - boolean revert = true; - - if (schematic != null) { - revert = pickBlock(schematic, 1.0f); - } - - if (revert) { - final int eventButton = Mouse.getEventButton(); - KeyBinding.onTick(eventButton - 100); - } - } catch (Exception e) { - Reference.logger.error("Could not pick block!", e); - } - } - } - - private boolean pickBlock(final SchematicWorld schematic, final float partialTicks) { - final MovingObjectPosition objectMouseOver = rayTrace(schematic, partialTicks); - boolean revert = false; - - // Minecraft.func_147112_ai - if (objectMouseOver != null) { - final EntityClientPlayerMP player = this.minecraft.thePlayer; - - if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { - revert = true; - } - - if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { - return revert; - } - - if (player.capabilities.isCreativeMode) { - final Block block = schematic.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); - final int metadata = schematic.getBlockMetadata(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); - if (block == Blocks.double_stone_slab || block == Blocks.double_wooden_slab || block == Blocks.snow_layer) { - player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(block, 1, metadata & 0xF)); - } - - final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; - this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); - } - } - - return revert; - } - - private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { - final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; - final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance(); - - final double posX = renderViewEntity.posX; - final double posY = renderViewEntity.posY; - final double posZ = renderViewEntity.posZ; - - renderViewEntity.posX -= schematic.position.x; - renderViewEntity.posY -= schematic.position.y; - renderViewEntity.posZ -= schematic.position.z; - - final Vec3 vecPosition = renderViewEntity.getPosition(partialTicks); - final Vec3 vecLook = renderViewEntity.getLook(partialTicks); - final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); - - renderViewEntity.posX = posX; - renderViewEntity.posY = posY; - renderViewEntity.posZ = posZ; - - return schematic.func_147447_a(vecPosition, vecExtendedLook, false, false, true); - } + public static final String CATEGORY = "schematica.key.category"; + public static final String LOAD = "schematica.key.load"; + public static final String SAVE = "schematica.key.save"; + public static final String CONTROL = "schematica.key.control"; + + private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(LOAD, Keyboard.KEY_DIVIDE, CATEGORY); + private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(SAVE, Keyboard.KEY_MULTIPLY, CATEGORY); + private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(CONTROL, Keyboard.KEY_SUBTRACT, CATEGORY); + + public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { + KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL + }; + + private final Minecraft minecraft = Minecraft.getMinecraft(); + + @SubscribeEvent + public void onKeyInput(KeyInputEvent event) { + for (KeyBinding keyBinding : KEY_BINDINGS) { + if (keyBinding.isPressed()) { + if (this.minecraft.currentScreen == null) { + GuiScreen guiScreen = null; + if (keyBinding == KEY_BINDING_LOAD) { + guiScreen = new GuiSchematicLoad(this.minecraft.currentScreen); + } else if (keyBinding == KEY_BINDING_SAVE) { + guiScreen = new GuiSchematicSave(this.minecraft.currentScreen); + } else if (keyBinding == KEY_BINDING_CONTROL) { + guiScreen = new GuiSchematicControl(this.minecraft.currentScreen); + } + + if (guiScreen != null) { + this.minecraft.displayGuiScreen(guiScreen); + } + } + } + } + } + + @SubscribeEvent + public void onMouseInput(MouseInputEvent event) { + if (this.minecraft.gameSettings.keyBindPickBlock.isPressed()) { + try { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + boolean revert = true; + + if (schematic != null) { + revert = pickBlock(schematic, 1.0f); + } + + if (revert) { + final int eventButton = Mouse.getEventButton(); + KeyBinding.onTick(eventButton - 100); + } + } catch (Exception e) { + Reference.logger.error("Could not pick block!", e); + } + } + } + + private boolean pickBlock(final SchematicWorld schematic, final float partialTicks) { + final MovingObjectPosition objectMouseOver = rayTrace(schematic, partialTicks); + boolean revert = false; + + // Minecraft.func_147112_ai + if (objectMouseOver != null) { + final EntityClientPlayerMP player = this.minecraft.thePlayer; + + if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { + revert = true; + } + + if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { + return revert; + } + + if (player.capabilities.isCreativeMode) { + final Block block = schematic.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); + final int metadata = schematic.getBlockMetadata(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); + if (block == Blocks.double_stone_slab || block == Blocks.double_wooden_slab || block == Blocks.snow_layer) { + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(block, 1, metadata & 0xF)); + } + + final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; + this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); + } + } + + return revert; + } + + private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { + final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; + final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance(); + + final double posX = renderViewEntity.posX; + final double posY = renderViewEntity.posY; + final double posZ = renderViewEntity.posZ; + + renderViewEntity.posX -= schematic.position.x; + renderViewEntity.posY -= schematic.position.y; + renderViewEntity.posZ -= schematic.position.z; + + final Vec3 vecPosition = renderViewEntity.getPosition(partialTicks); + final Vec3 vecLook = renderViewEntity.getLook(partialTicks); + final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); + + renderViewEntity.posX = posX; + renderViewEntity.posY = posY; + renderViewEntity.posZ = posZ; + + return schematic.func_147447_a(vecPosition, vecExtendedLook, false, false, true); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index f8f47f6b..7dea0a7e 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -15,71 +15,71 @@ import net.minecraft.util.AxisAlignedBB; public class TickHandler { - private final Minecraft minecraft = Minecraft.getMinecraft(); + private final Minecraft minecraft = Minecraft.getMinecraft(); - private int ticks = -1; + private int ticks = -1; - public TickHandler() { - } + public TickHandler() { + } - @SubscribeEvent - public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { - Reference.logger.info("Scheduling client settings reset."); - ClientProxy.isPendingReset = true; - } + @SubscribeEvent + public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { + Reference.logger.info("Scheduling client settings reset."); + ClientProxy.isPendingReset = true; + } - @SubscribeEvent - public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { - Reference.logger.info("Scheduling client settings reset."); - ClientProxy.isPendingReset = true; - } + @SubscribeEvent + public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { + Reference.logger.info("Scheduling client settings reset."); + ClientProxy.isPendingReset = true; + } - @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.END) { - this.minecraft.mcProfiler.startSection("schematica"); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (this.minecraft.thePlayer != null && schematic != null && schematic.isRendering) { - this.minecraft.mcProfiler.startSection("printer"); - SchematicPrinter printer = SchematicPrinter.INSTANCE; - if (printer.isEnabled() && printer.isPrinting() && this.ticks-- < 0) { - this.ticks = ConfigurationHandler.placeDelay; + @SubscribeEvent + public void onClientTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.END) { + this.minecraft.mcProfiler.startSection("schematica"); + SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (this.minecraft.thePlayer != null && schematic != null && schematic.isRendering) { + this.minecraft.mcProfiler.startSection("printer"); + SchematicPrinter printer = SchematicPrinter.INSTANCE; + if (printer.isEnabled() && printer.isPrinting() && this.ticks-- < 0) { + this.ticks = ConfigurationHandler.placeDelay; - printer.print(); - } + printer.print(); + } - this.minecraft.mcProfiler.endStartSection("checkDirty"); - checkDirty(schematic); + this.minecraft.mcProfiler.endStartSection("checkDirty"); + checkDirty(schematic); - this.minecraft.mcProfiler.endStartSection("canUpdate"); - RendererSchematicChunk.setCanUpdate(true); + this.minecraft.mcProfiler.endStartSection("canUpdate"); + RendererSchematicChunk.setCanUpdate(true); - this.minecraft.mcProfiler.endSection(); - } + this.minecraft.mcProfiler.endSection(); + } - if (ClientProxy.isPendingReset) { - Schematica.proxy.resetSettings(); - ClientProxy.isPendingReset = false; - } + if (ClientProxy.isPendingReset) { + Schematica.proxy.resetSettings(); + ClientProxy.isPendingReset = false; + } - this.minecraft.mcProfiler.endSection(); - } - } + this.minecraft.mcProfiler.endSection(); + } + } - private void checkDirty(SchematicWorld schematic) { - WorldRenderer[] renderers = this.minecraft.renderGlobal.sortedWorldRenderers; - if (renderers != null) { - int count = 0; - for (WorldRenderer worldRenderer : renderers) { - if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { - AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-schematic.position.x, -schematic.position.y, -schematic.position.z); - for (RendererSchematicChunk renderer : ClientProxy.rendererSchematicGlobal.sortedRendererSchematicChunk) { - if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { - renderer.setDirty(); - } - } - } - } - } - } + private void checkDirty(SchematicWorld schematic) { + WorldRenderer[] renderers = this.minecraft.renderGlobal.sortedWorldRenderers; + if (renderers != null) { + int count = 0; + for (WorldRenderer worldRenderer : renderers) { + if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { + AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-schematic.position.x, -schematic.position.y, -schematic.position.z); + for (RendererSchematicChunk renderer : ClientProxy.rendererSchematicGlobal.sortedRendererSchematicChunk) { + if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { + renderer.setDirty(); + } + } + } + } + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 10b6e173..56f21e42 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -28,239 +28,239 @@ import java.io.IOException; public class ClientProxy extends CommonProxy { - // TODO: remove this and replace the 3 sepparate buttons with a single control - public static final int[] INCREMENTS = { - 1, 5, 15, 50, 250 - }; - - public static RendererSchematicGlobal rendererSchematicGlobal = null; - public static boolean isRenderingGuide = false; - public static boolean isPendingReset = false; - - public static final Vector3f playerPosition = new Vector3f(); - public static ForgeDirection orientation = ForgeDirection.UNKNOWN; - public static int rotationRender = 0; - - public static final Vector3i pointA = new Vector3i(); - public static final Vector3i pointB = new Vector3i(); - public static final Vector3i pointMin = new Vector3i(); - public static final Vector3i pointMax = new Vector3i(); - - private SchematicWorld schematicWorld = null; - - public static void setPlayerData(EntityPlayer player, float partialTicks) { - playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks); - playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks); - playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks); - - orientation = getOrientation(player); - - rotationRender = MathHelper.floor_double(player.rotationYaw / 90) & 3; - } - - private static ForgeDirection getOrientation(EntityPlayer player) { - if (player.rotationPitch > 45) { - return ForgeDirection.DOWN; - } else if (player.rotationPitch < -45) { - return ForgeDirection.UP; - } else { - switch (MathHelper.floor_double(player.rotationYaw / 90.0 + 0.5) & 3) { - case 0: - return ForgeDirection.SOUTH; - case 1: - return ForgeDirection.WEST; - case 2: - return ForgeDirection.NORTH; - case 3: - return ForgeDirection.EAST; - } - } - - return ForgeDirection.UNKNOWN; - } - - public static void updatePoints() { - pointMin.x = Math.min(pointA.x, pointB.x); - pointMin.y = Math.min(pointA.y, pointB.y); - pointMin.z = Math.min(pointA.z, pointB.z); - - pointMax.x = Math.max(pointA.x, pointB.x); - pointMax.y = Math.max(pointA.y, pointB.y); - pointMax.z = Math.max(pointA.z, pointB.z); - } - - public static void movePointToPlayer(Vector3i point) { - point.x = (int) Math.floor(playerPosition.x); - point.y = (int) Math.floor(playerPosition.y - 1); - point.z = (int) Math.floor(playerPosition.z); - - switch (rotationRender) { - case 0: - point.x -= 1; - point.z += 1; - break; - case 1: - point.x -= 1; - point.z -= 1; - break; - case 2: - point.x += 1; - point.z -= 1; - break; - case 3: - point.x += 1; - point.z += 1; - break; - } - } - - public static void moveSchematicToPlayer(SchematicWorld schematic) { - Vector3i position = schematic.position; - position.x = (int) Math.floor(playerPosition.x); - position.y = (int) Math.floor(playerPosition.y) - 1; - position.z = (int) Math.floor(playerPosition.z); - - if (schematic != null) { - switch (rotationRender) { - case 0: - position.x -= schematic.getWidth(); - position.z += 1; - break; - case 1: - position.x -= schematic.getWidth(); - position.z -= schematic.getLength(); - break; - case 2: - position.x += 1; - position.z -= schematic.getLength(); - break; - case 3: - position.x += 1; - position.z += 1; - break; - } - } - } - - @Override - public void setConfigEntryClasses() { - ConfigurationHandler.propAlpha.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propBlockDelta.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propPlaceDelay.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propTimeout.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - } - - @Override - public void registerKeybindings() { - for (KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) { - ClientRegistry.registerKeyBinding(keyBinding); - } - } - - @Override - public void registerEvents() { - FMLCommonHandler.instance().bus().register(new KeyInputHandler()); - FMLCommonHandler.instance().bus().register(new TickHandler()); - FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); - - rendererSchematicGlobal = new RendererSchematicGlobal(); - MinecraftForge.EVENT_BUS.register(rendererSchematicGlobal); - MinecraftForge.EVENT_BUS.register(new ChatEventHandler()); - } - - @Override - public File getDataDirectory() { - final File file = Minecraft.getMinecraft().mcDataDir; - try { - return file.getCanonicalFile(); - } catch (IOException e) { - Reference.logger.info("Could not canonize path!", e); - } - return file; - } - - @Override - public void resetSettings() { - super.resetSettings(); - - ChatEventHandler.chatLines = 0; - - SchematicPrinter.INSTANCE.setEnabled(true); - SchematicPrinter.INSTANCE.setSchematic(null); - - rendererSchematicGlobal.destroyRendererSchematicChunks(); - - setActiveSchematic(null); - - playerPosition.set(0, 0, 0); - orientation = ForgeDirection.UNKNOWN; - rotationRender = 0; - - pointA.set(0, 0, 0); - pointB.set(0, 0, 0); - updatePoints(); - } - - @Override - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { - try { - String iconName = ""; - - try { - String[] parts = filename.split(";"); - if (parts.length == 2) { - iconName = parts[0]; - filename = parts[1]; - } - } catch (Exception e) { - Reference.logger.error("Failed to parse icon data!", e); - } - - SchematicWorld schematic = getSchematicFromWorld(world, from, to); - schematic.setIcon(SchematicUtil.getIconFromName(iconName)); - SchematicFormat.writeToFile(directory, filename, schematic); - - return true; - } catch (Exception e) { - Reference.logger.error("Failed to save schematic!", e); - } - return false; - } - - @Override - public boolean loadSchematic(EntityPlayer player, File directory, String filename) { - SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); - if (schematic == null) { - return false; - } - - Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, schematic.getWidth(), schematic.getHeight(), schematic.getLength())); - - Schematica.proxy.setActiveSchematic(schematic); - rendererSchematicGlobal.createRendererSchematicChunks(schematic); - SchematicPrinter.INSTANCE.setSchematic(schematic); - schematic.isRendering = true; - - return true; - } - - @Override - public void setActiveSchematic(SchematicWorld world) { - this.schematicWorld = world; - } - - @Override - public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { - setActiveSchematic(world); - } - - @Override - public SchematicWorld getActiveSchematic() { - return this.schematicWorld; - } - - @Override - public SchematicWorld getActiveSchematic(EntityPlayer player) { - return getActiveSchematic(); - } + // TODO: remove this and replace the 3 sepparate buttons with a single control + public static final int[] INCREMENTS = { + 1, 5, 15, 50, 250 + }; + + public static RendererSchematicGlobal rendererSchematicGlobal = null; + public static boolean isRenderingGuide = false; + public static boolean isPendingReset = false; + + public static final Vector3f playerPosition = new Vector3f(); + public static ForgeDirection orientation = ForgeDirection.UNKNOWN; + public static int rotationRender = 0; + + public static final Vector3i pointA = new Vector3i(); + public static final Vector3i pointB = new Vector3i(); + public static final Vector3i pointMin = new Vector3i(); + public static final Vector3i pointMax = new Vector3i(); + + private SchematicWorld schematicWorld = null; + + public static void setPlayerData(EntityPlayer player, float partialTicks) { + playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks); + playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks); + playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks); + + orientation = getOrientation(player); + + rotationRender = MathHelper.floor_double(player.rotationYaw / 90) & 3; + } + + private static ForgeDirection getOrientation(EntityPlayer player) { + if (player.rotationPitch > 45) { + return ForgeDirection.DOWN; + } else if (player.rotationPitch < -45) { + return ForgeDirection.UP; + } else { + switch (MathHelper.floor_double(player.rotationYaw / 90.0 + 0.5) & 3) { + case 0: + return ForgeDirection.SOUTH; + case 1: + return ForgeDirection.WEST; + case 2: + return ForgeDirection.NORTH; + case 3: + return ForgeDirection.EAST; + } + } + + return ForgeDirection.UNKNOWN; + } + + public static void updatePoints() { + pointMin.x = Math.min(pointA.x, pointB.x); + pointMin.y = Math.min(pointA.y, pointB.y); + pointMin.z = Math.min(pointA.z, pointB.z); + + pointMax.x = Math.max(pointA.x, pointB.x); + pointMax.y = Math.max(pointA.y, pointB.y); + pointMax.z = Math.max(pointA.z, pointB.z); + } + + public static void movePointToPlayer(Vector3i point) { + point.x = (int) Math.floor(playerPosition.x); + point.y = (int) Math.floor(playerPosition.y - 1); + point.z = (int) Math.floor(playerPosition.z); + + switch (rotationRender) { + case 0: + point.x -= 1; + point.z += 1; + break; + case 1: + point.x -= 1; + point.z -= 1; + break; + case 2: + point.x += 1; + point.z -= 1; + break; + case 3: + point.x += 1; + point.z += 1; + break; + } + } + + public static void moveSchematicToPlayer(SchematicWorld schematic) { + Vector3i position = schematic.position; + position.x = (int) Math.floor(playerPosition.x); + position.y = (int) Math.floor(playerPosition.y) - 1; + position.z = (int) Math.floor(playerPosition.z); + + if (schematic != null) { + switch (rotationRender) { + case 0: + position.x -= schematic.getWidth(); + position.z += 1; + break; + case 1: + position.x -= schematic.getWidth(); + position.z -= schematic.getLength(); + break; + case 2: + position.x += 1; + position.z -= schematic.getLength(); + break; + case 3: + position.x += 1; + position.z += 1; + break; + } + } + } + + @Override + public void setConfigEntryClasses() { + ConfigurationHandler.propAlpha.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propBlockDelta.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propPlaceDelay.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propTimeout.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + } + + @Override + public void registerKeybindings() { + for (KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) { + ClientRegistry.registerKeyBinding(keyBinding); + } + } + + @Override + public void registerEvents() { + FMLCommonHandler.instance().bus().register(new KeyInputHandler()); + FMLCommonHandler.instance().bus().register(new TickHandler()); + FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); + + rendererSchematicGlobal = new RendererSchematicGlobal(); + MinecraftForge.EVENT_BUS.register(rendererSchematicGlobal); + MinecraftForge.EVENT_BUS.register(new ChatEventHandler()); + } + + @Override + public File getDataDirectory() { + final File file = Minecraft.getMinecraft().mcDataDir; + try { + return file.getCanonicalFile(); + } catch (IOException e) { + Reference.logger.info("Could not canonize path!", e); + } + return file; + } + + @Override + public void resetSettings() { + super.resetSettings(); + + ChatEventHandler.chatLines = 0; + + SchematicPrinter.INSTANCE.setEnabled(true); + SchematicPrinter.INSTANCE.setSchematic(null); + + rendererSchematicGlobal.destroyRendererSchematicChunks(); + + setActiveSchematic(null); + + playerPosition.set(0, 0, 0); + orientation = ForgeDirection.UNKNOWN; + rotationRender = 0; + + pointA.set(0, 0, 0); + pointB.set(0, 0, 0); + updatePoints(); + } + + @Override + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { + try { + String iconName = ""; + + try { + String[] parts = filename.split(";"); + if (parts.length == 2) { + iconName = parts[0]; + filename = parts[1]; + } + } catch (Exception e) { + Reference.logger.error("Failed to parse icon data!", e); + } + + SchematicWorld schematic = getSchematicFromWorld(world, from, to); + schematic.setIcon(SchematicUtil.getIconFromName(iconName)); + SchematicFormat.writeToFile(directory, filename, schematic); + + return true; + } catch (Exception e) { + Reference.logger.error("Failed to save schematic!", e); + } + return false; + } + + @Override + public boolean loadSchematic(EntityPlayer player, File directory, String filename) { + SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); + if (schematic == null) { + return false; + } + + Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, schematic.getWidth(), schematic.getHeight(), schematic.getLength())); + + Schematica.proxy.setActiveSchematic(schematic); + rendererSchematicGlobal.createRendererSchematicChunks(schematic); + SchematicPrinter.INSTANCE.setSchematic(schematic); + schematic.isRendering = true; + + return true; + } + + @Override + public void setActiveSchematic(SchematicWorld world) { + this.schematicWorld = world; + } + + @Override + public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { + setActiveSchematic(world); + } + + @Override + public SchematicWorld getActiveSchematic() { + return this.schematicWorld; + } + + @Override + public SchematicWorld getActiveSchematic(EntityPlayer player) { + return getActiveSchematic(); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index dd77f904..5bade0b4 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -16,90 +16,90 @@ import java.util.List; public abstract class CommonProxy { - public boolean isSaveEnabled = true; - public boolean isLoadEnabled = true; - - public abstract void setConfigEntryClasses(); - - public abstract void registerKeybindings(); - - public abstract void registerEvents(); - - public void createFolders() { - if (!ConfigurationHandler.schematicDirectory.exists()) { - if (!ConfigurationHandler.schematicDirectory.mkdirs()) { - Reference.logger.info("Could not create schematic directory [%s]!", ConfigurationHandler.schematicDirectory.getAbsolutePath()); - } - } - } - - public abstract File getDataDirectory(); - - public void resetSettings() { - this.isSaveEnabled = true; - this.isLoadEnabled = true; - } - - public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i to) { - try { - int minX = Math.min(from.x, to.x); - int maxX = Math.max(from.x, to.x); - int minY = Math.min(from.y, to.y); - int maxY = Math.max(from.y, to.y); - int minZ = Math.min(from.z, to.z); - int maxZ = Math.max(from.z, to.z); - short width = (short) (Math.abs(maxX - minX) + 1); - short height = (short) (Math.abs(maxY - minY) + 1); - short length = (short) (Math.abs(maxZ - minZ) + 1); - - short[][][] blocks = new short[width][height][length]; - byte[][][] metadata = new byte[width][height][length]; - List tileEntities = new ArrayList(); - - for (int x = minX; x <= maxX; x++) { - for (int y = minY; y <= maxY; y++) { - for (int z = minZ; z <= maxZ; z++) { - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(world.getBlock(x, y, z)); - metadata[x - minX][y - minY][z - minZ] = (byte) world.getBlockMetadata(x, y, z); - - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity != null) { - try { - NBTTagCompound tileEntityNBT = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityNBT); - - tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); - tileEntity.xCoord -= minX; - tileEntity.yCoord -= minY; - tileEntity.zCoord -= minZ; - tileEntities.add(tileEntity); - } catch (Exception e) { - Reference.logger.error(String.format("Error while trying to save tile entity %s!", tileEntity), e); - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); - metadata[x - minX][y - minY][z - minZ] = 0; - } - } - } - } - } - - return new SchematicWorld("", blocks, metadata, tileEntities, width, height, length); - } catch (Exception e) { - Reference.logger.error("Failed to extract schematic!", e); - } - - return null; - } - - public abstract boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to); - - public abstract boolean loadSchematic(EntityPlayer player, File directory, String filename); - - public abstract void setActiveSchematic(SchematicWorld world); - - public abstract void setActiveSchematic(SchematicWorld world, EntityPlayer player); - - public abstract SchematicWorld getActiveSchematic(); - - public abstract SchematicWorld getActiveSchematic(EntityPlayer player); + public boolean isSaveEnabled = true; + public boolean isLoadEnabled = true; + + public abstract void setConfigEntryClasses(); + + public abstract void registerKeybindings(); + + public abstract void registerEvents(); + + public void createFolders() { + if (!ConfigurationHandler.schematicDirectory.exists()) { + if (!ConfigurationHandler.schematicDirectory.mkdirs()) { + Reference.logger.info("Could not create schematic directory [%s]!", ConfigurationHandler.schematicDirectory.getAbsolutePath()); + } + } + } + + public abstract File getDataDirectory(); + + public void resetSettings() { + this.isSaveEnabled = true; + this.isLoadEnabled = true; + } + + public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i to) { + try { + int minX = Math.min(from.x, to.x); + int maxX = Math.max(from.x, to.x); + int minY = Math.min(from.y, to.y); + int maxY = Math.max(from.y, to.y); + int minZ = Math.min(from.z, to.z); + int maxZ = Math.max(from.z, to.z); + short width = (short) (Math.abs(maxX - minX) + 1); + short height = (short) (Math.abs(maxY - minY) + 1); + short length = (short) (Math.abs(maxZ - minZ) + 1); + + short[][][] blocks = new short[width][height][length]; + byte[][][] metadata = new byte[width][height][length]; + List tileEntities = new ArrayList(); + + for (int x = minX; x <= maxX; x++) { + for (int y = minY; y <= maxY; y++) { + for (int z = minZ; z <= maxZ; z++) { + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(world.getBlock(x, y, z)); + metadata[x - minX][y - minY][z - minZ] = (byte) world.getBlockMetadata(x, y, z); + + TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + try { + NBTTagCompound tileEntityNBT = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityNBT); + + tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); + tileEntity.xCoord -= minX; + tileEntity.yCoord -= minY; + tileEntity.zCoord -= minZ; + tileEntities.add(tileEntity); + } catch (Exception e) { + Reference.logger.error(String.format("Error while trying to save tile entity %s!", tileEntity), e); + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); + metadata[x - minX][y - minY][z - minZ] = 0; + } + } + } + } + } + + return new SchematicWorld("", blocks, metadata, tileEntities, width, height, length); + } catch (Exception e) { + Reference.logger.error("Failed to extract schematic!", e); + } + + return null; + } + + public abstract boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to); + + public abstract boolean loadSchematic(EntityPlayer player, File directory, String filename); + + public abstract void setActiveSchematic(SchematicWorld world); + + public abstract void setActiveSchematic(SchematicWorld world, EntityPlayer player); + + public abstract SchematicWorld getActiveSchematic(); + + public abstract SchematicWorld getActiveSchematic(EntityPlayer player); } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 48a84871..39b476c3 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -11,54 +11,54 @@ import java.io.IOException; public class ServerProxy extends CommonProxy { - @Override - public void setConfigEntryClasses() { - } + @Override + public void setConfigEntryClasses() { + } - @Override - public void registerKeybindings() { - } + @Override + public void registerKeybindings() { + } - @Override - public void registerEvents() { - } + @Override + public void registerEvents() { + } - @Override - public File getDataDirectory() { - final File file = MinecraftServer.getServer().getFile("."); - try { - return file.getCanonicalFile(); - } catch (IOException e) { - Reference.logger.info("Could not canonize path!", e); - } - return file; - } + @Override + public File getDataDirectory() { + final File file = MinecraftServer.getServer().getFile("."); + try { + return file.getCanonicalFile(); + } catch (IOException e) { + Reference.logger.info("Could not canonize path!", e); + } + return file; + } - @Override - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { - return false; - } + @Override + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { + return false; + } - @Override - public boolean loadSchematic(EntityPlayer player, File directory, String filename) { - return false; - } + @Override + public boolean loadSchematic(EntityPlayer player, File directory, String filename) { + return false; + } - @Override - public void setActiveSchematic(SchematicWorld world) { - } + @Override + public void setActiveSchematic(SchematicWorld world) { + } - @Override - public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { - } + @Override + public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { + } - @Override - public SchematicWorld getActiveSchematic() { - return null; - } + @Override + public SchematicWorld getActiveSchematic() { + return null; + } - @Override - public SchematicWorld getActiveSchematic(EntityPlayer player) { - return null; - } + @Override + public SchematicWorld getActiveSchematic(EntityPlayer player) { + return null; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index fd58bd35..2c5b6473 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -2,77 +2,77 @@ @SuppressWarnings("HardCodedStringLiteral") public final class Names { - public static final class Config { - public static final class Category { - public static final String RENDER = "render"; - public static final String PRINTER = "printer"; - public static final String GENERAL = "general"; - } + public static final class Config { + public static final class Category { + public static final String RENDER = "render"; + public static final String PRINTER = "printer"; + public static final String GENERAL = "general"; + } - public static final String ALPHA_ENABLED = "alphaEnabled"; - public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; - public static final String ALPHA = "alpha"; - public static final String ALPHA_DESC = "Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent)."; - public static final String HIGHLIGHT = "highlight"; - public static final String HIGHLIGHT_DESC = "Highlight invalid placed blocks and to be placed blocks."; - public static final String HIGHLIGHT_AIR = "highlightAir"; - public static final String HIGHLIGHT_AIR_DESC = "Highlight blocks that should be air."; - public static final String BLOCK_DELTA = "blockDelta"; - public static final String BLOCK_DELTA_DESC = "Delta value used for highlighting (if you experience z-fighting increase this)."; - public static final String DRAW_QUADS = "drawQuads"; - public static final String DRAW_QUADS_DESC = "Draw surface areas."; - public static final String DRAW_LINES = "drawLines"; - public static final String DRAW_LINES_DESC = "Draw outlines."; + public static final String ALPHA_ENABLED = "alphaEnabled"; + public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; + public static final String ALPHA = "alpha"; + public static final String ALPHA_DESC = "Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent)."; + public static final String HIGHLIGHT = "highlight"; + public static final String HIGHLIGHT_DESC = "Highlight invalid placed blocks and to be placed blocks."; + public static final String HIGHLIGHT_AIR = "highlightAir"; + public static final String HIGHLIGHT_AIR_DESC = "Highlight blocks that should be air."; + public static final String BLOCK_DELTA = "blockDelta"; + public static final String BLOCK_DELTA_DESC = "Delta value used for highlighting (if you experience z-fighting increase this)."; + public static final String DRAW_QUADS = "drawQuads"; + public static final String DRAW_QUADS_DESC = "Draw surface areas."; + public static final String DRAW_LINES = "drawLines"; + public static final String DRAW_LINES_DESC = "Draw outlines."; - public static final String PLACE_DELAY = "placeDelay"; - public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; - public static final String TIMEOUT = "timeout"; - public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; - public static final String PLACE_INSTANTLY = "placeInstantly"; - public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; - public static final String DESTROY_BLOCKS = "destroyBlocks"; - public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks (creative mode only)."; - public static final String DESTROY_INSTANTLY = "destroyInstantly"; - public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; - public static final String PLACE_ADJACENT = "placeAdjacent"; - public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; - public static final String SWAP_SLOTS = "swapSlots"; - public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; + public static final String PLACE_DELAY = "placeDelay"; + public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; + public static final String TIMEOUT = "timeout"; + public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; + public static final String PLACE_INSTANTLY = "placeInstantly"; + public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; + public static final String DESTROY_BLOCKS = "destroyBlocks"; + public static final String DESTROY_BLOCKS_DESC = "The printer will destroy blocks (creative mode only)."; + public static final String DESTROY_INSTANTLY = "destroyInstantly"; + public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; + public static final String PLACE_ADJACENT = "placeAdjacent"; + public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; + public static final String SWAP_SLOTS = "swapSlots"; + public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; - public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; - public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; + public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; + public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; - public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; - } + public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; + } - public static final class ModId { - public static final String MINECRAFT = "minecraft"; - } + public static final class ModId { + public static final String MINECRAFT = "minecraft"; + } - public static final class NBT { - public static final String ROOT = "Schematic"; + public static final class NBT { + public static final String ROOT = "Schematic"; - public static final String MATERIALS = "Materials"; - public static final String FORMAT_CLASSIC = "Classic"; - public static final String FORMAT_ALPHA = "Alpha"; + public static final String MATERIALS = "Materials"; + public static final String FORMAT_CLASSIC = "Classic"; + public static final String FORMAT_ALPHA = "Alpha"; - public static final String ICON = "Icon"; - public static final String BLOCKS = "Blocks"; - public static final String DATA = "Data"; - public static final String ADD_BLOCKS = "AddBlocks"; - public static final String ADD_BLOCKS_SCHEMATICA = "Add"; - public static final String WIDTH = "Width"; - public static final String LENGTH = "Length"; - public static final String HEIGHT = "Height"; - public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it - public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; - public static final String TILE_ENTITIES = "TileEntities"; - public static final String ENTITIES = "Entities"; - } + public static final String ICON = "Icon"; + public static final String BLOCKS = "Blocks"; + public static final String DATA = "Data"; + public static final String ADD_BLOCKS = "AddBlocks"; + public static final String ADD_BLOCKS_SCHEMATICA = "Add"; + public static final String WIDTH = "Width"; + public static final String LENGTH = "Length"; + public static final String HEIGHT = "Height"; + public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it + public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; + public static final String TILE_ENTITIES = "TileEntities"; + public static final String ENTITIES = "Entities"; + } - public static final class SBC { - public static final String DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; - public static final String DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; - public static final String DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; - } + public static final class SBC { + public static final String DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; + public static final String DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; + public static final String DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java index 559138c2..7f1c9200 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java @@ -4,14 +4,14 @@ import org.apache.logging.log4j.Logger; public class Reference { - public static final String MODID = "Schematica"; - public static final String NAME = "Schematica"; - public static final String VERSION = "${version}"; - public static final String FORGE = "${forgeversion}"; - public static final String MINECRAFT = "${mcversion}"; - public static final String PROXY_SERVER = "com.github.lunatrius.schematica.proxy.ServerProxy"; - public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; - public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; + public static final String MODID = "Schematica"; + public static final String NAME = "Schematica"; + public static final String VERSION = "${version}"; + public static final String FORGE = "${forgeversion}"; + public static final String MINECRAFT = "${mcversion}"; + public static final String PROXY_SERVER = "com.github.lunatrius.schematica.proxy.ServerProxy"; + public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; + public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; - public static Logger logger = LogManager.getLogger(Reference.MODID); + public static Logger logger = LogManager.getLogger(Reference.MODID); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index ac026bcb..e780508f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -38,351 +38,351 @@ import java.util.List; public class SchematicWorld extends World { - // private static final AnvilSaveHandler SAVE_HANDLER = new AnvilSaveHandler(Minecraft.getMinecraft().mcDataDir, "tmp/schematica", false); - private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); - private static final Comparator BLOCK_COMPARATOR = new Comparator() { - @Override - public int compare(ItemStack itemStackA, ItemStack itemStackB) { - return itemStackA.getUnlocalizedName().compareTo(itemStackB.getUnlocalizedName()); - } - }; - - public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); - - private ItemStack icon; - private short[][][] blocks; - private byte[][][] metadata; - private final List tileEntities = new ArrayList(); - private final List blockList = new ArrayList(); - private short width; - private short length; - private short height; - - public final Vector3i position = new Vector3i(); - public boolean isRendering; - public int renderingLayer; - - public SchematicWorld() { - // TODO: revert if any issues arise - super(new SaveHandlerMP(), "Schematica", null, WORLD_SETTINGS, null); - this.icon = SchematicWorld.DEFAULT_ICON.copy(); - this.blocks = null; - this.metadata = null; - this.tileEntities.clear(); - this.width = 0; - this.length = 0; - this.height = 0; - - this.isRendering = false; - this.renderingLayer = -1; - } - - public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { - this(); - - this.icon = icon != null ? icon : SchematicWorld.DEFAULT_ICON.copy(); - - this.blocks = blocks.clone(); - this.metadata = metadata.clone(); - - if (tileEntities != null) { - this.tileEntities.addAll(tileEntities); - for (TileEntity tileEntity : this.tileEntities) { - tileEntity.setWorldObj(this); - try { - tileEntity.validate(); - } catch (Exception e) { - Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); - } - } - } - - this.width = width; - this.length = length; - this.height = height; - - generateBlockList(); - } - - public SchematicWorld(String iconName, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { - this(SchematicUtil.getIconFromName(iconName), blocks, metadata, tileEntities, width, height, length); - } - - private void generateBlockList() { - this.blockList.clear(); - - int x, y, z, itemDamage; - Block block; - Item item; - ItemStack itemStack; - - for (y = 0; y < this.height; y++) { - for (z = 0; z < this.length; z++) { - for (x = 0; x < this.width; x++) { - block = this.getBlock(x, y, z); - item = Item.getItemFromBlock(block); - itemDamage = this.metadata[x][y][z]; - - if (block == null || block == Blocks.air) { - continue; - } - - if (BlockInfo.BLOCK_LIST_IGNORE_BLOCK.contains(block)) { - continue; - } - - if (BlockInfo.BLOCK_LIST_IGNORE_METADATA.contains(block)) { - itemDamage = 0; - } - - Item tmp = BlockInfo.BLOCK_ITEM_MAP.get(block); - if (tmp != null) { - item = tmp; - Block blockFromItem = Block.getBlockFromItem(item); - if (blockFromItem != Blocks.air) { - block = blockFromItem; - } else { - itemDamage = 0; - } - } - - if (block instanceof BlockLog || block instanceof BlockLeavesBase) { - itemDamage &= 0x03; - } - - if (block instanceof BlockSlab) { - itemDamage &= 0x07; - } - - if (block instanceof BlockDoublePlant) { - if ((itemDamage & 0x08) == 0x08) { - continue; - } - } - - if (block == Blocks.cocoa) { - itemDamage = 0x03; - } - - if (item == Items.skull) { - TileEntity tileEntity = getTileEntity(x, y, z); - if (tileEntity instanceof TileEntitySkull) { - itemDamage = ((TileEntitySkull) tileEntity).func_145904_a(); - } - } - - itemStack = null; - for (ItemStack stack : this.blockList) { - if (stack.getItem() == item && stack.getItemDamage() == itemDamage) { - itemStack = stack; - itemStack.stackSize++; - break; - } - } - - if (itemStack == null) { - itemStack = new ItemStack(item, 1, itemDamage); - if (itemStack.getItem() != null) { - this.blockList.add(itemStack); - } - } - } - } - } - Collections.sort(this.blockList, BLOCK_COMPARATOR); - } - - public int getBlockIdRaw(int x, int y, int z) { - if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { - return 0; - } - return this.blocks[x][y][z]; - } - - private int getBlockId(int x, int y, int z) { - if (this.renderingLayer != -1 && this.renderingLayer != y) { - return 0; - } - return getBlockIdRaw(x, y, z); - } - - public Block getBlockRaw(int x, int y, int z) { - return GameData.getBlockRegistry().getObjectById(getBlockIdRaw(x, y, z)); - } - - @Override - public Block getBlock(int x, int y, int z) { - return GameData.getBlockRegistry().getObjectById(getBlockId(x, y, z)); - } - - @Override - public TileEntity getTileEntity(int x, int y, int z) { - for (TileEntity tileEntity : this.tileEntities) { - if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { - return tileEntity; - } - } - return null; - } - - @SideOnly(Side.CLIENT) - @Override - public int getSkyBlockTypeBrightness(EnumSkyBlock skyBlock, int x, int y, int z) { - return 15; - } - - @Override - public float getLightBrightness(int x, int y, int z) { - return 1.0f; - } - - @Override - public int getBlockMetadata(int x, int y, int z) { - if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { - return 0; - } - return this.metadata[x][y][z]; - } - - @Override - public boolean isBlockNormalCubeDefault(int x, int y, int z, boolean _default) { - Block block = getBlock(x, y, z); - if (block == null) { - return false; - } - if (block.isNormalCube()) { - return true; - } - return _default; - } - - @Override - protected int func_152379_p() { - return 0; - } - - @Override - public boolean isAirBlock(int x, int y, int z) { - Block block = getBlock(x, y, z); - if (block == null) { - return true; - } - return block.isAir(this, x, y, z); - } - - @Override - public BiomeGenBase getBiomeGenForCoords(int x, int z) { - return BiomeGenBase.jungle; - } - - public int getWidth() { - return this.width; - } - - public int getLength() { - return this.length; - } - - @Override - public int getHeight() { - return this.height; - } - - @SideOnly(Side.CLIENT) - @Override - public boolean extendedLevelsInChunkCache() { - return false; - } - - @Override - protected IChunkProvider createChunkProvider() { - return new ChunkProviderClient(this); - } - - @Override - public Entity getEntityByID(int id) { - return null; - } - - @Override - public boolean blockExists(int x, int y, int z) { - return false; - } - - @Override - public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag) { - this.metadata[x][y][z] = (byte) (metadata & 0xFF); - return true; - } - - @Override - public boolean isSideSolid(int x, int y, int z, ForgeDirection side) { - return isSideSolid(x, y, z, side, false); - } - - @Override - public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { - Block block = getBlock(x, y, z); - if (block == null) { - return false; - } - return block.isSideSolid(this, x, y, z, side); - } - - public void setIcon(ItemStack icon) { - this.icon = icon; - } - - public ItemStack getIcon() { - return this.icon; - } - - public void setTileEntities(List tileEntities) { - this.tileEntities.clear(); - this.tileEntities.addAll(tileEntities); - for (TileEntity tileEntity : this.tileEntities) { - tileEntity.setWorldObj(this); - try { - tileEntity.validate(); - } catch (Exception e) { - Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); - } - } - } - - public List getTileEntities() { - return this.tileEntities; - } - - public List getBlockList() { - return this.blockList; - } - - public boolean toggleRendering() { - this.isRendering = !this.isRendering; - return this.isRendering; - } - - public void decrementRenderingLayer() { - this.renderingLayer = MathHelper.clamp_int(this.renderingLayer - 1, -1, getHeight() - 1); - } - - public void incrementRenderingLayer() { - this.renderingLayer = MathHelper.clamp_int(this.renderingLayer + 1, -1, getHeight() - 1); - } - - public void refreshChests() { - for (TileEntity tileEntity : this.tileEntities) { - if (tileEntity instanceof TileEntityChest) { - TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; - tileEntityChest.adjacentChestChecked = false; - tileEntityChest.checkForAdjacentChests(); - } - } - } - - public void flip() { - /* + // private static final AnvilSaveHandler SAVE_HANDLER = new AnvilSaveHandler(Minecraft.getMinecraft().mcDataDir, "tmp/schematica", false); + private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); + private static final Comparator BLOCK_COMPARATOR = new Comparator() { + @Override + public int compare(ItemStack itemStackA, ItemStack itemStackB) { + return itemStackA.getUnlocalizedName().compareTo(itemStackB.getUnlocalizedName()); + } + }; + + public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); + + private ItemStack icon; + private short[][][] blocks; + private byte[][][] metadata; + private final List tileEntities = new ArrayList(); + private final List blockList = new ArrayList(); + private short width; + private short length; + private short height; + + public final Vector3i position = new Vector3i(); + public boolean isRendering; + public int renderingLayer; + + public SchematicWorld() { + // TODO: revert if any issues arise + super(new SaveHandlerMP(), "Schematica", null, WORLD_SETTINGS, null); + this.icon = SchematicWorld.DEFAULT_ICON.copy(); + this.blocks = null; + this.metadata = null; + this.tileEntities.clear(); + this.width = 0; + this.length = 0; + this.height = 0; + + this.isRendering = false; + this.renderingLayer = -1; + } + + public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { + this(); + + this.icon = icon != null ? icon : SchematicWorld.DEFAULT_ICON.copy(); + + this.blocks = blocks.clone(); + this.metadata = metadata.clone(); + + if (tileEntities != null) { + this.tileEntities.addAll(tileEntities); + for (TileEntity tileEntity : this.tileEntities) { + tileEntity.setWorldObj(this); + try { + tileEntity.validate(); + } catch (Exception e) { + Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); + } + } + } + + this.width = width; + this.length = length; + this.height = height; + + generateBlockList(); + } + + public SchematicWorld(String iconName, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { + this(SchematicUtil.getIconFromName(iconName), blocks, metadata, tileEntities, width, height, length); + } + + private void generateBlockList() { + this.blockList.clear(); + + int x, y, z, itemDamage; + Block block; + Item item; + ItemStack itemStack; + + for (y = 0; y < this.height; y++) { + for (z = 0; z < this.length; z++) { + for (x = 0; x < this.width; x++) { + block = this.getBlock(x, y, z); + item = Item.getItemFromBlock(block); + itemDamage = this.metadata[x][y][z]; + + if (block == null || block == Blocks.air) { + continue; + } + + if (BlockInfo.BLOCK_LIST_IGNORE_BLOCK.contains(block)) { + continue; + } + + if (BlockInfo.BLOCK_LIST_IGNORE_METADATA.contains(block)) { + itemDamage = 0; + } + + Item tmp = BlockInfo.BLOCK_ITEM_MAP.get(block); + if (tmp != null) { + item = tmp; + Block blockFromItem = Block.getBlockFromItem(item); + if (blockFromItem != Blocks.air) { + block = blockFromItem; + } else { + itemDamage = 0; + } + } + + if (block instanceof BlockLog || block instanceof BlockLeavesBase) { + itemDamage &= 0x03; + } + + if (block instanceof BlockSlab) { + itemDamage &= 0x07; + } + + if (block instanceof BlockDoublePlant) { + if ((itemDamage & 0x08) == 0x08) { + continue; + } + } + + if (block == Blocks.cocoa) { + itemDamage = 0x03; + } + + if (item == Items.skull) { + TileEntity tileEntity = getTileEntity(x, y, z); + if (tileEntity instanceof TileEntitySkull) { + itemDamage = ((TileEntitySkull) tileEntity).func_145904_a(); + } + } + + itemStack = null; + for (ItemStack stack : this.blockList) { + if (stack.getItem() == item && stack.getItemDamage() == itemDamage) { + itemStack = stack; + itemStack.stackSize++; + break; + } + } + + if (itemStack == null) { + itemStack = new ItemStack(item, 1, itemDamage); + if (itemStack.getItem() != null) { + this.blockList.add(itemStack); + } + } + } + } + } + Collections.sort(this.blockList, BLOCK_COMPARATOR); + } + + public int getBlockIdRaw(int x, int y, int z) { + if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { + return 0; + } + return this.blocks[x][y][z]; + } + + private int getBlockId(int x, int y, int z) { + if (this.renderingLayer != -1 && this.renderingLayer != y) { + return 0; + } + return getBlockIdRaw(x, y, z); + } + + public Block getBlockRaw(int x, int y, int z) { + return GameData.getBlockRegistry().getObjectById(getBlockIdRaw(x, y, z)); + } + + @Override + public Block getBlock(int x, int y, int z) { + return GameData.getBlockRegistry().getObjectById(getBlockId(x, y, z)); + } + + @Override + public TileEntity getTileEntity(int x, int y, int z) { + for (TileEntity tileEntity : this.tileEntities) { + if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { + return tileEntity; + } + } + return null; + } + + @SideOnly(Side.CLIENT) + @Override + public int getSkyBlockTypeBrightness(EnumSkyBlock skyBlock, int x, int y, int z) { + return 15; + } + + @Override + public float getLightBrightness(int x, int y, int z) { + return 1.0f; + } + + @Override + public int getBlockMetadata(int x, int y, int z) { + if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { + return 0; + } + return this.metadata[x][y][z]; + } + + @Override + public boolean isBlockNormalCubeDefault(int x, int y, int z, boolean _default) { + Block block = getBlock(x, y, z); + if (block == null) { + return false; + } + if (block.isNormalCube()) { + return true; + } + return _default; + } + + @Override + protected int func_152379_p() { + return 0; + } + + @Override + public boolean isAirBlock(int x, int y, int z) { + Block block = getBlock(x, y, z); + if (block == null) { + return true; + } + return block.isAir(this, x, y, z); + } + + @Override + public BiomeGenBase getBiomeGenForCoords(int x, int z) { + return BiomeGenBase.jungle; + } + + public int getWidth() { + return this.width; + } + + public int getLength() { + return this.length; + } + + @Override + public int getHeight() { + return this.height; + } + + @SideOnly(Side.CLIENT) + @Override + public boolean extendedLevelsInChunkCache() { + return false; + } + + @Override + protected IChunkProvider createChunkProvider() { + return new ChunkProviderClient(this); + } + + @Override + public Entity getEntityByID(int id) { + return null; + } + + @Override + public boolean blockExists(int x, int y, int z) { + return false; + } + + @Override + public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag) { + this.metadata[x][y][z] = (byte) (metadata & 0xFF); + return true; + } + + @Override + public boolean isSideSolid(int x, int y, int z, ForgeDirection side) { + return isSideSolid(x, y, z, side, false); + } + + @Override + public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { + Block block = getBlock(x, y, z); + if (block == null) { + return false; + } + return block.isSideSolid(this, x, y, z, side); + } + + public void setIcon(ItemStack icon) { + this.icon = icon; + } + + public ItemStack getIcon() { + return this.icon; + } + + public void setTileEntities(List tileEntities) { + this.tileEntities.clear(); + this.tileEntities.addAll(tileEntities); + for (TileEntity tileEntity : this.tileEntities) { + tileEntity.setWorldObj(this); + try { + tileEntity.validate(); + } catch (Exception e) { + Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); + } + } + } + + public List getTileEntities() { + return this.tileEntities; + } + + public List getBlockList() { + return this.blockList; + } + + public boolean toggleRendering() { + this.isRendering = !this.isRendering; + return this.isRendering; + } + + public void decrementRenderingLayer() { + this.renderingLayer = MathHelper.clamp_int(this.renderingLayer - 1, -1, getHeight() - 1); + } + + public void incrementRenderingLayer() { + this.renderingLayer = MathHelper.clamp_int(this.renderingLayer + 1, -1, getHeight() - 1); + } + + public void refreshChests() { + for (TileEntity tileEntity : this.tileEntities) { + if (tileEntity instanceof TileEntityChest) { + TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; + tileEntityChest.adjacentChestChecked = false; + tileEntityChest.checkForAdjacentChests(); + } + } + } + + public void flip() { + /* int tmp; for (int x = 0; x < this.width; x++) { for (int y = 0; y < this.height; y++) { @@ -424,50 +424,50 @@ public void flip() { refreshChests(); */ - } - - public void rotate() { - short[][][] localBlocks = new short[this.length][this.height][this.width]; - byte[][][] localMetadata = new byte[this.length][this.height][this.width]; - - for (int y = 0; y < this.height; y++) { - for (int z = 0; z < this.length; z++) { - for (int x = 0; x < this.width; x++) { - try { - getBlock(x, y, this.length - 1 - z).rotateBlock(this, x, y, this.length - 1 - z, ForgeDirection.UP); - } catch (Exception e) { - Reference.logger.debug("Failed to rotate block!", e); - } - localBlocks[z][y][x] = this.blocks[x][y][this.length - 1 - z]; - localMetadata[z][y][x] = this.metadata[x][y][this.length - 1 - z]; - } - } - } - - this.blocks = localBlocks; - this.metadata = localMetadata; - - int coord; - for (TileEntity tileEntity : this.tileEntities) { - coord = tileEntity.zCoord; - tileEntity.zCoord = tileEntity.xCoord; - tileEntity.xCoord = this.length - 1 - coord; - tileEntity.blockMetadata = this.metadata[tileEntity.xCoord][tileEntity.yCoord][tileEntity.zCoord]; - - if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { - TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; - skullTileEntity.func_145903_a((skullTileEntity.func_145906_b() + 12) & 15); - } - } - - short tmp = this.width; - this.width = this.length; - this.length = tmp; - - refreshChests(); - } - - public Vector3f dimensions() { - return new Vector3f(this.width, this.height, this.length); - } + } + + public void rotate() { + short[][][] localBlocks = new short[this.length][this.height][this.width]; + byte[][][] localMetadata = new byte[this.length][this.height][this.width]; + + for (int y = 0; y < this.height; y++) { + for (int z = 0; z < this.length; z++) { + for (int x = 0; x < this.width; x++) { + try { + getBlock(x, y, this.length - 1 - z).rotateBlock(this, x, y, this.length - 1 - z, ForgeDirection.UP); + } catch (Exception e) { + Reference.logger.debug("Failed to rotate block!", e); + } + localBlocks[z][y][x] = this.blocks[x][y][this.length - 1 - z]; + localMetadata[z][y][x] = this.metadata[x][y][this.length - 1 - z]; + } + } + } + + this.blocks = localBlocks; + this.metadata = localMetadata; + + int coord; + for (TileEntity tileEntity : this.tileEntities) { + coord = tileEntity.zCoord; + tileEntity.zCoord = tileEntity.xCoord; + tileEntity.xCoord = this.length - 1 - coord; + tileEntity.blockMetadata = this.metadata[tileEntity.xCoord][tileEntity.yCoord][tileEntity.zCoord]; + + if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { + TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; + skullTileEntity.func_145903_a((skullTileEntity.func_145906_b() + 12) & 15); + } + } + + short tmp = this.width; + this.width = this.length; + this.length = tmp; + + refreshChests(); + } + + public Vector3f dimensions() { + return new Vector3f(this.width, this.height, this.length); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 29a78687..726ea767 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -19,151 +19,151 @@ import java.util.Set; public class SchematicAlpha extends SchematicFormat { - @Override - public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { - ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); - - byte localBlocks[] = tagCompound.getByteArray(Names.NBT.BLOCKS); - byte localMetadata[] = tagCompound.getByteArray(Names.NBT.DATA); - - boolean extra = false; - byte extraBlocks[] = null; - byte extraBlocksNibble[] = null; - if (tagCompound.hasKey(Names.NBT.ADD_BLOCKS)) { - extra = true; - extraBlocksNibble = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS); - extraBlocks = new byte[extraBlocksNibble.length * 2]; - for (int i = 0; i < extraBlocksNibble.length; i++) { - extraBlocks[i * 2 + 0] = (byte) ((extraBlocksNibble[i] >> 4) & 0xF); - extraBlocks[i * 2 + 1] = (byte) (extraBlocksNibble[i] & 0xF); - } - } else if (tagCompound.hasKey(Names.NBT.ADD_BLOCKS_SCHEMATICA)) { - extra = true; - extraBlocks = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS_SCHEMATICA); - } - - short width = tagCompound.getShort(Names.NBT.WIDTH); - short length = tagCompound.getShort(Names.NBT.LENGTH); - short height = tagCompound.getShort(Names.NBT.HEIGHT); - - short[][][] blocks = new short[width][height][length]; - byte[][][] metadata = new byte[width][height][length]; - - Short id = null; - Map oldToNew = new HashMap(); - if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { - NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); - Set names = mapping.func_150296_c(); - for (String name : names) { - oldToNew.put(mapping.getShort(name), (short) GameData.getBlockRegistry().getId(name)); - } - } - - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - for (int z = 0; z < length; z++) { - int index = x + (y * length + z) * width; - blocks[x][y][z] = (short) ((localBlocks[index] & 0xFF) | (extra ? ((extraBlocks[index] & 0xFF) << 8) : 0)); - metadata[x][y][z] = (byte) (localMetadata[index] & 0xFF); - if ((id = oldToNew.get(blocks[x][y][z])) != null) { - blocks[x][y][z] = id; - } - } - } - } - - List tileEntities = new ArrayList(); - NBTTagList tileEntitiesList = tagCompound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < tileEntitiesList.tagCount(); i++) { - try { - TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); - if (tileEntity != null) { - tileEntities.add(tileEntity); - } - } catch (Exception e) { - Reference.logger.error("TileEntity failed to load properly!", e); - } - } - - return new SchematicWorld(icon, blocks, metadata, tileEntities, width, height, length); - } - - @Override - public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { - NBTTagCompound tagCompoundIcon = new NBTTagCompound(); - ItemStack icon = world.getIcon(); - icon.writeToNBT(tagCompoundIcon); - tagCompound.setTag(Names.NBT.ICON, tagCompoundIcon); - - tagCompound.setShort(Names.NBT.WIDTH, (short) world.getWidth()); - tagCompound.setShort(Names.NBT.LENGTH, (short) world.getLength()); - tagCompound.setShort(Names.NBT.HEIGHT, (short) world.getHeight()); - - int size = world.getWidth() * world.getLength() * world.getHeight(); - byte localBlocks[] = new byte[size]; - byte localMetadata[] = new byte[size]; - byte extraBlocks[] = new byte[size]; - byte extraBlocksNibble[] = new byte[(int) Math.ceil(size / 2.0)]; - boolean extra = false; - NBTTagCompound mapping = new NBTTagCompound(); - - for (int x = 0; x < world.getWidth(); x++) { - for (int y = 0; y < world.getHeight(); y++) { - for (int z = 0; z < world.getLength(); z++) { - int index = x + (y * world.getLength() + z) * world.getWidth(); - int blockId = world.getBlockIdRaw(x, y, z); - localBlocks[index] = (byte) blockId; - localMetadata[index] = (byte) world.getBlockMetadata(x, y, z); - if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { - extra = true; - } - - String name = GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)); - if (!mapping.hasKey(name)) { - mapping.setShort(name, (short) blockId); - } - } - } - } - - for (int i = 0; i < extraBlocksNibble.length; i++) { - if (i * 2 + 1 < extraBlocks.length) { - extraBlocksNibble[i] = (byte) ((extraBlocks[i * 2 + 0] << 4) | extraBlocks[i * 2 + 1]); - } else { - extraBlocksNibble[i] = (byte) (extraBlocks[i * 2 + 0] << 4); - } - } - - int count = 20; - NBTTagList tileEntitiesList = new NBTTagList(); - for (TileEntity tileEntity : world.getTileEntities()) { - NBTTagCompound tileEntityTagCompound = new NBTTagCompound(); - try { - tileEntity.writeToNBT(tileEntityTagCompound); - tileEntitiesList.appendTag(tileEntityTagCompound); - } catch (Exception e) { - int pos = tileEntity.xCoord + (tileEntity.yCoord * world.getLength() + tileEntity.zCoord) * world.getWidth(); - if (--count > 0) { - Block block = world.getBlockRaw(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); - Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? GameData.getBlockRegistry().getNameForObject(block) : "?", tileEntity.getClass().getName()), e); - } - localBlocks[pos] = (byte) GameData.getBlockRegistry().getId(Blocks.bedrock); - localMetadata[pos] = 0; - extraBlocks[pos] = 0; - } - } - - tagCompound.setString(Names.NBT.MATERIALS, Names.NBT.FORMAT_ALPHA); - tagCompound.setByteArray(Names.NBT.BLOCKS, localBlocks); - tagCompound.setByteArray(Names.NBT.DATA, localMetadata); - if (extra) { - tagCompound.setByteArray(Names.NBT.ADD_BLOCKS, extraBlocksNibble); - } - tagCompound.setTag(Names.NBT.ENTITIES, new NBTTagList()); - tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); - tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, mapping); - - return true; - } + @Override + public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { + ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); + + byte localBlocks[] = tagCompound.getByteArray(Names.NBT.BLOCKS); + byte localMetadata[] = tagCompound.getByteArray(Names.NBT.DATA); + + boolean extra = false; + byte extraBlocks[] = null; + byte extraBlocksNibble[] = null; + if (tagCompound.hasKey(Names.NBT.ADD_BLOCKS)) { + extra = true; + extraBlocksNibble = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS); + extraBlocks = new byte[extraBlocksNibble.length * 2]; + for (int i = 0; i < extraBlocksNibble.length; i++) { + extraBlocks[i * 2 + 0] = (byte) ((extraBlocksNibble[i] >> 4) & 0xF); + extraBlocks[i * 2 + 1] = (byte) (extraBlocksNibble[i] & 0xF); + } + } else if (tagCompound.hasKey(Names.NBT.ADD_BLOCKS_SCHEMATICA)) { + extra = true; + extraBlocks = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS_SCHEMATICA); + } + + short width = tagCompound.getShort(Names.NBT.WIDTH); + short length = tagCompound.getShort(Names.NBT.LENGTH); + short height = tagCompound.getShort(Names.NBT.HEIGHT); + + short[][][] blocks = new short[width][height][length]; + byte[][][] metadata = new byte[width][height][length]; + + Short id = null; + Map oldToNew = new HashMap(); + if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { + NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); + Set names = mapping.func_150296_c(); + for (String name : names) { + oldToNew.put(mapping.getShort(name), (short) GameData.getBlockRegistry().getId(name)); + } + } + + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + for (int z = 0; z < length; z++) { + int index = x + (y * length + z) * width; + blocks[x][y][z] = (short) ((localBlocks[index] & 0xFF) | (extra ? ((extraBlocks[index] & 0xFF) << 8) : 0)); + metadata[x][y][z] = (byte) (localMetadata[index] & 0xFF); + if ((id = oldToNew.get(blocks[x][y][z])) != null) { + blocks[x][y][z] = id; + } + } + } + } + + List tileEntities = new ArrayList(); + NBTTagList tileEntitiesList = tagCompound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); + + for (int i = 0; i < tileEntitiesList.tagCount(); i++) { + try { + TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); + if (tileEntity != null) { + tileEntities.add(tileEntity); + } + } catch (Exception e) { + Reference.logger.error("TileEntity failed to load properly!", e); + } + } + + return new SchematicWorld(icon, blocks, metadata, tileEntities, width, height, length); + } + + @Override + public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { + NBTTagCompound tagCompoundIcon = new NBTTagCompound(); + ItemStack icon = world.getIcon(); + icon.writeToNBT(tagCompoundIcon); + tagCompound.setTag(Names.NBT.ICON, tagCompoundIcon); + + tagCompound.setShort(Names.NBT.WIDTH, (short) world.getWidth()); + tagCompound.setShort(Names.NBT.LENGTH, (short) world.getLength()); + tagCompound.setShort(Names.NBT.HEIGHT, (short) world.getHeight()); + + int size = world.getWidth() * world.getLength() * world.getHeight(); + byte localBlocks[] = new byte[size]; + byte localMetadata[] = new byte[size]; + byte extraBlocks[] = new byte[size]; + byte extraBlocksNibble[] = new byte[(int) Math.ceil(size / 2.0)]; + boolean extra = false; + NBTTagCompound mapping = new NBTTagCompound(); + + for (int x = 0; x < world.getWidth(); x++) { + for (int y = 0; y < world.getHeight(); y++) { + for (int z = 0; z < world.getLength(); z++) { + int index = x + (y * world.getLength() + z) * world.getWidth(); + int blockId = world.getBlockIdRaw(x, y, z); + localBlocks[index] = (byte) blockId; + localMetadata[index] = (byte) world.getBlockMetadata(x, y, z); + if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { + extra = true; + } + + String name = GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)); + if (!mapping.hasKey(name)) { + mapping.setShort(name, (short) blockId); + } + } + } + } + + for (int i = 0; i < extraBlocksNibble.length; i++) { + if (i * 2 + 1 < extraBlocks.length) { + extraBlocksNibble[i] = (byte) ((extraBlocks[i * 2 + 0] << 4) | extraBlocks[i * 2 + 1]); + } else { + extraBlocksNibble[i] = (byte) (extraBlocks[i * 2 + 0] << 4); + } + } + + int count = 20; + NBTTagList tileEntitiesList = new NBTTagList(); + for (TileEntity tileEntity : world.getTileEntities()) { + NBTTagCompound tileEntityTagCompound = new NBTTagCompound(); + try { + tileEntity.writeToNBT(tileEntityTagCompound); + tileEntitiesList.appendTag(tileEntityTagCompound); + } catch (Exception e) { + int pos = tileEntity.xCoord + (tileEntity.yCoord * world.getLength() + tileEntity.zCoord) * world.getWidth(); + if (--count > 0) { + Block block = world.getBlockRaw(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? GameData.getBlockRegistry().getNameForObject(block) : "?", tileEntity.getClass().getName()), e); + } + localBlocks[pos] = (byte) GameData.getBlockRegistry().getId(Blocks.bedrock); + localMetadata[pos] = 0; + extraBlocks[pos] = 0; + } + } + + tagCompound.setString(Names.NBT.MATERIALS, Names.NBT.FORMAT_ALPHA); + tagCompound.setByteArray(Names.NBT.BLOCKS, localBlocks); + tagCompound.setByteArray(Names.NBT.DATA, localMetadata); + if (extra) { + tagCompound.setByteArray(Names.NBT.ADD_BLOCKS, extraBlocksNibble); + } + tagCompound.setTag(Names.NBT.ENTITIES, new NBTTagList()); + tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); + tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, mapping); + + return true; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java index 1985e685..1caef094 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java @@ -6,13 +6,13 @@ // TODO: http://minecraft.gamepedia.com/Data_values_%28Classic%29 public class SchematicClassic extends SchematicFormat { - @Override - public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { - throw new NotImplementedException(); - } + @Override + public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { + throw new NotImplementedException(); + } - @Override - public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { - throw new NotImplementedException(); - } + @Override + public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { + throw new NotImplementedException(); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 06d9a3aa..b8af6eaf 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -13,65 +13,65 @@ import java.util.zip.GZIPOutputStream; public abstract class SchematicFormat { - public static final Map FORMATS = new HashMap(); - public static String FORMAT_DEFAULT; + public static final Map FORMATS = new HashMap(); + public static String FORMAT_DEFAULT; - public abstract SchematicWorld readFromNBT(NBTTagCompound tagCompound); + public abstract SchematicWorld readFromNBT(NBTTagCompound tagCompound); - public abstract boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world); + public abstract boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world); - public static SchematicWorld readFromFile(File file) { - try { - final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); - final String format = tagCompound.getString(Names.NBT.MATERIALS); - final SchematicFormat schematicFormat = FORMATS.get(format); + public static SchematicWorld readFromFile(File file) { + try { + final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); + final String format = tagCompound.getString(Names.NBT.MATERIALS); + final SchematicFormat schematicFormat = FORMATS.get(format); - if (schematicFormat == null) { - throw new UnsupportedFormatException(format); - } + if (schematicFormat == null) { + throw new UnsupportedFormatException(format); + } - return schematicFormat.readFromNBT(tagCompound); - } catch (Exception ex) { - Reference.logger.error("Failed to read schematic!", ex); - } + return schematicFormat.readFromNBT(tagCompound); + } catch (Exception ex) { + Reference.logger.error("Failed to read schematic!", ex); + } - return null; - } + return null; + } - public static SchematicWorld readFromFile(File directory, String filename) { - return readFromFile(new File(directory, filename)); - } + public static SchematicWorld readFromFile(File directory, String filename) { + return readFromFile(new File(directory, filename)); + } - public static boolean writeToFile(File file, SchematicWorld world) { - try { - NBTTagCompound tagCompound = new NBTTagCompound(); + public static boolean writeToFile(File file, SchematicWorld world) { + try { + NBTTagCompound tagCompound = new NBTTagCompound(); - FORMATS.get(FORMAT_DEFAULT).writeToNBT(tagCompound, world); + FORMATS.get(FORMAT_DEFAULT).writeToNBT(tagCompound, world); - DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); + DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); - try { - NBTTagCompound.func_150298_a(Names.NBT.ROOT, tagCompound, dataOutputStream); - } finally { - dataOutputStream.close(); - } + try { + NBTTagCompound.func_150298_a(Names.NBT.ROOT, tagCompound, dataOutputStream); + } finally { + dataOutputStream.close(); + } - return true; - } catch (Exception ex) { - Reference.logger.error("Failed to write schematic!", ex); - } + return true; + } catch (Exception ex) { + Reference.logger.error("Failed to write schematic!", ex); + } - return false; - } + return false; + } - public static boolean writeToFile(File directory, String filename, SchematicWorld world) { - return writeToFile(new File(directory, filename), world); - } + public static boolean writeToFile(File directory, String filename, SchematicWorld world) { + return writeToFile(new File(directory, filename), world); + } - static { - FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); - FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); + static { + FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); + FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); - FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; - } + FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index a695a6cb..541569b0 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -13,65 +13,65 @@ import java.io.IOException; public final class SchematicUtil { - public static NBTTagCompound readTagCompoundFromFile(File file) throws IOException { - try { - return CompressedStreamTools.readCompressed(new FileInputStream(file)); - } catch (Exception ex) { - Reference.logger.warn("Failed compressed read, trying normal read...", ex); - return CompressedStreamTools.read(file); - } - } + public static NBTTagCompound readTagCompoundFromFile(File file) throws IOException { + try { + return CompressedStreamTools.readCompressed(new FileInputStream(file)); + } catch (Exception ex) { + Reference.logger.warn("Failed compressed read, trying normal read...", ex); + return CompressedStreamTools.read(file); + } + } - public static ItemStack getIconFromName(String iconName) { - ItemStack icon; - String name = ""; - int damage = 0; + public static ItemStack getIconFromName(String iconName) { + ItemStack icon; + String name = ""; + int damage = 0; - String[] parts = iconName.split(","); - if (parts.length >= 1) { - name = parts[0]; - if (parts.length >= 2) { - try { - damage = Integer.parseInt(parts[1]); - } catch (NumberFormatException ignored) { - } - } - } + String[] parts = iconName.split(","); + if (parts.length >= 1) { + name = parts[0]; + if (parts.length >= 2) { + try { + damage = Integer.parseInt(parts[1]); + } catch (NumberFormatException ignored) { + } + } + } - icon = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, damage); - if (icon.getItem() != null) { - return icon; - } + icon = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, damage); + if (icon.getItem() != null) { + return icon; + } - icon = new ItemStack(GameData.getItemRegistry().getObject(name), 1, damage); - if (icon.getItem() != null) { - return icon; - } + icon = new ItemStack(GameData.getItemRegistry().getObject(name), 1, damage); + if (icon.getItem() != null) { + return icon; + } - return SchematicWorld.DEFAULT_ICON.copy(); - } + return SchematicWorld.DEFAULT_ICON.copy(); + } - public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { - ItemStack icon = SchematicWorld.DEFAULT_ICON.copy(); + public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { + ItemStack icon = SchematicWorld.DEFAULT_ICON.copy(); - if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { - icon.readFromNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); + if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { + icon.readFromNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); - if (icon.getItem() == null) { - icon = SchematicWorld.DEFAULT_ICON.copy(); - } - } + if (icon.getItem() == null) { + icon = SchematicWorld.DEFAULT_ICON.copy(); + } + } - return icon; - } + return icon; + } - public static ItemStack getIconFromFile(File file) { - try { - return getIconFromNBT(readTagCompoundFromFile(file)); - } catch (Exception e) { - Reference.logger.error("Failed to read schematic icon!", e); - } + public static ItemStack getIconFromFile(File file) { + try { + return getIconFromNBT(readTagCompoundFromFile(file)); + } catch (Exception e) { + Reference.logger.error("Failed to read schematic icon!", e); + } - return SchematicWorld.DEFAULT_ICON.copy(); - } + return SchematicWorld.DEFAULT_ICON.copy(); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java index d7c5c299..5a1ac31c 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.world.schematic; public class UnsupportedFormatException extends Exception { - public UnsupportedFormatException(String format) { - super(String.format("Unsupported format: %s", format)); - } + public UnsupportedFormatException(String format) { + super(String.format("Unsupported format: %s", format)); + } } From 5c71d74fc9bb9a2eb1e14725b9a9e11d47691b36 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Sep 2014 21:58:21 +0200 Subject: [PATCH 092/314] Added formatting changes to README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83524bcf..91f391bc 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ So you found a bug in the code? Think you can make it more efficient? Want to he ##### Instructions/Advice when submitting a Pull Request (PR) I use [this](https://gist.github.com/460be5119b93d73c24ab) IDEA formatting. To be short: -* tabs for indentation +* spaces for indentation * braces on same lines When you finish up your PR you'll want to [squash](http://davidwalsh.name/squash-commits-git) them into a single commit (unless it makes sense to have them split). From bfadc989b70fddbc6b85e7aaff43a121bcf53748 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 5 Oct 2014 02:47:36 +0200 Subject: [PATCH 093/314] Fixed issues with mods that access blockType via the field instead of the method. --- .../lunatrius/schematica/world/SchematicWorld.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index e780508f..d075c0fc 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -85,10 +85,15 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L this.blocks = blocks.clone(); this.metadata = metadata.clone(); + this.width = width; + this.length = length; + this.height = height; + if (tileEntities != null) { this.tileEntities.addAll(tileEntities); for (TileEntity tileEntity : this.tileEntities) { tileEntity.setWorldObj(this); + tileEntity.getBlockType(); try { tileEntity.validate(); } catch (Exception e) { @@ -97,10 +102,6 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L } } - this.width = width; - this.length = length; - this.height = height; - generateBlockList(); } From 414220ef2b1ba0adda130ecc4549e6193c6427c5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 24 Oct 2014 02:06:16 +0200 Subject: [PATCH 094/314] Added simple tootips for schematics. --- .../handler/ConfigurationHandler.java | 21 +++ .../handler/client/KeyInputHandler.java | 31 +--- .../handler/client/RenderTickHandler.java | 48 ++++++ .../handler/client/TickHandler.java | 3 - .../schematica/proxy/ClientProxy.java | 17 +- .../lunatrius/schematica/reference/Names.java | 8 + .../schematica/tooltip/TooltipHandler.java | 150 ++++++++++++++++++ 7 files changed, 242 insertions(+), 36 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java create mode 100644 src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 1a09136f..760d0b2d 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -33,6 +33,9 @@ public class ConfigurationHandler { public static final boolean DESTROYINSTANTLY_DEFAULT = false; public static final boolean PLACEADJACENT_DEFAULT = true; public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; + public static final boolean TOOLTIPENABLED_DEFAULT = true; + public static final double TOOLTIPX_DEFAULT = 100; + public static final double TOOLTIPY_DEFAULT = 0; public static final String SCHEMATICDIRECTORY_STR = "schematics"; public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); @@ -51,6 +54,9 @@ public class ConfigurationHandler { public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; public static int[] swapSlots = SWAPSLOTS_DEFAULT; public static Queue swapSlotsQueue = new ArrayDeque(); + public static boolean tooltipEnabled = TOOLTIPENABLED_DEFAULT; + public static float tooltipX = (float) TOOLTIPX_DEFAULT; + public static float tooltipY = (float) TOOLTIPY_DEFAULT; public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; public static Property propEnableAlpha = null; @@ -67,6 +73,9 @@ public class ConfigurationHandler { public static Property propDestroyInstantly = null; public static Property propPlaceAdjacent = null; public static Property propSwapSlots = null; + public static Property propTooltipEnabled = null; + public static Property propTooltipX = null; + public static Property propTooltipY = null; public static Property propSchematicDirectory = null; public static void init(File configFile) { @@ -134,6 +143,18 @@ private static void loadConfiguration() { swapSlots = propSwapSlots.getIntList(); swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); + propTooltipEnabled = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_ENABLED, TOOLTIPENABLED_DEFAULT, Names.Config.TOOLTIP_ENABLED_DESC); + propTooltipEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_ENABLED); + tooltipEnabled = propTooltipEnabled.getBoolean(TOOLTIPENABLED_DEFAULT); + + propTooltipX = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_X, TOOLTIPX_DEFAULT, Names.Config.TOOLTIP_X_DESC, 0, 100); + propTooltipX.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_X); + tooltipX = (float) propTooltipX.getDouble(TOOLTIPX_DEFAULT); + + propTooltipY = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_Y, TOOLTIPY_DEFAULT, Names.Config.TOOLTIP_Y_DESC, 0, 100); + propTooltipY.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_Y); + tooltipY = (float) propTooltipY.getDouble(TOOLTIPY_DEFAULT); + propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATICDIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); schematicDirectory = new File(propSchematicDirectory.getString()); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 9bcb9ac0..230f90bb 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -4,6 +4,7 @@ import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; +import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -12,11 +13,9 @@ import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import net.minecraftforge.common.ForgeHooks; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -70,7 +69,7 @@ public void onMouseInput(MouseInputEvent event) { boolean revert = true; if (schematic != null) { - revert = pickBlock(schematic, 1.0f); + revert = pickBlock(schematic, ClientProxy.movingObjectPosition); } if (revert) { @@ -83,8 +82,7 @@ public void onMouseInput(MouseInputEvent event) { } } - private boolean pickBlock(final SchematicWorld schematic, final float partialTicks) { - final MovingObjectPosition objectMouseOver = rayTrace(schematic, partialTicks); + private boolean pickBlock(final SchematicWorld schematic, final MovingObjectPosition objectMouseOver) { boolean revert = false; // Minecraft.func_147112_ai @@ -113,27 +111,4 @@ private boolean pickBlock(final SchematicWorld schematic, final float partialTic return revert; } - - private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { - final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; - final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance(); - - final double posX = renderViewEntity.posX; - final double posY = renderViewEntity.posY; - final double posZ = renderViewEntity.posZ; - - renderViewEntity.posX -= schematic.position.x; - renderViewEntity.posY -= schematic.position.y; - renderViewEntity.posZ -= schematic.position.z; - - final Vec3 vecPosition = renderViewEntity.getPosition(partialTicks); - final Vec3 vecLook = renderViewEntity.getLook(partialTicks); - final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); - - renderViewEntity.posX = posX; - renderViewEntity.posY = posY; - renderViewEntity.posZ = posZ; - - return schematic.func_147447_a(vecPosition, vecExtendedLook, false, false, true); - } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java new file mode 100644 index 00000000..12eccc62 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -0,0 +1,48 @@ +package com.github.lunatrius.schematica.handler.client; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.tooltip.TooltipHandler; +import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; + +public class RenderTickHandler { + private final Minecraft minecraft = Minecraft.getMinecraft(); + + @SubscribeEvent + public void onRenderTick(TickEvent.RenderTickEvent event) { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + + ClientProxy.movingObjectPosition = schematic != null ? rayTrace(schematic, 1.0f) : null; + + TooltipHandler.INSTANCE.renderTooltip(schematic, ClientProxy.movingObjectPosition); + } + + private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { + final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; + final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance(); + + final double posX = renderViewEntity.posX; + final double posY = renderViewEntity.posY; + final double posZ = renderViewEntity.posZ; + + renderViewEntity.posX -= schematic.position.x; + renderViewEntity.posY -= schematic.position.y; + renderViewEntity.posZ -= schematic.position.z; + + final Vec3 vecPosition = renderViewEntity.getPosition(partialTicks); + final Vec3 vecLook = renderViewEntity.getLook(partialTicks); + final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); + + renderViewEntity.posX = posX; + renderViewEntity.posY = posY; + renderViewEntity.posZ = posZ; + + return schematic.func_147447_a(vecPosition, vecExtendedLook, false, false, true); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 7dea0a7e..df957d19 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -19,9 +19,6 @@ public class TickHandler { private int ticks = -1; - public TickHandler() { - } - @SubscribeEvent public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { Reference.logger.info("Scheduling client settings reset."); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 56f21e42..18ec2328 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -8,6 +8,7 @@ import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.KeyInputHandler; +import com.github.lunatrius.schematica.handler.client.RenderTickHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -20,6 +21,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; @@ -46,6 +48,8 @@ public class ClientProxy extends CommonProxy { public static final Vector3i pointMin = new Vector3i(); public static final Vector3i pointMax = new Vector3i(); + public static MovingObjectPosition movingObjectPosition = null; + private SchematicWorld schematicWorld = null; public static void setPlayerData(EntityPlayer player, float partialTicks) { @@ -115,12 +119,12 @@ public static void movePointToPlayer(Vector3i point) { } public static void moveSchematicToPlayer(SchematicWorld schematic) { - Vector3i position = schematic.position; - position.x = (int) Math.floor(playerPosition.x); - position.y = (int) Math.floor(playerPosition.y) - 1; - position.z = (int) Math.floor(playerPosition.z); - if (schematic != null) { + Vector3i position = schematic.position; + position.x = (int) Math.floor(playerPosition.x); + position.y = (int) Math.floor(playerPosition.y) - 1; + position.z = (int) Math.floor(playerPosition.z); + switch (rotationRender) { case 0: position.x -= schematic.getWidth(); @@ -148,6 +152,8 @@ public void setConfigEntryClasses() { ConfigurationHandler.propBlockDelta.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); ConfigurationHandler.propPlaceDelay.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); ConfigurationHandler.propTimeout.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propTooltipX.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + ConfigurationHandler.propTooltipY.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); } @Override @@ -161,6 +167,7 @@ public void registerKeybindings() { public void registerEvents() { FMLCommonHandler.instance().bus().register(new KeyInputHandler()); FMLCommonHandler.instance().bus().register(new TickHandler()); + FMLCommonHandler.instance().bus().register(new RenderTickHandler()); FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); rendererSchematicGlobal = new RendererSchematicGlobal(); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 2c5b6473..dce45757 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -6,6 +6,7 @@ public static final class Config { public static final class Category { public static final String RENDER = "render"; public static final String PRINTER = "printer"; + public static final String TOOLTIP = "tooltip"; public static final String GENERAL = "general"; } @@ -39,6 +40,13 @@ public static final class Category { public static final String SWAP_SLOTS = "swapSlots"; public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; + public static final String TOOLTIP_ENABLED = "tooltipEnabled"; + public static final String TOOLTIP_ENABLED_DESC = "Display a tooltip when hovering over blocks in a schematic."; + public static final String TOOLTIP_X = "tooltipX"; + public static final String TOOLTIP_X_DESC = "Relative tooltip X."; + public static final String TOOLTIP_Y = "tooltipY"; + public static final String TOOLTIP_Y_DESC = "Relative tooltip Y."; + public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; diff --git a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java b/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java new file mode 100644 index 00000000..1617119b --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java @@ -0,0 +1,150 @@ +package com.github.lunatrius.schematica.tooltip; + +import com.github.lunatrius.core.client.gui.FontRendererHelper; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; +import cpw.mods.fml.common.registry.GameData; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import java.util.ArrayList; +import java.util.List; + +public class TooltipHandler { + public static final TooltipHandler INSTANCE = new TooltipHandler(); + + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + private static final int PADDING = 6; + + private final Minecraft minecraft = Minecraft.getMinecraft(); + + private int width = 1280; + private int height = 720; + + public boolean renderTooltip(final SchematicWorld schematic, final MovingObjectPosition objectMouseOver) { + if (objectMouseOver != null) { + if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { + return false; + } + + if (this.minecraft.gameSettings.showDebugInfo || this.minecraft.currentScreen != null && !(this.minecraft.currentScreen instanceof GuiChat)) { + return false; + } + + final List lines = getText(schematic, objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); + + if (!lines.isEmpty()) { + final ScaledResolution scaledResolution = new ScaledResolution(this.minecraft, this.minecraft.displayWidth, this.minecraft.displayHeight); + this.width = scaledResolution.getScaledWidth(); + this.height = scaledResolution.getScaledHeight(); + + drawHoveringText(lines, ConfigurationHandler.tooltipX, ConfigurationHandler.tooltipY, this.minecraft.fontRenderer); + } + + GL11.glDisable(GL11.GL_LIGHTING); + } + + return false; + } + + private List getText(final SchematicWorld schematic, final int x, final int y, final int z) { + final List list = new ArrayList(); + + final Block block = schematic.getBlock(x, y, z); + final int blockMetadata = schematic.getBlockMetadata(x, y, z); + + list.add(block.getLocalizedName()); + list.add("\u00a77" + BLOCK_REGISTRY.getNameForObject(block) + "\u00a7r : " + blockMetadata); + + return list; + } + + + private void drawHoveringText(final List lines, final float x, final float y, final FontRenderer fontRenderer) { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + + int width = 0; + int height = lines.size() * (fontRenderer.FONT_HEIGHT + 1) - 1; + for (String line : lines) { + int strWidth = fontRenderer.getStringWidth(line); + + if (strWidth > width) { + width = strWidth; + } + } + + int posX = MathHelper.clamp_int((int) (this.width / 100f * x), width / 2 + PADDING, this.width - (width + 1) / 2 - PADDING); + int posY = MathHelper.clamp_int((int) (this.height / 100f * y), PADDING, this.height - height - PADDING); + + posX -= width / 2; + + final int colorBackground = 0xF0100010; + drawGradientRect(posX - 3, posY - 4, posX + width + 3, posY - 3, colorBackground, colorBackground); + drawGradientRect(posX - 3, posY + height + 3, posX + width + 3, posY + height + 4, colorBackground, colorBackground); + drawGradientRect(posX - 3, posY - 3, posX + width + 3, posY + height + 3, colorBackground, colorBackground); + drawGradientRect(posX - 4, posY - 3, posX - 3, posY + height + 3, colorBackground, colorBackground); + drawGradientRect(posX + width + 3, posY - 3, posX + width + 4, posY + height + 3, colorBackground, colorBackground); + + final int colorTop = 0x505000FF; + final int colorBottom = (colorTop & 0xFEFEFE) >> 1 | colorTop & 0xFF000000; + drawGradientRect(posX - 3, posY - 3 + 1, posX - 3 + 1, posY + height + 3 - 1, colorTop, colorBottom); + drawGradientRect(posX + width + 2, posY - 3 + 1, posX + width + 3, posY + height + 3 - 1, colorTop, colorBottom); + drawGradientRect(posX - 3, posY - 3, posX + width + 3, posY - 3 + 1, colorTop, colorTop); + drawGradientRect(posX - 3, posY + height + 2, posX + width + 3, posY + height + 3, colorBottom, colorBottom); + + posX += width / 2; + + for (String line : lines) { + FontRendererHelper.drawCenteredString(fontRenderer, line, posX, posY, 0xFFFFFFFF); + posY += 10; + } + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_LIGHTING); + RenderHelper.enableStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + } + + private void drawGradientRect(final int x0, final int y0, final int x1, final int y1, final int colorA, final int colorB) { + float alphaA = (colorA >> 24 & 255) / 255f; + float redA = (colorA >> 16 & 255) / 255f; + float greenA = (colorA >> 8 & 255) / 255f; + float blueA = (colorA & 255) / 255f; + float alphaB = (colorB >> 24 & 255) / 255f; + float redB = (colorB >> 16 & 255) / 255f; + float greenB = (colorB >> 8 & 255) / 255f; + float blueB = (colorB & 255) / 255f; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GL11.glShadeModel(GL11.GL_SMOOTH); + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(redA, greenA, blueA, alphaA); + tessellator.addVertex(x1, y0, 300); + tessellator.addVertex(x0, y0, 300); + tessellator.setColorRGBA_F(redB, greenB, blueB, alphaB); + tessellator.addVertex(x0, y1, 300); + tessellator.addVertex(x1, y1, 300); + tessellator.draw(); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } +} From 9faf4735150efa64611c2a4c322032e3bc593ca0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 24 Oct 2014 02:14:35 +0200 Subject: [PATCH 095/314] Updated localizations. --- .../assets/schematica/lang/ca_ES.lang | 10 +++ .../assets/schematica/lang/cs_CZ.lang | 10 +++ .../assets/schematica/lang/da_DK.lang | 10 +++ .../assets/schematica/lang/de_DE.lang | 10 +++ .../assets/schematica/lang/en_GB.lang | 90 ++++++++++--------- .../assets/schematica/lang/en_PT.lang | 10 +++ .../assets/schematica/lang/en_US.lang | 10 +++ .../assets/schematica/lang/es_ES.lang | 10 +++ .../assets/schematica/lang/es_MX.lang | 10 +++ .../assets/schematica/lang/fi_FI.lang | 10 +++ .../assets/schematica/lang/fr_FR.lang | 10 +++ .../assets/schematica/lang/hu_HU.lang | 10 +++ .../assets/schematica/lang/it_IT.lang | 10 +++ .../assets/schematica/lang/ko_KR.lang | 10 +++ .../assets/schematica/lang/la_LA.lang | 10 +++ .../assets/schematica/lang/lt_LT.lang | 10 +++ .../assets/schematica/lang/nl_NL.lang | 10 +++ .../assets/schematica/lang/no_NO.lang | 10 +++ .../assets/schematica/lang/pl_PL.lang | 10 +++ .../assets/schematica/lang/pt_PT.lang | 10 +++ .../assets/schematica/lang/ru_RU.lang | 10 +++ .../assets/schematica/lang/sk_SK.lang | 10 +++ .../assets/schematica/lang/sl_SI.lang | 10 +++ .../assets/schematica/lang/th_TH.lang | 10 +++ .../assets/schematica/lang/tr_TR.lang | 10 +++ .../assets/schematica/lang/uk_UA.lang | 10 +++ .../assets/schematica/lang/zh_CN.lang | 10 +++ 27 files changed, 310 insertions(+), 40 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index be802033..27bfcebd 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Imprimir # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Imprimir # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 2e203b14..8879f41b 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Tiskárna # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Tiskárna # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index d757c0aa..7009965a 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -35,6 +35,8 @@ schematica.gui.materialamount=Antal # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.materialamount=Antal # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index b9c700ca..d0d8d8ad 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Drucker # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Drucker # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index faab5c78..b1ee32e8 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -19,8 +19,8 @@ schematica.gui.operations=Operations schematica.gui.point.red=Red point schematica.gui.point.blue=Blue point schematica.gui.saveselection=Save the selection as a schematic -# schematica.gui.on=ON -# schematica.gui.off=OFF +schematica.gui.on=ON +schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,54 +28,64 @@ schematica.gui.materials=Materials schematica.gui.materialname=Material schematica.gui.materialamount=Amount schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block +schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. +schematica.config.category.render=Rendering +schematica.config.category.render.tooltip=Render related settings. +schematica.config.category.printer=Printer +schematica.config.category.printer.tooltip=Printer related settings. +schematica.config.category.tooltip=Tooltip +schematica.config.category.tooltip.tooltip=Tooltip related settings. +schematica.config.category.general=General +schematica.config.category.general.tooltip=General settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. +schematica.config.alphaEnabled=Alpha Enabled +schematica.config.alphaEnabled.tooltip=Enable transparent textures. +schematica.config.alpha=Alpha +schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). +schematica.config.highlight=Highlight Blocks +schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. +schematica.config.highlightAir=Highlight Air +schematica.config.highlightAir.tooltip=Highlight blocks that should be air. +schematica.config.blockDelta=Block Delta +schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +schematica.config.drawQuads=Draw Quads +schematica.config.drawQuads.tooltip=Draw surface areas. +schematica.config.drawLines=Draw Lines +schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +schematica.config.placeDelay=Placement Delay +schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +schematica.config.timeout=Timeout +schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +schematica.config.placeInstantly=Place Instantly +schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. +schematica.config.destroyBlocks=Destroy Blocks +schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). +schematica.config.destroyInstantly=Destroy Instantly +schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. +schematica.config.placeAdjacent=Place Only Adjacent +schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. +schematica.config.swapSlots=Swap Slots +schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. + +# gui - config - tooltip +schematica.config.tooltipEnabled=Tooltip Enabled +schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +schematica.config.tooltipX=Tooltip X +schematica.config.tooltipX.tooltip=Relative tooltip X. +schematica.config.tooltipY=Tooltip Y +schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. +schematica.config.schematicDirectory=Schematic Directory +schematica.config.schematicDirectory.tooltip=Schematic directory. # keys -# schematica.key.category=Schematica +schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 084a0f68..1c32d184 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Printing thing # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Printing thing # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 904ef0e7..b1ee32e8 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -35,6 +35,8 @@ schematica.config.category.render=Rendering schematica.config.category.render.tooltip=Render related settings. schematica.config.category.printer=Printer schematica.config.category.printer.tooltip=Printer related settings. +schematica.config.category.tooltip=Tooltip +schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacen schematica.config.swapSlots=Swap Slots schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +schematica.config.tooltipEnabled=Tooltip Enabled +schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +schematica.config.tooltipX=Tooltip X +schematica.config.tooltipX.tooltip=Relative tooltip X. +schematica.config.tooltipY=Tooltip Y +schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 6627455e..982e310c 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Impresora # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Impresora # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index b25ac3c1..0bfca427 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -35,6 +35,8 @@ schematica.gui.materialamount=Cantidad # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.materialamount=Cantidad # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 1c2072b8..cae5e034 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Tulostin # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Tulostin # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 5ee65f49..1a91f335 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Mode imprimante # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Mode imprimante # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 892db620..a518e1ef 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Nyomtató # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Nyomtató # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 945e598a..543b9314 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -35,6 +35,8 @@ schematica.gui.materialamount=Quantità # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.materialamount=Quantità # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index e0f36177..a7b947f4 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -35,6 +35,8 @@ schematica.config.category.render=렌더링 schematica.config.category.render.tooltip=렌더링 관련 설정. schematica.config.category.printer=프린터 schematica.config.category.printer.tooltip=프린터 관련 설정. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=일반 schematica.config.category.general.tooltip=일반 설정. @@ -70,6 +72,14 @@ schematica.config.placeAdjacent.tooltip=접촉된 블럭이 있을 경우에만 schematica.config.swapSlots=슬롯 바꾸기 schematica.config.swapSlots.tooltip=프린터는 인벤토리의 아이템을 바꾸기 위해 이 슬롯들을 사용합니다. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general schematica.config.schematicDirectory=Schematic 디렉토리 schematica.config.schematicDirectory.tooltip=Schematic 디렉토리. diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 67bab6f7..9faa3cf9 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -35,6 +35,8 @@ schematica.gui.materialamount=Numerus # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.materialamount=Numerus # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index dcf05d63..ba8bbb77 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -35,6 +35,8 @@ schematica.gui.materialamount=Kiekis # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.materialamount=Kiekis # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 9a755a7a..886be4ca 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -35,6 +35,8 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 892f2d95..ca3e1400 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -35,6 +35,8 @@ schematica.config.category.render=Gjengivelse schematica.config.category.render.tooltip=Gjengivelsesrelaterte innstillinger. schematica.config.category.printer=Printer schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=Generelt schematica.config.category.general.tooltip=Generelle innstillinger. @@ -70,6 +72,14 @@ schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilst # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general schematica.config.schematicDirectory=Tegningskatalog schematica.config.schematicDirectory.tooltip=Tegningskatalog. diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index f510eb4a..fc304edb 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Drukarka # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Drukarka # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 9c571076..4491b50d 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 90f52c4c..3f4f068d 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Принтер # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Принтер # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index c2000ba9..0d03074a 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Tlačiareň # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Tlačiareň # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index d958c3ba..8515fb07 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Tiskalnik # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Tiskalnik # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 6e3eb6ee..76b7d8b5 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -35,6 +35,8 @@ schematica.gui.printer=การปริ๊น # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=การปริ๊น # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 4c41b030..b1a048b1 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Yazıcı # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Yazıcı # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 1ce96571..48ad8c28 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -35,6 +35,8 @@ schematica.gui.printer=Принтер # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=Принтер # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 3bc4497d..80e120b4 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -35,6 +35,8 @@ schematica.gui.printer=投影 # schematica.config.category.render.tooltip=Render related settings. # schematica.config.category.printer=Printer # schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.tooltip=Tooltip +# schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. @@ -70,6 +72,14 @@ schematica.gui.printer=投影 # schematica.config.swapSlots=Swap Slots # schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# gui - config - tooltip +# schematica.config.tooltipEnabled=Tooltip Enabled +# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipX=Tooltip X +# schematica.config.tooltipX.tooltip=Relative tooltip X. +# schematica.config.tooltipY=Tooltip Y +# schematica.config.tooltipY.tooltip=Relative tooltip Y. + # gui - config - general # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. From 470ad0045f526bce113fb98e6d92278019d5c773 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 24 Oct 2014 02:15:55 +0200 Subject: [PATCH 096/314] Bumped version. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 15cc6f28..f29822cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version_major=1 version_minor=7 -version_micro=2 +version_micro=3 version_minecraft=1.7.10 version_forge=10.13.1.1217 version_minforge=10.13.0.1185 From 86a1a43ac3775b9f6ab784271cc452ee05e5e00d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 31 Oct 2014 21:40:37 +0100 Subject: [PATCH 097/314] Fixed a NPE with the rayTrace method. --- .../schematica/handler/client/RenderTickHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 12eccc62..44b6be23 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -25,6 +25,10 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; + if (renderViewEntity == null) { + return null; + } + final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance(); final double posX = renderViewEntity.posX; From 0eeade630d35b52e839d52f6572d026cf321024f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 2 Nov 2014 18:20:11 +0100 Subject: [PATCH 098/314] Just use the KeyBinding key code instead of manually poking into LWJGL... (also fixes pick-block when it's bound to a keyboard key). --- .../schematica/handler/client/KeyInputHandler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 230f90bb..37385a3e 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -18,7 +18,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.ForgeHooks; import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; import static cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; import static cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent; @@ -63,7 +62,8 @@ public void onKeyInput(KeyInputEvent event) { @SubscribeEvent public void onMouseInput(MouseInputEvent event) { - if (this.minecraft.gameSettings.keyBindPickBlock.isPressed()) { + final KeyBinding keyPickBlock = this.minecraft.gameSettings.keyBindPickBlock; + if (keyPickBlock.isPressed()) { try { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); boolean revert = true; @@ -73,8 +73,7 @@ public void onMouseInput(MouseInputEvent event) { } if (revert) { - final int eventButton = Mouse.getEventButton(); - KeyBinding.onTick(eventButton - 100); + KeyBinding.onTick(keyPickBlock.getKeyCode()); } } catch (Exception e) { Reference.logger.error("Could not pick block!", e); From cfcd79a883c62dcd13017fcff1ae7ac4ecc4e0f3 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 17 Nov 2014 16:56:57 +0100 Subject: [PATCH 099/314] Added curse upload tasks. --- build.gradle | 1 + gradle.properties | 3 ++- gradle/scripts/curseforge.gradle | 44 ++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 gradle/scripts/curseforge.gradle diff --git a/build.gradle b/build.gradle index cf0a94f9..bd8fbf13 100644 --- a/build.gradle +++ b/build.gradle @@ -26,3 +26,4 @@ apply from: 'gradle/scripts/dependencies.gradle' apply from: 'gradle/scripts/artifacts.gradle' apply from: 'gradle/scripts/signing.gradle' apply from: 'gradle/scripts/release.gradle' +apply from: 'gradle/scripts/curseforge.gradle' diff --git a/gradle.properties b/gradle.properties index f29822cf..da5b8c05 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,10 @@ version_major=1 version_minor=7 version_micro=3 version_minecraft=1.7.10 -version_forge=10.13.1.1217 +version_forge=10.13.2.1230 version_minforge=10.13.0.1185 version_lunatriuscore=1.1.2.14 extra_modsio_id=1008 +extra_curseforge_id=225603 extra_fmlat=schematica_at.cfg diff --git a/gradle/scripts/curseforge.gradle b/gradle/scripts/curseforge.gradle new file mode 100644 index 00000000..4905c471 --- /dev/null +++ b/gradle/scripts/curseforge.gradle @@ -0,0 +1,44 @@ +buildscript { + repositories { + mavenCentral() + maven { + name = 'forge' + url = 'http://files.minecraftforge.net/maven' + } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/repositories/snapshots/' + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + } +} + +apply plugin: 'curseforge' + +import net.minecraftforge.gradle.curseforge.CurseUploadTask; + +if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curseforge_id')) { + curse { + dependsOn signJars + releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release' + } + + task curseDev(dependsOn: 'signJars', type: CurseUploadTask) { + releaseType = 'alpha' + artifact = devJar.archivePath + } + + task curseSource(dependsOn: 'signJars', type: CurseUploadTask) { + releaseType = 'alpha' + artifact = sourceJar.archivePath + } + + configure([curse, curseDev, curseSource]) { + apiKey = project.api_key_curseforge + projectId = project.extra_curseforge_id + changelog = '' + addGameVersion minecraft.version + } +} From 6f95f33bc55f68fb14ecba6aed95b836552b04b0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 19 Nov 2014 17:39:57 +0100 Subject: [PATCH 100/314] Added server side features. --- .../lunatrius/schematica/Schematica.java | 3 ++ .../handler/ConfigurationHandler.java | 21 ++++++++ .../schematica/handler/PlayerHandler.java | 21 ++++++++ .../handler/client/ChatEventHandler.java | 1 - .../schematica/network/PacketHandler.java | 15 ++++++ .../network/message/MessageCapabilities.java | 50 +++++++++++++++++++ .../schematica/proxy/ServerProxy.java | 3 ++ .../lunatrius/schematica/reference/Names.java | 8 +++ 8 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index f625800a..4e974549 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -2,6 +2,7 @@ import com.github.lunatrius.core.version.VersionChecker; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.proxy.CommonProxy; import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.Mod; @@ -34,6 +35,8 @@ public void preInit(FMLPreInitializationEvent event) { @EventHandler public void init(FMLInitializationEvent event) { + PacketHandler.init(); + try { proxy.registerEvents(); } catch (Exception e) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 760d0b2d..1d6448ba 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -38,6 +38,9 @@ public class ConfigurationHandler { public static final double TOOLTIPY_DEFAULT = 0; public static final String SCHEMATICDIRECTORY_STR = "schematics"; public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); + public static final boolean PRINTERENABLED_DEFAULT = true; + public static final boolean SAVEENABLED_DEFAULT = true; + public static final boolean LOADENABLED_DEFAULT = true; public static boolean enableAlpha = ENABLEALPHA_DEFAULT; public static float alpha = (float) ALPHA_DEFAULT; @@ -58,6 +61,9 @@ public class ConfigurationHandler { public static float tooltipX = (float) TOOLTIPX_DEFAULT; public static float tooltipY = (float) TOOLTIPY_DEFAULT; public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; + public static boolean printerEnabled = PRINTERENABLED_DEFAULT; + public static boolean saveEnabled = SAVEENABLED_DEFAULT; + public static boolean loadEnabled = LOADENABLED_DEFAULT; public static Property propEnableAlpha = null; public static Property propAlpha = null; @@ -77,6 +83,9 @@ public class ConfigurationHandler { public static Property propTooltipX = null; public static Property propTooltipY = null; public static Property propSchematicDirectory = null; + public static Property propPrinterEnabled = null; + public static Property propSaveEnabled = null; + public static Property propLoadEnabled = null; public static void init(File configFile) { if (configuration == null) { @@ -172,6 +181,18 @@ private static void loadConfiguration() { Reference.logger.warn("Could not canonize path!", e); } + propPrinterEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.PRINTER_ENABLED, PRINTERENABLED_DEFAULT, Names.Config.PRINTER_ENABLED_DESC); + propPrinterEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PRINTER_ENABLED); + printerEnabled = propPrinterEnabled.getBoolean(PRINTERENABLED_DEFAULT); + + propSaveEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.SAVE_ENABLED, SAVEENABLED_DEFAULT, Names.Config.SAVE_ENABLED_DESC); + propSaveEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SAVE_ENABLED); + saveEnabled = propSaveEnabled.getBoolean(SAVEENABLED_DEFAULT); + + propLoadEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.LOAD_ENABLED, LOADENABLED_DEFAULT, Names.Config.LOAD_ENABLED_DESC); + propLoadEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.LOAD_ENABLED); + loadEnabled = propLoadEnabled.getBoolean(LOADENABLED_DEFAULT); + Schematica.proxy.createFolders(); if (configuration.hasChanged()) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java new file mode 100644 index 00000000..af8bdac7 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java @@ -0,0 +1,21 @@ +package com.github.lunatrius.schematica.handler; + +import com.github.lunatrius.schematica.network.PacketHandler; +import com.github.lunatrius.schematica.network.message.MessageCapabilities; +import com.github.lunatrius.schematica.reference.Reference; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.PlayerEvent; +import net.minecraft.entity.player.EntityPlayerMP; + +public class PlayerHandler { + @SubscribeEvent + public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { + if (event.player instanceof EntityPlayerMP) { + try { + PacketHandler.INSTANCE.sendTo(new MessageCapabilities(ConfigurationHandler.printerEnabled, ConfigurationHandler.saveEnabled, ConfigurationHandler.loadEnabled), (EntityPlayerMP) event.player); + } catch (Exception ex) { + Reference.logger.error("Failed to send capabilities!", ex); + } + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index b7aa8bc4..071e6c1e 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -8,7 +8,6 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; public class ChatEventHandler { - public static int chatLines = 0; @SubscribeEvent diff --git a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java new file mode 100644 index 00000000..65f941e6 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java @@ -0,0 +1,15 @@ +package com.github.lunatrius.schematica.network; + +import com.github.lunatrius.schematica.network.message.MessageCapabilities; +import com.github.lunatrius.schematica.reference.Reference; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import cpw.mods.fml.relauncher.Side; + +public class PacketHandler { + public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID.toLowerCase()); + + public static void init() { + INSTANCE.registerMessage(MessageCapabilities.class, MessageCapabilities.class, 0, Side.CLIENT); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java new file mode 100644 index 00000000..7f328580 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java @@ -0,0 +1,50 @@ +package com.github.lunatrius.schematica.network.message; + +import com.github.lunatrius.schematica.SchematicPrinter; +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Reference; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +public class MessageCapabilities implements IMessage, IMessageHandler { + public boolean isPrinterEnabled; + public boolean isSaveEnabled; + public boolean isLoadEnabled; + + public MessageCapabilities() { + this(false, false, false); + } + + public MessageCapabilities(boolean isPrinterEnabled, boolean isSaveEnabled, boolean isLoadEnabled) { + this.isPrinterEnabled = isPrinterEnabled; + this.isSaveEnabled = isSaveEnabled; + this.isLoadEnabled = isLoadEnabled; + } + + @Override + public void fromBytes(ByteBuf buf) { + this.isPrinterEnabled = buf.readBoolean(); + this.isSaveEnabled = buf.readBoolean(); + this.isLoadEnabled = buf.readBoolean(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeBoolean(this.isPrinterEnabled); + buf.writeBoolean(this.isSaveEnabled); + buf.writeBoolean(this.isLoadEnabled); + } + + @Override + public IMessage onMessage(MessageCapabilities message, MessageContext ctx) { + SchematicPrinter.INSTANCE.setEnabled(message.isPrinterEnabled); + Schematica.proxy.isSaveEnabled = message.isSaveEnabled; + Schematica.proxy.isLoadEnabled = message.isLoadEnabled; + + Reference.logger.info(String.format("Server capabilities{printer=%s, save=%s, load=%s}", message.isPrinterEnabled, message.isSaveEnabled, message.isLoadEnabled)); + + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 39b476c3..6cc835a9 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,8 +1,10 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.handler.PlayerHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; @@ -21,6 +23,7 @@ public void registerKeybindings() { @Override public void registerEvents() { + FMLCommonHandler.instance().bus().register(new PlayerHandler()); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index dce45757..4a7a8250 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -8,6 +8,7 @@ public static final class Category { public static final String PRINTER = "printer"; public static final String TOOLTIP = "tooltip"; public static final String GENERAL = "general"; + public static final String SERVER = "server"; } public static final String ALPHA_ENABLED = "alphaEnabled"; @@ -50,6 +51,13 @@ public static final class Category { public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; + public static final String PRINTER_ENABLED = "printerEnabled"; + public static final String PRINTER_ENABLED_DESC = "printerEnabled"; + public static final String SAVE_ENABLED = "saveEnabled"; + public static final String SAVE_ENABLED_DESC = "printerEnabled"; + public static final String LOAD_ENABLED = "loadEnabled"; + public static final String LOAD_ENABLED_DESC = "printerEnabled"; + public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; } From adc01dadfb92cc680b4898b803f73d22e1b479de Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 19 Nov 2014 17:40:53 +0100 Subject: [PATCH 101/314] Updated localizations. --- src/main/resources/assets/schematica/lang/ca_ES.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/cs_CZ.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/da_DK.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/de_DE.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/en_GB.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/en_PT.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/en_US.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/es_ES.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/es_MX.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/fi_FI.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/fr_FR.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/hu_HU.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/it_IT.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/ko_KR.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/la_LA.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/lt_LT.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/nl_NL.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/no_NO.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/pl_PL.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/pt_PT.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/ru_RU.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/sk_SK.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/sl_SI.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/th_TH.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/tr_TR.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/uk_UA.lang | 10 ++++++++++ src/main/resources/assets/schematica/lang/zh_CN.lang | 10 ++++++++++ 27 files changed, 270 insertions(+) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 27bfcebd..df89ac92 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Imprimir # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Imprimir # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Carregar esquema diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 8879f41b..11449266 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Tiskárna # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Tiskárna # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Načíst schéma diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 7009965a..2a94b319 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -39,6 +39,8 @@ schematica.gui.materialamount=Antal # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.materialamount=Antal # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Åbn schematic diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index d0d8d8ad..232c09c4 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Drucker # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Drucker # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Schematic laden diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index b1ee32e8..3d750a1a 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -39,6 +39,8 @@ schematica.config.category.tooltip=Tooltip schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.config.tooltipY.tooltip=Relative tooltip Y. schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys schematica.key.category=Schematica schematica.key.load=Load schematic diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 1c32d184..8371aac7 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Printing thing # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Printing thing # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Load yer blueprint diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index b1ee32e8..177c512b 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -39,6 +39,8 @@ schematica.config.category.tooltip=Tooltip schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. +schematica.config.category.server=Server +schematica.config.category.server.tooltip=Server-side settings. # gui - config - render schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.config.tooltipY.tooltip=Relative tooltip Y. schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +schematica.config.printerEnabled=Allow Printer +schematica.config.printerEnabled.tooltip=Allow players to use the printer. +schematica.config.saveEnabled=Allow Saving +schematica.config.saveEnabled.tooltip=Allow players to save schematics. +schematica.config.loadEnabled=Allow Loading +schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys schematica.key.category=Schematica schematica.key.load=Load schematic diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 982e310c..cefc24f0 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Impresora # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Impresora # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Cargar esquema diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 0bfca427..7f0565ae 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -39,6 +39,8 @@ schematica.gui.materialamount=Cantidad # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.materialamount=Cantidad # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Cargar esquema diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index cae5e034..643ee576 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Tulostin # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Tulostin # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Lataa kaava diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 1a91f335..32a1cf51 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Mode imprimante # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Mode imprimante # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Charger un schematic diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index a518e1ef..ee47aecb 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Nyomtató # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Nyomtató # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Klisé betöltése diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 543b9314..67d9b574 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -39,6 +39,8 @@ schematica.gui.materialamount=Quantità # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.materialamount=Quantità # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Carica schematica diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index a7b947f4..cdbb2b14 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -39,6 +39,8 @@ schematica.config.category.printer.tooltip=프린터 관련 설정. # schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=일반 schematica.config.category.general.tooltip=일반 설정. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render schematica.config.alphaEnabled=알파 활성화됨 @@ -84,6 +86,14 @@ schematica.config.swapSlots.tooltip=프린터는 인벤토리의 아이템을 schematica.config.schematicDirectory=Schematic 디렉토리 schematica.config.schematicDirectory.tooltip=Schematic 디렉토리. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys schematica.key.category=Schematica schematica.key.load=Schematic 불러오기 diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 9faa3cf9..a1cb8e79 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -39,6 +39,8 @@ schematica.gui.materialamount=Numerus # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.materialamount=Numerus # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica # schematica.key.load=Load schematic diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index ba8bbb77..4ccaba40 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -39,6 +39,8 @@ schematica.gui.materialamount=Kiekis # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.materialamount=Kiekis # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Atidaryti schemà diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 886be4ca..9fdd0b2e 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -39,6 +39,8 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.materialamount=Hoeveelheid # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Laad schematic diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index ca3e1400..8647c557 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -39,6 +39,8 @@ schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. # schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=Generelt schematica.config.category.general.tooltip=Generelle innstillinger. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render schematica.config.alphaEnabled=Alpha aktivert @@ -84,6 +86,14 @@ schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilst schematica.config.schematicDirectory=Tegningskatalog schematica.config.schematicDirectory.tooltip=Tegningskatalog. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys schematica.key.category=Schematica schematica.key.load=Last tegning diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index fc304edb..ff958d9f 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Drukarka # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Drukarka # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Ladowanie schematu diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 4491b50d..04633618 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Modo de construçăo automática # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Carregar schematica diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 3f4f068d..063e8b20 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Принтер # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Принтер # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys schematica.key.category=Schematica schematica.key.load=Загрузить схему diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 0d03074a..d58e4b65 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Tlačiareň # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Tlačiareň # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Načítať schému diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index 8515fb07..fb75dc77 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Tiskalnik # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Tiskalnik # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Naloži shemo diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 76b7d8b5..152fe02c 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -39,6 +39,8 @@ schematica.gui.printer=การปริ๊น # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=การปริ๊น # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=เปิดไฟล์ Schematic diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index b1a048b1..fe04de00 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Yazıcı # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Yazıcı # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=Şematiki yükle diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 48ad8c28..6636e332 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -39,6 +39,8 @@ schematica.gui.printer=Принтер # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=Принтер # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=завантажити технологічну схему diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 80e120b4..1e4fe49e 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -39,6 +39,8 @@ schematica.gui.printer=投影 # schematica.config.category.tooltip.tooltip=Tooltip related settings. # schematica.config.category.general=General # schematica.config.category.general.tooltip=General settings. +# schematica.config.category.server=Server +# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render # schematica.config.alphaEnabled=Alpha Enabled @@ -84,6 +86,14 @@ schematica.gui.printer=投影 # schematica.config.schematicDirectory=Schematic Directory # schematica.config.schematicDirectory.tooltip=Schematic directory. +# gui - config - server +# schematica.config.printerEnabled=Allow Printer +# schematica.config.printerEnabled.tooltip=Allow players to use the printer. +# schematica.config.saveEnabled=Allow Saving +# schematica.config.saveEnabled.tooltip=Allow players to save schematics. +# schematica.config.loadEnabled=Allow Loading +# schematica.config.loadEnabled.tooltip=Allow players to load schematics. + # keys # schematica.key.category=Schematica schematica.key.load=载入Schematic文件 From 237a9f333701bea2db6c4b0194a0290ba07a4e24 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 20 Nov 2014 08:15:37 +0100 Subject: [PATCH 102/314] Added instance variables for all event handlers. --- .../client/gui/GuiSchematicControl.java | 23 ++++++++++--------- .../renderer/RendererSchematicChunk.java | 2 +- .../renderer/RendererSchematicGlobal.java | 4 ++++ .../handler/ConfigurationHandler.java | 4 ++++ .../schematica/handler/PlayerHandler.java | 4 ++++ .../handler/client/ChatEventHandler.java | 12 ++++++---- .../handler/client/KeyInputHandler.java | 14 +++++------ .../handler/client/RenderTickHandler.java | 4 ++++ .../handler/client/TickHandler.java | 7 +++++- .../schematica/proxy/ClientProxy.java | 22 ++++++++---------- .../schematica/proxy/ServerProxy.java | 2 +- .../lunatrius/schematica/reference/Names.java | 7 ++++++ 12 files changed, 68 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 385edc76..21025833 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -3,6 +3,7 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; @@ -152,28 +153,28 @@ protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDecX.id) { this.schematic.position.x -= ClientProxy.INCREMENTS[this.incrementX]; - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnIncX.id) { this.schematic.position.x += ClientProxy.INCREMENTS[this.incrementX]; - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnAmountX.id) { this.incrementX = (this.incrementX + 1) % ClientProxy.INCREMENTS.length; this.btnAmountX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementX]); } else if (guiButton.id == this.btnDecY.id) { this.schematic.position.y -= ClientProxy.INCREMENTS[this.incrementY]; - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnIncY.id) { this.schematic.position.y += ClientProxy.INCREMENTS[this.incrementY]; - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnAmountY.id) { this.incrementY = (this.incrementY + 1) % ClientProxy.INCREMENTS.length; this.btnAmountY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementY]); } else if (guiButton.id == this.btnDecZ.id) { this.schematic.position.z -= ClientProxy.INCREMENTS[this.incrementZ]; - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnIncZ.id) { this.schematic.position.z += ClientProxy.INCREMENTS[this.incrementZ]; - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnAmountZ.id) { this.incrementZ = (this.incrementZ + 1) % ClientProxy.INCREMENTS.length; this.btnAmountZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementZ]); @@ -181,27 +182,27 @@ protected void actionPerformed(GuiButton guiButton) { if (this.schematic != null) { this.schematic.decrementRenderingLayer(); } - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnIncLayer.id) { if (this.schematic != null) { this.schematic.incrementRenderingLayer(); } - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnHide.id) { this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); } else if (guiButton.id == this.btnMove.id) { ClientProxy.moveSchematicToPlayer(this.schematic); - ClientProxy.rendererSchematicGlobal.refresh(); + RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnFlip.id) { if (this.schematic != null) { this.schematic.flip(); - ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); + RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); SchematicPrinter.INSTANCE.refresh(); } } else if (guiButton.id == this.btnRotate.id) { if (this.schematic != null) { this.schematic.rotate(); - ClientProxy.rendererSchematicGlobal.createRendererSchematicChunks(this.schematic); + RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); SchematicPrinter.INSTANCE.refresh(); } } else if (guiButton.id == this.btnMaterials.id) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 60f6e2a3..2e7f1622 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -224,7 +224,7 @@ public void render(int renderPass) { public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { IBlockAccess mcWorld = this.minecraft.theWorld; - RenderBlocks renderBlocks = ClientProxy.rendererSchematicGlobal.renderBlocks; + RenderBlocks renderBlocks = RendererSchematicGlobal.INSTANCE.renderBlocks; int x, y, z, wx, wy, wz; int sides; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 3cc9f0d8..caf4598a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -18,6 +18,8 @@ import java.util.List; public class RendererSchematicGlobal { + public static final RendererSchematicGlobal INSTANCE = new RendererSchematicGlobal(); + private final Minecraft minecraft = Minecraft.getMinecraft(); private final Profiler profiler = this.minecraft.mcProfiler; @@ -26,6 +28,8 @@ public class RendererSchematicGlobal { public final List sortedRendererSchematicChunk = new ArrayList(); private final RendererSchematicChunkSorter rendererSchematicChunkSorter = new RendererSchematicChunkSorter(); + private RendererSchematicGlobal() {} + @SubscribeEvent public void onRender(RenderWorldLastEvent event) { EntityPlayerSP player = this.minecraft.thePlayer; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 1d6448ba..710bbef7 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -15,6 +15,8 @@ import java.util.Queue; public class ConfigurationHandler { + public static final ConfigurationHandler INSTANCE = new ConfigurationHandler(); + public static final String VERSION = "1"; public static Configuration configuration; @@ -200,6 +202,8 @@ private static void loadConfiguration() { } } + private ConfigurationHandler() {} + @SubscribeEvent public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.modID.equalsIgnoreCase(Reference.MODID)) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java index af8bdac7..eb5c743a 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java @@ -8,6 +8,10 @@ import net.minecraft.entity.player.EntityPlayerMP; public class PlayerHandler { + public static final PlayerHandler INSTANCE = new PlayerHandler(); + + private PlayerHandler() {} + @SubscribeEvent public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { if (event.player instanceof EntityPlayerMP) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 071e6c1e..61ad831b 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -8,14 +8,18 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; public class ChatEventHandler { - public static int chatLines = 0; + public static final ChatEventHandler INSTANCE = new ChatEventHandler(); + + public int chatLines = 0; + + private ChatEventHandler() {} @SubscribeEvent public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { - if (chatLines < 20) { - chatLines++; + if (this.chatLines < 20) { + this.chatLines++; String message = event.message.getFormattedText(); - Reference.logger.debug(String.format("Message #%d: %s", chatLines, message)); + Reference.logger.debug(String.format("Message #%d: %s", this.chatLines, message)); if (message.contains(Names.SBC.DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); SchematicPrinter.INSTANCE.setEnabled(false); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 37385a3e..4d9a2e60 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -5,6 +5,7 @@ import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -23,14 +24,11 @@ import static cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent; public class KeyInputHandler { - public static final String CATEGORY = "schematica.key.category"; - public static final String LOAD = "schematica.key.load"; - public static final String SAVE = "schematica.key.save"; - public static final String CONTROL = "schematica.key.control"; + public static final KeyInputHandler INSTANCE = new KeyInputHandler(); - private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(LOAD, Keyboard.KEY_DIVIDE, CATEGORY); - private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(SAVE, Keyboard.KEY_MULTIPLY, CATEGORY); - private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(CONTROL, Keyboard.KEY_SUBTRACT, CATEGORY); + private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(Names.Keys.LOAD, Keyboard.KEY_DIVIDE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(Names.Keys.SAVE, Keyboard.KEY_MULTIPLY, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(Names.Keys.CONTROL, Keyboard.KEY_SUBTRACT, Names.Keys.CATEGORY); public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL @@ -38,6 +36,8 @@ public class KeyInputHandler { private final Minecraft minecraft = Minecraft.getMinecraft(); + private KeyInputHandler() {} + @SubscribeEvent public void onKeyInput(KeyInputEvent event) { for (KeyBinding keyBinding : KEY_BINDINGS) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 44b6be23..986a947f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -12,8 +12,12 @@ import net.minecraft.util.Vec3; public class RenderTickHandler { + public static final RenderTickHandler INSTANCE = new RenderTickHandler(); + private final Minecraft minecraft = Minecraft.getMinecraft(); + private RenderTickHandler() {} + @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent event) { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index df957d19..290dc1cb 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -3,6 +3,7 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; +import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; @@ -15,10 +16,14 @@ import net.minecraft.util.AxisAlignedBB; public class TickHandler { + public static final TickHandler INSTANCE = new TickHandler(); + private final Minecraft minecraft = Minecraft.getMinecraft(); private int ticks = -1; + private TickHandler() {} + @SubscribeEvent public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { Reference.logger.info("Scheduling client settings reset."); @@ -70,7 +75,7 @@ private void checkDirty(SchematicWorld schematic) { for (WorldRenderer worldRenderer : renderers) { if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-schematic.position.x, -schematic.position.y, -schematic.position.z); - for (RendererSchematicChunk renderer : ClientProxy.rendererSchematicGlobal.sortedRendererSchematicChunk) { + for (RendererSchematicChunk renderer : RendererSchematicGlobal.INSTANCE.sortedRendererSchematicChunk) { if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { renderer.setDirty(); } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 18ec2328..0d9c7ebd 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -35,7 +35,6 @@ public class ClientProxy extends CommonProxy { 1, 5, 15, 50, 250 }; - public static RendererSchematicGlobal rendererSchematicGlobal = null; public static boolean isRenderingGuide = false; public static boolean isPendingReset = false; @@ -165,14 +164,13 @@ public void registerKeybindings() { @Override public void registerEvents() { - FMLCommonHandler.instance().bus().register(new KeyInputHandler()); - FMLCommonHandler.instance().bus().register(new TickHandler()); - FMLCommonHandler.instance().bus().register(new RenderTickHandler()); - FMLCommonHandler.instance().bus().register(new ConfigurationHandler()); - - rendererSchematicGlobal = new RendererSchematicGlobal(); - MinecraftForge.EVENT_BUS.register(rendererSchematicGlobal); - MinecraftForge.EVENT_BUS.register(new ChatEventHandler()); + FMLCommonHandler.instance().bus().register(KeyInputHandler.INSTANCE); + FMLCommonHandler.instance().bus().register(TickHandler.INSTANCE); + FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); + FMLCommonHandler.instance().bus().register(ConfigurationHandler.INSTANCE); + + MinecraftForge.EVENT_BUS.register(RendererSchematicGlobal.INSTANCE); + MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); } @Override @@ -190,12 +188,12 @@ public File getDataDirectory() { public void resetSettings() { super.resetSettings(); - ChatEventHandler.chatLines = 0; + ChatEventHandler.INSTANCE.chatLines = 0; SchematicPrinter.INSTANCE.setEnabled(true); SchematicPrinter.INSTANCE.setSchematic(null); - rendererSchematicGlobal.destroyRendererSchematicChunks(); + RendererSchematicGlobal.INSTANCE.destroyRendererSchematicChunks(); setActiveSchematic(null); @@ -244,7 +242,7 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, schematic.getWidth(), schematic.getHeight(), schematic.getLength())); Schematica.proxy.setActiveSchematic(schematic); - rendererSchematicGlobal.createRendererSchematicChunks(schematic); + RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(schematic); SchematicPrinter.INSTANCE.setSchematic(schematic); schematic.isRendering = true; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 6cc835a9..085ba2d1 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -23,7 +23,7 @@ public void registerKeybindings() { @Override public void registerEvents() { - FMLCommonHandler.instance().bus().register(new PlayerHandler()); + FMLCommonHandler.instance().bus().register(PlayerHandler.INSTANCE); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 4a7a8250..4bae3404 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -65,6 +65,13 @@ public static final class ModId { public static final String MINECRAFT = "minecraft"; } + public static final class Keys { + public static final String CATEGORY = "schematica.key.category"; + public static final String LOAD = "schematica.key.load"; + public static final String SAVE = "schematica.key.save"; + public static final String CONTROL = "schematica.key.control"; + } + public static final class NBT { public static final String ROOT = "Schematic"; From 02d72c01f13d59546242c7a407992b2aba38da47 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 20 Nov 2014 08:47:34 +0100 Subject: [PATCH 103/314] Use the type parameter of Comparator... Note: I want to stab my past self. --- ....java => RendererSchematicChunkComparator.java} | 14 +++++--------- .../client/renderer/RendererSchematicGlobal.java | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) rename src/main/java/com/github/lunatrius/schematica/client/renderer/{RendererSchematicChunkSorter.java => RendererSchematicChunkComparator.java} (65%) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java similarity index 65% rename from src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java rename to src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java index 8b30abb4..b78c30c7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkSorter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java @@ -6,29 +6,25 @@ import java.util.Comparator; -public class RendererSchematicChunkSorter implements Comparator { +public class RendererSchematicChunkComparator implements Comparator { private final Vector3f position = new Vector3f(); private final Vector3f schematicPosition = new Vector3f(); private SchematicWorld schematic = null; - public int doCompare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { + @Override + public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { if (rendererSchematicChunk1.isInFrustrum && !rendererSchematicChunk2.isInFrustrum) { return -1; } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { return 1; } else { this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); - double dist1 = this.position.clone().sub(rendererSchematicChunk1.centerPosition).lengthSquared(); - double dist2 = this.position.sub(rendererSchematicChunk2.centerPosition).lengthSquared(); + final float dist1 = this.position.lengthSquaredTo(rendererSchematicChunk1.centerPosition); + final float dist2 = this.position.lengthSquaredTo(rendererSchematicChunk2.centerPosition); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } } - @Override - public int compare(Object obj1, Object obj2) { - return doCompare((RendererSchematicChunk) obj1, (RendererSchematicChunk) obj2); - } - public void setSchematic(SchematicWorld schematic) { this.schematic = schematic; this.schematicPosition.set(schematic.position.toVector3f()); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index caf4598a..236c01ef 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -26,7 +26,7 @@ public class RendererSchematicGlobal { private final Frustrum frustrum = new Frustrum(); public RenderBlocks renderBlocks = null; public final List sortedRendererSchematicChunk = new ArrayList(); - private final RendererSchematicChunkSorter rendererSchematicChunkSorter = new RendererSchematicChunkSorter(); + private final RendererSchematicChunkComparator rendererSchematicChunkComparator = new RendererSchematicChunkComparator(); private RendererSchematicGlobal() {} @@ -156,8 +156,8 @@ private void updateFrustrum(SchematicWorld schematic) { } private void sortAndUpdate(SchematicWorld schematic) { - this.rendererSchematicChunkSorter.setSchematic(schematic); - Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkSorter); + this.rendererSchematicChunkComparator.setSchematic(schematic); + Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkComparator); for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { if (rendererSchematicChunk.getDirty()) { From b1f7285fcc57654dac769b01c9f995995fb2b67c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 20 Nov 2014 08:57:47 +0100 Subject: [PATCH 104/314] Set the position before the sort instead of every call to compare. --- .../renderer/RendererSchematicChunkComparator.java | 12 +++++++----- .../client/renderer/RendererSchematicGlobal.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java index b78c30c7..fe057b09 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java @@ -9,7 +9,6 @@ public class RendererSchematicChunkComparator implements Comparator { private final Vector3f position = new Vector3f(); private final Vector3f schematicPosition = new Vector3f(); - private SchematicWorld schematic = null; @Override public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { @@ -18,15 +17,18 @@ public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchem } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { return 1; } else { - this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); final float dist1 = this.position.lengthSquaredTo(rendererSchematicChunk1.centerPosition); final float dist2 = this.position.lengthSquaredTo(rendererSchematicChunk2.centerPosition); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } } - public void setSchematic(SchematicWorld schematic) { - this.schematic = schematic; - this.schematicPosition.set(schematic.position.toVector3f()); + public void setPosition(SchematicWorld schematic) { + if (schematic == null) { + return; + } + + schematic.position.toVector3f(this.schematicPosition); + this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 236c01ef..a8f746ad 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -156,7 +156,7 @@ private void updateFrustrum(SchematicWorld schematic) { } private void sortAndUpdate(SchematicWorld schematic) { - this.rendererSchematicChunkComparator.setSchematic(schematic); + this.rendererSchematicChunkComparator.setPosition(schematic); Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkComparator); for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { From 91a77cc9f0625e69cf1209e4c5051f08e7be9ecf Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 20 Nov 2014 13:15:08 +0100 Subject: [PATCH 105/314] Set position not schematic... --- .../renderer/RendererSchematicChunkComparator.java | 11 +++-------- .../client/renderer/RendererSchematicGlobal.java | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java index fe057b09..cc411b0b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java @@ -1,8 +1,8 @@ package com.github.lunatrius.schematica.client.renderer; import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.world.SchematicWorld; import java.util.Comparator; @@ -23,12 +23,7 @@ public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchem } } - public void setPosition(SchematicWorld schematic) { - if (schematic == null) { - return; - } - - schematic.position.toVector3f(this.schematicPosition); - this.position.set(ClientProxy.playerPosition).sub(this.schematicPosition); + public void setPosition(Vector3i position) { + this.position.set(ClientProxy.playerPosition).sub(position.toVector3f(this.schematicPosition)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index a8f746ad..e7a73d12 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -156,7 +156,7 @@ private void updateFrustrum(SchematicWorld schematic) { } private void sortAndUpdate(SchematicWorld schematic) { - this.rendererSchematicChunkComparator.setPosition(schematic); + this.rendererSchematicChunkComparator.setPosition(schematic.position); Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkComparator); for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { From 5572e8fc455900ddbe8339f0c4ad107a3d5090a0 Mon Sep 17 00:00:00 2001 From: Steven Blom Date: Fri, 21 Nov 2014 00:07:55 +1030 Subject: [PATCH 106/314] Schematic saving chunk by chunk --- .../schematica/proxy/CommonProxy.java | 94 ++++++++++++++----- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 5bade0b4..6d7c0213 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -9,7 +10,9 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeChunkManager; import java.io.File; import java.util.ArrayList; @@ -41,6 +44,18 @@ public void resetSettings() { } public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i to) { + + //Forge dictates that it must be set, it will not be used here. + ForgeChunkManager.setForcedChunkLoadingCallback(Schematica.instance, new ForgeChunkManager.LoadingCallback() { + @Override + public void ticketsLoaded(List tickets, World world) + { + + } + }); + + ForgeChunkManager.Ticket ticket = null; + try { int minX = Math.min(from.x, to.x); int maxX = Math.max(from.x, to.x); @@ -48,6 +63,12 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i int maxY = Math.max(from.y, to.y); int minZ = Math.min(from.z, to.z); int maxZ = Math.max(from.z, to.z); + + int minChunkX = minX >> 4; + int maxChunkX = maxX >> 4; + int minChunkZ = minZ >> 4; + int maxChunkZ = maxZ >> 4; + short width = (short) (Math.abs(maxX - minX) + 1); short height = (short) (Math.abs(maxY - minY) + 1); short length = (short) (Math.abs(maxZ - minZ) + 1); @@ -56,36 +77,67 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i byte[][][] metadata = new byte[width][height][length]; List tileEntities = new ArrayList(); - for (int x = minX; x <= maxX; x++) { - for (int y = minY; y <= maxY; y++) { - for (int z = minZ; z <= maxZ; z++) { - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(world.getBlock(x, y, z)); - metadata[x - minX][y - minY][z - minZ] = (byte) world.getBlockMetadata(x, y, z); - - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity != null) { - try { - NBTTagCompound tileEntityNBT = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityNBT); - - tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); - tileEntity.xCoord -= minX; - tileEntity.yCoord -= minY; - tileEntity.zCoord -= minZ; - tileEntities.add(tileEntity); - } catch (Exception e) { - Reference.logger.error(String.format("Error while trying to save tile entity %s!", tileEntity), e); - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); - metadata[x - minX][y - minY][z - minZ] = 0; + if (!world.isRemote) { //Only do chunk loading on the server side. + ticket = ForgeChunkManager.requestTicket(Schematica.instance, world, ForgeChunkManager.Type.NORMAL); + if (ticket == null) { + Reference.logger.error("Unable to reserve a ticket to do chunk loading! Only a partial schematic may be created."); + } + } + + for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX++) { + for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ++) { + int localMinX = minX < (chunkX << 4) ? 0 : (minX & 15); + int localMaxX = maxX > ((chunkX << 4) + 15) ? 15 : (maxX & 15); + int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); + int localMaxZ = maxZ > ((chunkZ << 4) + 15) ? 15 : (maxZ & 15); + + if (ticket != null) { + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(chunkX, chunkZ)); + } + + for (int chunkLocalX = localMinX; chunkLocalX <= localMaxX; chunkLocalX++) { + for (int y = minY; y <= maxY; y++) { + for (int chunkLocalZ = localMinZ; chunkLocalZ <= localMaxZ; chunkLocalZ++) { + int x = chunkLocalX | (chunkX << 4); + int z = chunkLocalZ | (chunkZ << 4); + + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(world.getBlock(x, y, z)); + metadata[x - minX][y - minY][z - minZ] = (byte) world.getBlockMetadata(x, y, z); + + TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + try { + NBTTagCompound tileEntityNBT = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityNBT); + + tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); + tileEntity.xCoord -= minX; + tileEntity.yCoord -= minY; + tileEntity.zCoord -= minZ; + tileEntities.add(tileEntity); + } catch (Exception e) { + Reference.logger.error(String.format("Error while trying to save tile entity %s!", tileEntity), e); + blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); + metadata[x - minX][y - minY][z - minZ] = 0; + } + } } } } + + if (ticket != null) { + ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(chunkX, chunkZ)); + } } } return new SchematicWorld("", blocks, metadata, tileEntities, width, height, length); } catch (Exception e) { Reference.logger.error("Failed to extract schematic!", e); + } finally { + if (ticket != null) { + ForgeChunkManager.releaseTicket(ticket); + } } return null; From 5b810938b9c8afb320d4059bca447621ce3fac81 Mon Sep 17 00:00:00 2001 From: Steven Blom Date: Fri, 21 Nov 2014 00:33:32 +1030 Subject: [PATCH 107/314] Schematic saving chunk by chunk --- .../schematica/proxy/CommonProxy.java | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 6d7c0213..26df0c6f 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -44,18 +44,6 @@ public void resetSettings() { } public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i to) { - - //Forge dictates that it must be set, it will not be used here. - ForgeChunkManager.setForcedChunkLoadingCallback(Schematica.instance, new ForgeChunkManager.LoadingCallback() { - @Override - public void ticketsLoaded(List tickets, World world) - { - - } - }); - - ForgeChunkManager.Ticket ticket = null; - try { int minX = Math.min(from.x, to.x); int maxX = Math.max(from.x, to.x); @@ -77,13 +65,6 @@ public void ticketsLoaded(List tickets, World world) byte[][][] metadata = new byte[width][height][length]; List tileEntities = new ArrayList(); - if (!world.isRemote) { //Only do chunk loading on the server side. - ticket = ForgeChunkManager.requestTicket(Schematica.instance, world, ForgeChunkManager.Type.NORMAL); - if (ticket == null) { - Reference.logger.error("Unable to reserve a ticket to do chunk loading! Only a partial schematic may be created."); - } - } - for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX++) { for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ++) { int localMinX = minX < (chunkX << 4) ? 0 : (minX & 15); @@ -91,10 +72,6 @@ public void ticketsLoaded(List tickets, World world) int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); int localMaxZ = maxZ > ((chunkZ << 4) + 15) ? 15 : (maxZ & 15); - if (ticket != null) { - ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(chunkX, chunkZ)); - } - for (int chunkLocalX = localMinX; chunkLocalX <= localMaxX; chunkLocalX++) { for (int y = minY; y <= maxY; y++) { for (int chunkLocalZ = localMinZ; chunkLocalZ <= localMaxZ; chunkLocalZ++) { @@ -124,20 +101,12 @@ public void ticketsLoaded(List tickets, World world) } } } - - if (ticket != null) { - ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(chunkX, chunkZ)); - } } } return new SchematicWorld("", blocks, metadata, tileEntities, width, height, length); } catch (Exception e) { Reference.logger.error("Failed to extract schematic!", e); - } finally { - if (ticket != null) { - ForgeChunkManager.releaseTicket(ticket); - } } return null; From a0742438df11359b28a6ea22f5d975ada1293c78 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 20 Nov 2014 16:05:23 +0100 Subject: [PATCH 108/314] Bare bones of the server side schematic creation. --- .../message/MessageSchematicBegin.java | 24 +++++++++++++++++++ .../message/MessageSchematicChunk.java | 24 +++++++++++++++++++ .../network/message/MessageSchematicEnd.java | 24 +++++++++++++++++++ .../schematica/proxy/CommonProxy.java | 3 --- 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java new file mode 100644 index 00000000..3a33563a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java @@ -0,0 +1,24 @@ +package com.github.lunatrius.schematica.network.message; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +public class MessageSchematicBegin implements IMessage, IMessageHandler { + @Override + public void fromBytes(ByteBuf buf) { + // TODO: implement + } + + @Override + public void toBytes(ByteBuf buf) { + // TODO: implement + } + + @Override + public IMessage onMessage(MessageSchematicBegin message, MessageContext ctx) { + // TODO: implement + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java new file mode 100644 index 00000000..229498eb --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java @@ -0,0 +1,24 @@ +package com.github.lunatrius.schematica.network.message; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +public class MessageSchematicChunk implements IMessage, IMessageHandler { + @Override + public void fromBytes(ByteBuf buf) { + // TODO: implement + } + + @Override + public void toBytes(ByteBuf buf) { + // TODO: implement + } + + @Override + public IMessage onMessage(MessageSchematicChunk message, MessageContext ctx) { + // TODO: implement + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java new file mode 100644 index 00000000..6b594b5c --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java @@ -0,0 +1,24 @@ +package com.github.lunatrius.schematica.network.message; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; + +public class MessageSchematicEnd implements IMessage, IMessageHandler { + @Override + public void fromBytes(ByteBuf buf) { + // TODO: implement + } + + @Override + public void toBytes(ByteBuf buf) { + // TODO: implement + } + + @Override + public IMessage onMessage(MessageSchematicEnd message, MessageContext ctx) { + // TODO: implement + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 26df0c6f..8ab9cc6c 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,7 +1,6 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.vector.Vector3i; -import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -10,9 +9,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeChunkManager; import java.io.File; import java.util.ArrayList; From 1c77d94be9dbddbacf4353f66ed14ff15867c265 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 21 Nov 2014 10:12:38 +0100 Subject: [PATCH 109/314] Replaced client side only chunk provider and save handler with noop implementations. --- .../schematica/world/SchematicWorld.java | 8 +- .../world/chunk/ChunkProviderSchematic.java | 78 +++++++++++++++++++ .../world/storage/SaveHandlerSchematic.java | 55 +++++++++++++ 3 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java create mode 100644 src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index d075c0fc..462e6bcf 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -4,7 +4,9 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; +import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -13,7 +15,6 @@ import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockSlab; -import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -29,7 +30,6 @@ import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.storage.SaveHandlerMP; import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; @@ -64,7 +64,7 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { public SchematicWorld() { // TODO: revert if any issues arise - super(new SaveHandlerMP(), "Schematica", null, WORLD_SETTINGS, null); + super(new SaveHandlerSchematic(), "Schematica", null, WORLD_SETTINGS, null); this.icon = SchematicWorld.DEFAULT_ICON.copy(); this.blocks = null; this.metadata = null; @@ -297,7 +297,7 @@ public boolean extendedLevelsInChunkCache() { @Override protected IChunkProvider createChunkProvider() { - return new ChunkProviderClient(this); + return new ChunkProviderSchematic(this); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java new file mode 100644 index 00000000..1eb6e8b2 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java @@ -0,0 +1,78 @@ +package com.github.lunatrius.schematica.world.chunk; + +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.EmptyChunk; +import net.minecraft.world.chunk.IChunkProvider; + +import java.util.List; + +public class ChunkProviderSchematic implements IChunkProvider { + private Chunk emptyChunk; + + public ChunkProviderSchematic(World world) { + this.emptyChunk = new EmptyChunk(world, 0, 0); + } + + @Override + public boolean chunkExists(int x, int y) { + return true; + } + + @Override + public Chunk provideChunk(int x, int y) { + return this.emptyChunk; + } + + @Override + public Chunk loadChunk(int x, int y) { + return this.emptyChunk; + } + + @Override + public void populate(IChunkProvider provider, int x, int y) {} + + @Override + public boolean saveChunks(boolean saveExtra, IProgressUpdate progressUpdate) { + return true; + } + + @Override + public boolean unloadQueuedChunks() { + return false; + } + + @Override + public boolean canSave() { + return false; + } + + @Override + public String makeString() { + return "SchematicChunkCache"; + } + + @Override + public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { + return null; + } + + @Override + public ChunkPosition func_147416_a(World world, String name, int x, int y, int z) { + return null; + } + + @Override + public int getLoadedChunkCount() { + return 0; + } + + @Override + public void recreateStructures(int x, int y) {} + + @Override + public void saveExtraData() {} +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java new file mode 100644 index 00000000..9fe812b7 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java @@ -0,0 +1,55 @@ +package com.github.lunatrius.schematica.world.storage; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; +import net.minecraft.world.storage.IPlayerFileData; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +import java.io.File; + +public class SaveHandlerSchematic implements ISaveHandler { + @Override + public WorldInfo loadWorldInfo() { + return null; + } + + @Override + public void checkSessionLock() throws MinecraftException {} + + @Override + public IChunkLoader getChunkLoader(WorldProvider provider) { + return null; + } + + @Override + public void saveWorldInfoWithPlayer(WorldInfo info, NBTTagCompound compound) {} + + @Override + public void saveWorldInfo(WorldInfo info) {} + + @Override + public IPlayerFileData getSaveHandler() { + return null; + } + + @Override + public void flush() {} + + @Override + public File getWorldDirectory() { + return null; + } + + @Override + public File getMapFileFromName(String name) { + return null; + } + + @Override + public String getWorldDirectoryName() { + return null; + } +} From 800c295e1d3e6c81fb0dcf65975a7e29960533ee Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 21 Nov 2014 18:53:28 +0100 Subject: [PATCH 110/314] A simple read/write implementation for the schematic chunk messages. --- .../lunatrius/schematica/nbt/NBTHelper.java | 87 ++++++++++++++++++ .../message/MessageSchematicBegin.java | 22 ++++- .../message/MessageSchematicChunk.java | 92 ++++++++++++++++++- 3 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java new file mode 100644 index 00000000..bc1cfcb1 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -0,0 +1,87 @@ +package com.github.lunatrius.schematica.nbt; + +import com.github.lunatrius.schematica.reference.Names; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.Constants; + +import java.util.ArrayList; +import java.util.List; + +public class NBTHelper { + public static List readTileEntitiesFromCompound(final NBTTagCompound compound) { + return readTileEntitiesFromCompound(compound, new ArrayList()); + } + + public static List readTileEntitiesFromCompound(final NBTTagCompound compound, final List tileEntities) { + final NBTTagList tagList = compound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < tagList.tagCount(); i++) { + final NBTTagCompound tileEntityCompound = tagList.getCompoundTagAt(i); + final TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntityCompound); + tileEntities.add(tileEntity); + } + + return tileEntities; + } + + public static NBTTagCompound writeTileEntitiesToCompound(final List tileEntities) { + return writeTileEntitiesToCompound(tileEntities, new NBTTagCompound()); + } + + public static NBTTagCompound writeTileEntitiesToCompound(final List tileEntities, final NBTTagCompound compound) { + final NBTTagList tagList = new NBTTagList(); + for (TileEntity tileEntity : tileEntities) { + final NBTTagCompound tileEntityCompound = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityCompound); + tagList.appendTag(tileEntityCompound); + } + + compound.setTag(Names.NBT.TILE_ENTITIES, tagList); + + return compound; + } + + public static List readEntitiesFromCompound(final NBTTagCompound compound) { + return readEntitiesFromCompound(compound, null, new ArrayList()); + } + + public static List readEntitiesFromCompound(final NBTTagCompound compound, final World world) { + return readEntitiesFromCompound(compound, world, new ArrayList()); + } + + public static List readEntitiesFromCompound(final NBTTagCompound compound, final List entities) { + return readEntitiesFromCompound(compound, null, entities); + } + + public static List readEntitiesFromCompound(final NBTTagCompound compound, final World world, final List entities) { + final NBTTagList tagList = compound.getTagList(Names.NBT.ENTITIES, Constants.NBT.TAG_COMPOUND); + for (int i = 0; i < tagList.tagCount(); i++) { + final NBTTagCompound entityCompound = tagList.getCompoundTagAt(i); + final Entity entity = EntityList.createEntityFromNBT(entityCompound, world); + entities.add(entity); + } + + return entities; + } + + public static NBTTagCompound writeEntitiesToCompound(final List entities) { + return writeEntitiesToCompound(entities, new NBTTagCompound()); + } + + public static NBTTagCompound writeEntitiesToCompound(final List entities, final NBTTagCompound compound) { + final NBTTagList tagList = new NBTTagList(); + for (Entity entity : entities) { + final NBTTagCompound entityCompound = new NBTTagCompound(); + entity.writeToNBT(entityCompound); + tagList.appendTag(entityCompound); + } + + compound.setTag(Names.NBT.ENTITIES, tagList); + + return compound; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java index 3a33563a..729b25f5 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java @@ -1,19 +1,37 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; public class MessageSchematicBegin implements IMessage, IMessageHandler { + public int width; + public int height; + public int length; + + public MessageSchematicBegin() { + } + + public MessageSchematicBegin(SchematicWorld schematic) { + this.width = schematic.getWidth(); + this.height = schematic.getHeight(); + this.length = schematic.getLength(); + } + @Override public void fromBytes(ByteBuf buf) { - // TODO: implement + this.width = buf.readShort(); + this.height = buf.readShort(); + this.length = buf.readShort(); } @Override public void toBytes(ByteBuf buf) { - // TODO: implement + buf.writeShort(this.width); + buf.writeShort(this.height); + buf.writeShort(this.length); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java index 229498eb..c79d9808 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java @@ -1,19 +1,107 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.schematica.nbt.NBTHelper; +import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +import java.util.ArrayList; +import java.util.List; public class MessageSchematicChunk implements IMessage, IMessageHandler { + public static final int CHUNK_WIDTH = 16; + public static final int CHUNK_HEIGHT = 16; + public static final int CHUNK_LENGTH = 16; + + public int baseX; + public int baseY; + public int baseZ; + + public short blocks[][][]; + public byte metadata[][][]; + public List tileEntities; + public List entities; + + public MessageSchematicChunk() { + } + + public MessageSchematicChunk(SchematicWorld schematic, int baseX, int baseY, int baseZ) { + this.baseX = baseX; + this.baseY = baseY; + this.baseZ = baseZ; + + this.blocks = new short[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; + this.metadata = new byte[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; + this.tileEntities = new ArrayList(); + this.entities = new ArrayList(); + + for (int x = 0; x < CHUNK_WIDTH; x++) { + for (int y = 0; y < CHUNK_HEIGHT; y++) { + for (int z = 0; z < CHUNK_LENGTH; z++) { + this.blocks[x][y][z] = (short) schematic.getBlockIdRaw(baseX + x, baseY + y, baseZ + z); + this.metadata[x][y][z] = (byte) schematic.getBlockMetadata(baseX + x, baseY + y, baseZ + z); + final TileEntity tileEntity = schematic.getTileEntity(baseX + x, baseY + y, baseZ + z); + if (tileEntity != null) { + this.tileEntities.add(tileEntity); + } + } + } + } + } + @Override public void fromBytes(ByteBuf buf) { - // TODO: implement + this.baseX = buf.readShort(); + this.baseY = buf.readShort(); + this.baseZ = buf.readShort(); + + this.blocks = new short[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; + this.metadata = new byte[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; + this.tileEntities = new ArrayList(); + this.entities = new ArrayList(); + + for (int x = 0; x < CHUNK_WIDTH; x++) { + for (int y = 0; y < CHUNK_HEIGHT; y++) { + for (int z = 0; z < CHUNK_LENGTH; z++) { + this.blocks[x][y][z] = buf.readShort(); + this.metadata[x][y][z] = buf.readByte(); + } + } + } + + final NBTTagCompound compound = ByteBufUtils.readTag(buf); + this.tileEntities = NBTHelper.readTileEntitiesFromCompound(compound, this.tileEntities); + + final NBTTagCompound compound2 = ByteBufUtils.readTag(buf); + this.entities = NBTHelper.readEntitiesFromCompound(compound2, this.entities); } @Override public void toBytes(ByteBuf buf) { - // TODO: implement + buf.writeShort(this.baseX); + buf.writeShort(this.baseY); + buf.writeShort(this.baseZ); + + for (int x = 0; x < CHUNK_WIDTH; x++) { + for (int y = 0; y < CHUNK_HEIGHT; y++) { + for (int z = 0; z < CHUNK_LENGTH; z++) { + buf.writeShort(this.blocks[x][y][z]); + buf.writeByte(this.metadata[x][y][z]); + } + } + } + + final NBTTagCompound compound = NBTHelper.writeTileEntitiesToCompound(this.tileEntities); + ByteBufUtils.writeTag(buf, compound); + + final NBTTagCompound compound1 = NBTHelper.writeEntitiesToCompound(this.entities); + ByteBufUtils.writeTag(buf, compound1); } @Override From bc9013161c30f809a1859b02c79b4946fc5e00d5 Mon Sep 17 00:00:00 2001 From: Steven Blom Date: Tue, 25 Nov 2014 00:15:33 +1030 Subject: [PATCH 111/314] Command to save schematic on server - /schematicaSave --- .../lunatrius/schematica/Schematica.java | 7 ++ .../command/CommandSchematicaSave.java | 82 +++++++++++++++++++ .../schematica/proxy/ClientProxy.java | 26 ------ .../schematica/proxy/CommonProxy.java | 27 +++++- .../schematica/proxy/ServerProxy.java | 5 -- .../lunatrius/schematica/reference/Names.java | 13 +++ .../schematica/world/SchematicWorld.java | 2 +- .../assets/schematica/lang/en_US.lang | 6 ++ 8 files changed, 135 insertions(+), 33 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 4e974549..59452ebf 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica; import com.github.lunatrius.core.version.VersionChecker; +import com.github.lunatrius.schematica.command.CommandSchematicaSave; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.proxy.CommonProxy; @@ -12,6 +13,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY) public class Schematica { @@ -48,4 +50,9 @@ public void init(FMLInitializationEvent event) { @EventHandler public void postInit(FMLPostInitializationEvent event) { } + + @EventHandler + public void serverStarting(FMLServerStartingEvent event) { + event.registerServerCommand(new CommandSchematicaSave()); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java new file mode 100644 index 00000000..dc40bea3 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -0,0 +1,82 @@ +package com.github.lunatrius.schematica.command; + +import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; + +public class CommandSchematicaSave extends CommandBase { + @Override + public String getCommandName() { + return Names.Command.Save.NAME; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return StatCollector.translateToLocal(Names.Command.Save.Message.USAGE); + } + + @Override + public int getRequiredPermissionLevel() { + return 3; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender p_71519_1_) { + return true; + } + + @Override + public void processCommand(ICommandSender sender, String[] arguments) { + if (arguments.length < 7) { + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + return; + } + + if (!(sender instanceof EntityPlayer)) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYERS_ONLY)); + return; + } + + Vector3i from = new Vector3i(); + Vector3i to = new Vector3i(); + String filename; + String name; + + try { + from.set( + Integer.parseInt(arguments[0]), + Integer.parseInt(arguments[1]), + Integer.parseInt(arguments[2]) + ); + + to.set( + Integer.parseInt(arguments[3]), + Integer.parseInt(arguments[4]), + Integer.parseInt(arguments[5]) + ); + + name = arguments[6]; + filename = String.format("%s.schematic", name); + } catch (NumberFormatException exception) { + sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); + return; + } + + final EntityPlayer player = (EntityPlayer) sender; + Reference.logger.info(String.format("Saving schematic from %s to %s to %s", from, to, filename)); + try { + Schematica.proxy.saveSchematic(player, ConfigurationHandler.schematicDirectory, filename, player.getEntityWorld(), from, to); + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); + } catch (Exception e) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_FAILED, name)); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 0d9c7ebd..be1539f4 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -206,32 +206,6 @@ public void resetSettings() { updatePoints(); } - @Override - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { - try { - String iconName = ""; - - try { - String[] parts = filename.split(";"); - if (parts.length == 2) { - iconName = parts[0]; - filename = parts[1]; - } - } catch (Exception e) { - Reference.logger.error("Failed to parse icon data!", e); - } - - SchematicWorld schematic = getSchematicFromWorld(world, from, to); - schematic.setIcon(SchematicUtil.getIconFromName(iconName)); - SchematicFormat.writeToFile(directory, filename, schematic); - - return true; - } catch (Exception e) { - Reference.logger.error("Failed to save schematic!", e); - } - return false; - } - @Override public boolean loadSchematic(EntityPlayer player, File directory, String filename) { SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 8ab9cc6c..eac29de7 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -4,6 +4,8 @@ import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import cpw.mods.fml.common.registry.GameData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -109,7 +111,30 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i return null; } - public abstract boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to); + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { + try { + String iconName = ""; + + try { + String[] parts = filename.split(";"); + if (parts.length == 2) { + iconName = parts[0]; + filename = parts[1]; + } + } catch (Exception e) { + Reference.logger.error("Failed to parse icon data!", e); + } + + SchematicWorld schematic = getSchematicFromWorld(world, from, to); + schematic.setIcon(SchematicUtil.getIconFromName(iconName)); + SchematicFormat.writeToFile(directory, filename, schematic); + + return true; + } catch (Exception e) { + Reference.logger.error("Failed to save schematic!", e); + } + return false; + } public abstract boolean loadSchematic(EntityPlayer player, File directory, String filename); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 085ba2d1..6f483e83 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -37,11 +37,6 @@ public File getDataDirectory() { return file; } - @Override - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { - return false; - } - @Override public boolean loadSchematic(EntityPlayer player, File directory, String filename) { return false; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 4bae3404..eb4f13cc 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -61,6 +61,19 @@ public static final class Category { public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; } + public static final class Command { + public static final class Save { + public static final class Message { + public static final String USAGE = "schematica.command.save.usage"; + public static final String PLAYERS_ONLY = "schematica.command.save.playersOnly"; + public static final String SAVE_SUCCESSFUL = "schematica.command.save.saveSucceeded"; + public static final String SAVE_FAILED = "schematica.command.save.saveFailed"; + } + + public static final String NAME = "schematicaSave"; + } + } + public static final class ModId { public static final String MINECRAFT = "minecraft"; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 462e6bcf..cff0b1b2 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -64,7 +64,7 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { public SchematicWorld() { // TODO: revert if any issues arise - super(new SaveHandlerSchematic(), "Schematica", null, WORLD_SETTINGS, null); + super(new SaveHandlerSchematic(), "Schematica", WORLD_SETTINGS, null, null); this.icon = SchematicWorld.DEFAULT_ICON.copy(); this.blocks = null; this.metadata = null; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 177c512b..2199db75 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -99,3 +99,9 @@ schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic + +#commands +schematica.command.save.playersOnly=This command can only be sent by players. +schematica.command.save.usage=/schematicaSave +schematica.command.save.saveSucceeded=Successfully saved %s. +schematica.command.save.saveFailed=There was a problem saving the schematic %s. \ No newline at end of file From 76c33dc22e10d4530fa7c950e7063ca27694d9b6 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 24 Nov 2014 16:55:06 +0100 Subject: [PATCH 112/314] Fixed the config property descriptions. --- .../com/github/lunatrius/schematica/reference/Names.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index eb4f13cc..7b220e3d 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -52,11 +52,11 @@ public static final class Category { public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; public static final String PRINTER_ENABLED = "printerEnabled"; - public static final String PRINTER_ENABLED_DESC = "printerEnabled"; + public static final String PRINTER_ENABLED_DESC = "Allow players to use the printer."; public static final String SAVE_ENABLED = "saveEnabled"; - public static final String SAVE_ENABLED_DESC = "printerEnabled"; + public static final String SAVE_ENABLED_DESC = "Allow players to save schematics."; public static final String LOAD_ENABLED = "loadEnabled"; - public static final String LOAD_ENABLED_DESC = "printerEnabled"; + public static final String LOAD_ENABLED_DESC = "Allow players to load schematics."; public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; } From d9a1e401c2dffd6261d7c33a0eb184a034fdd8e5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 24 Nov 2014 16:56:35 +0100 Subject: [PATCH 113/314] Added @AtomicBlom to the credits/contributors. --- src/main/resources/mcmod.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 261f444a..70ec8eb9 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -10,7 +10,7 @@ "authorList": [ "Lunatrius" ], - "credits": "AbrarSyed, UltraMoogleMan", + "credits": "AbrarSyed, AtomicBlom, UltraMoogleMan", "dependants": [ ], "dependencies": [ "Forge@[${minforgeversion},)", "LunatriusCore@[${coreversion},)" ], "parent": "", From af2aa768717d031e723f103b418b989a7031dacc Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 24 Nov 2014 17:40:02 +0100 Subject: [PATCH 114/314] Removed the canCommandSenderUseCommand override to actually make use of the permission levels. --- .../command/CommandSchematicaSave.java | 29 ++++--------------- .../schematica/proxy/ServerProxy.java | 2 -- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index dc40bea3..a1f2c2b3 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -7,10 +7,9 @@ import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.StatCollector; public class CommandSchematicaSave extends CommandBase { @Override @@ -20,7 +19,7 @@ public String getCommandName() { @Override public String getCommandUsage(ICommandSender p_71518_1_) { - return StatCollector.translateToLocal(Names.Command.Save.Message.USAGE); + return Names.Command.Save.Message.USAGE; } @Override @@ -28,16 +27,10 @@ public int getRequiredPermissionLevel() { return 3; } - @Override - public boolean canCommandSenderUseCommand(ICommandSender p_71519_1_) { - return true; - } - @Override public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length < 7) { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - return; + throw new WrongUsageException(getCommandUsage(sender)); } if (!(sender instanceof EntityPlayer)) { @@ -51,23 +44,13 @@ public void processCommand(ICommandSender sender, String[] arguments) { String name; try { - from.set( - Integer.parseInt(arguments[0]), - Integer.parseInt(arguments[1]), - Integer.parseInt(arguments[2]) - ); - - to.set( - Integer.parseInt(arguments[3]), - Integer.parseInt(arguments[4]), - Integer.parseInt(arguments[5]) - ); + from.set(Integer.parseInt(arguments[0]), Integer.parseInt(arguments[1]), Integer.parseInt(arguments[2])); + to.set(Integer.parseInt(arguments[3]), Integer.parseInt(arguments[4]), Integer.parseInt(arguments[5])); name = arguments[6]; filename = String.format("%s.schematic", name); } catch (NumberFormatException exception) { - sender.addChatMessage(new ChatComponentText(getCommandUsage(sender))); - return; + throw new WrongUsageException(getCommandUsage(sender)); } final EntityPlayer player = (EntityPlayer) sender; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 6f483e83..ed1d026c 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,13 +1,11 @@ package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.handler.PlayerHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; -import net.minecraft.world.World; import java.io.File; import java.io.IOException; From 6f4c68b036de2bcfc5f1e5336b6fb3e8862df030 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 24 Nov 2014 17:44:13 +0100 Subject: [PATCH 115/314] Localization update. --- src/main/resources/assets/schematica/lang/ca_ES.lang | 6 ++++++ src/main/resources/assets/schematica/lang/cs_CZ.lang | 6 ++++++ src/main/resources/assets/schematica/lang/da_DK.lang | 6 ++++++ src/main/resources/assets/schematica/lang/de_DE.lang | 6 ++++++ src/main/resources/assets/schematica/lang/en_GB.lang | 6 ++++++ src/main/resources/assets/schematica/lang/en_PT.lang | 6 ++++++ src/main/resources/assets/schematica/lang/en_US.lang | 4 ++-- src/main/resources/assets/schematica/lang/es_ES.lang | 6 ++++++ src/main/resources/assets/schematica/lang/es_MX.lang | 6 ++++++ src/main/resources/assets/schematica/lang/fi_FI.lang | 6 ++++++ src/main/resources/assets/schematica/lang/fr_FR.lang | 6 ++++++ src/main/resources/assets/schematica/lang/hu_HU.lang | 6 ++++++ src/main/resources/assets/schematica/lang/it_IT.lang | 6 ++++++ src/main/resources/assets/schematica/lang/ko_KR.lang | 6 ++++++ src/main/resources/assets/schematica/lang/la_LA.lang | 6 ++++++ src/main/resources/assets/schematica/lang/lt_LT.lang | 6 ++++++ src/main/resources/assets/schematica/lang/nl_NL.lang | 6 ++++++ src/main/resources/assets/schematica/lang/no_NO.lang | 6 ++++++ src/main/resources/assets/schematica/lang/pl_PL.lang | 6 ++++++ src/main/resources/assets/schematica/lang/pt_PT.lang | 6 ++++++ src/main/resources/assets/schematica/lang/ru_RU.lang | 6 ++++++ src/main/resources/assets/schematica/lang/sk_SK.lang | 6 ++++++ src/main/resources/assets/schematica/lang/sl_SI.lang | 6 ++++++ src/main/resources/assets/schematica/lang/th_TH.lang | 6 ++++++ src/main/resources/assets/schematica/lang/tr_TR.lang | 6 ++++++ src/main/resources/assets/schematica/lang/uk_UA.lang | 6 ++++++ src/main/resources/assets/schematica/lang/zh_CN.lang | 6 ++++++ 27 files changed, 158 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index df89ac92..cad0d812 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Imprimir schematica.key.load=Carregar esquema schematica.key.save=Guardar esquema schematica.key.control=Manipular esquema + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 11449266..8e445b25 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Tiskárna schematica.key.load=Načíst schéma schematica.key.save=Uložit schéma schematica.key.control=Manipulovat se schématem + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 2a94b319..285f6b16 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -99,3 +99,9 @@ schematica.gui.materialamount=Antal schematica.key.load=Åbn schematic schematica.key.save=Gem schematic schematica.key.control=Manipulér schematic + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 232c09c4..3c46d8a3 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Drucker schematica.key.load=Schematic laden schematica.key.save=Schematic speichern schematica.key.control=Schematic verändern + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 3d750a1a..361c31f4 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -99,3 +99,9 @@ schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 8371aac7..da65f977 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Printing thing schematica.key.load=Load yer blueprint schematica.key.save=Keep yer blueprint schematica.key.control=Change yer blueprint + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 2199db75..9cbd6676 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -100,8 +100,8 @@ schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic -#commands +# commands - save schematica.command.save.playersOnly=This command can only be sent by players. schematica.command.save.usage=/schematicaSave schematica.command.save.saveSucceeded=Successfully saved %s. -schematica.command.save.saveFailed=There was a problem saving the schematic %s. \ No newline at end of file +schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index cefc24f0..7504e173 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Impresora schematica.key.load=Cargar esquema schematica.key.save=Guardar esquema schematica.key.control=Editar esquema + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 7f0565ae..c43a5940 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -99,3 +99,9 @@ schematica.gui.materialamount=Cantidad schematica.key.load=Cargar esquema schematica.key.save=Guardar esquema schematica.key.control=Manipular esquema + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 643ee576..a99906c4 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Tulostin schematica.key.load=Lataa kaava schematica.key.save=Tallenna kaava schematica.key.control=Käsittele kaavaa + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 32a1cf51..50538be4 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Mode imprimante schematica.key.load=Charger un schematic schematica.key.save=Enregistrer le schematic schematica.key.control=Manipuler le schematic + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index ee47aecb..0341a103 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Nyomtató schematica.key.load=Klisé betöltése schematica.key.save=Klisé mentése schematica.key.control=Klisé módosítása + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 67d9b574..e84ab62a 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -99,3 +99,9 @@ schematica.gui.materialamount=Quantità schematica.key.load=Carica schematica schematica.key.save=Salva schematica schematica.key.control=Manipola schematica + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index cdbb2b14..943d5b40 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -99,3 +99,9 @@ schematica.key.category=Schematica schematica.key.load=Schematic 불러오기 schematica.key.save=Schematic 저장 schematica.key.control=Schematic 조작 + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index a1cb8e79..acaca937 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -99,3 +99,9 @@ schematica.gui.materialamount=Numerus # schematica.key.load=Load schematic # schematica.key.save=Save schematic # schematica.key.control=Manipulate schematic + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 4ccaba40..58c40899 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -99,3 +99,9 @@ schematica.gui.materialamount=Kiekis schematica.key.load=Atidaryti schemà schematica.key.save=Iðsaugoti schemà schematica.key.control=Manipuliuoti schemà + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 9fdd0b2e..80953237 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -99,3 +99,9 @@ schematica.gui.materialamount=Hoeveelheid schematica.key.load=Laad schematic schematica.key.save=Sla schematic op schematica.key.control=Bewerk schematic + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 8647c557..75b902be 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -99,3 +99,9 @@ schematica.key.category=Schematica schematica.key.load=Last tegning schematica.key.save=Lagre tegning schematica.key.control=Manipuler tegning + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index ff958d9f..bc64fb38 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Drukarka schematica.key.load=Ladowanie schematu schematica.key.save=Zapisywanie schematu schematica.key.control=Manipulacja schematem + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 04633618..b106f1e1 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Modo de construçăo automática schematica.key.load=Carregar schematica schematica.key.save=Guardar schematica schematica.key.control=Manipular schematica + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 063e8b20..39939f5c 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -99,3 +99,9 @@ schematica.key.category=Schematica schematica.key.load=Загрузить схему schematica.key.save=Сохранить схему schematica.key.control=Манипулирование схемой + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index d58e4b65..a3c2935d 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Tlačiareň schematica.key.load=Načítať schému schematica.key.save=Uložiť schému schematica.key.control=Manipulovať so schémou + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index fb75dc77..b6218722 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Tiskalnik schematica.key.load=Naloži shemo schematica.key.save=Shrani shemo schematica.key.control=Manipuliraj shemo + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 152fe02c..d890ddd6 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -99,3 +99,9 @@ schematica.gui.printer=การปริ๊น schematica.key.load=เปิดไฟล์ Schematic schematica.key.save=บันทึกไฟล์ Schematic schematica.key.control=จัดการ Schematic + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index fe04de00..88bc1346 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Yazıcı schematica.key.load=Şematiki yükle schematica.key.save=Şematiki kaydet schematica.key.control=Şematiki işleyin + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 6636e332..bb3d4cbc 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -99,3 +99,9 @@ schematica.gui.printer=Принтер schematica.key.load=завантажити технологічну схему schematica.key.save=Зберегти технологічну схему schematica.key.control=маніпулювати технологічною схемою схемою + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 1e4fe49e..2531500a 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -99,3 +99,9 @@ schematica.gui.printer=投影 schematica.key.load=载入Schematic文件 schematica.key.save=保存Schematic文件 schematica.key.control=调整Schematic文件 + +# commands - save +# schematica.command.save.playersOnly=This command can only be sent by players. +# schematica.command.save.usage=/schematicaSave +# schematica.command.save.saveSucceeded=Successfully saved %s. +# schematica.command.save.saveFailed=There was a problem saving the schematic %s. From 2100bdf0fe2957a9d3c4ca124ff006da94573165 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 25 Nov 2014 12:00:00 +0100 Subject: [PATCH 116/314] Made the mod optional on both sides. --- .../java/com/github/lunatrius/schematica/Schematica.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 59452ebf..8bea15f2 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -14,6 +14,10 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.network.NetworkCheckHandler; +import cpw.mods.fml.relauncher.Side; + +import java.util.Map; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY) public class Schematica { @@ -23,6 +27,11 @@ public class Schematica { @SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT) public static CommonProxy proxy; + @NetworkCheckHandler + public boolean checkModList(Map versions, Side side) { + return true; + } + @EventHandler public void preInit(FMLPreInitializationEvent event) { Reference.logger = event.getModLog(); From f1e9ebee75672b35a9c491aee4bd7b5e58a2c771 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 25 Nov 2014 13:32:25 +0100 Subject: [PATCH 117/314] Updated the core. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index da5b8c05..fd9a6d61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ version_micro=3 version_minecraft=1.7.10 version_forge=10.13.2.1230 version_minforge=10.13.0.1185 -version_lunatriuscore=1.1.2.14 +version_lunatriuscore=1.1.2.16 extra_modsio_id=1008 extra_curseforge_id=225603 From b24ea777ca27a17a734ab835e247f6dfb7991ce1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 25 Nov 2014 20:34:37 +0100 Subject: [PATCH 118/314] Set blocks individually instead of setting them in bulk. --- .../lunatrius/schematica/nbt/NBTHelper.java | 24 +++++++ .../schematica/nbt/TileEntityException.java | 9 +++ .../schematica/proxy/ClientProxy.java | 2 - .../schematica/proxy/CommonProxy.java | 45 +++++------- .../schematica/world/SchematicWorld.java | 70 +++++++++++++++---- 5 files changed, 110 insertions(+), 40 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index bc1cfcb1..5c8f8789 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -84,4 +84,28 @@ public static NBTTagCompound writeEntitiesToCompound(final List entities return compound; } + + public static TileEntity reloadTileEntity(TileEntity tileEntity) throws TileEntityException { + return reloadTileEntity(tileEntity, 0, 0, 0); + } + + public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, int offsetY, int offsetZ) throws TileEntityException { + if (tileEntity == null) { + return null; + } + + try { + NBTTagCompound tileEntityCompound = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityCompound); + + tileEntity = TileEntity.createAndLoadEntity(tileEntityCompound); + tileEntity.xCoord -= offsetX; + tileEntity.yCoord -= offsetY; + tileEntity.zCoord -= offsetZ; + } catch (Exception e) { + throw new TileEntityException(tileEntity, e); + } + + return tileEntity; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java b/src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java new file mode 100644 index 00000000..e7c0451b --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java @@ -0,0 +1,9 @@ +package com.github.lunatrius.schematica.nbt; + +import net.minecraft.tileentity.TileEntity; + +public class TileEntityException extends Exception { + public TileEntityException(TileEntity tileEntity, Throwable cause) { + super(String.valueOf(tileEntity), cause); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index be1539f4..c0eb9f97 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -13,7 +13,6 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; -import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import cpw.mods.fml.client.config.GuiConfigEntries; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; @@ -22,7 +21,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index eac29de7..2ebd2668 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -2,20 +2,19 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.nbt.NBTHelper; +import com.github.lunatrius.schematica.nbt.TileEntityException; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; -import cpw.mods.fml.common.registry.GameData; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import java.io.File; -import java.util.ArrayList; -import java.util.List; public abstract class CommonProxy { public boolean isSaveEnabled = true; @@ -60,9 +59,7 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i short height = (short) (Math.abs(maxY - minY) + 1); short length = (short) (Math.abs(maxZ - minZ) + 1); - short[][][] blocks = new short[width][height][length]; - byte[][][] metadata = new byte[width][height][length]; - List tileEntities = new ArrayList(); + final SchematicWorld schematic = new SchematicWorld("", width, height, length); for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX++) { for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ++) { @@ -77,24 +74,20 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i int x = chunkLocalX | (chunkX << 4); int z = chunkLocalZ | (chunkZ << 4); - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(world.getBlock(x, y, z)); - metadata[x - minX][y - minY][z - minZ] = (byte) world.getBlockMetadata(x, y, z); - - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity != null) { - try { - NBTTagCompound tileEntityNBT = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityNBT); - - tileEntity = TileEntity.createAndLoadEntity(tileEntityNBT); - tileEntity.xCoord -= minX; - tileEntity.yCoord -= minY; - tileEntity.zCoord -= minZ; - tileEntities.add(tileEntity); - } catch (Exception e) { - Reference.logger.error(String.format("Error while trying to save tile entity %s!", tileEntity), e); - blocks[x - minX][y - minY][z - minZ] = (short) GameData.getBlockRegistry().getId(Blocks.bedrock); - metadata[x - minX][y - minY][z - minZ] = 0; + final Block block = world.getBlock(x, y, z); + final int metadata = world.getBlockMetadata(x, y, z); + final boolean success = schematic.setBlock(x - minX, y - minY, z - minZ, block, metadata); + + if (success && block.hasTileEntity(metadata)) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + try { + final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); + schematic.setTileEntity(x - minX, y - minY, z - minZ, reloadedTileEntity); + } catch (TileEntityException e) { + Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), e); + schematic.setBlock(x - minX, y - minY, z - minZ, Blocks.bedrock); + } } } } @@ -103,7 +96,7 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i } } - return new SchematicWorld("", blocks, metadata, tileEntities, width, height, length); + return schematic; } catch (Exception e) { Reference.logger.error("Failed to extract schematic!", e); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index cff0b1b2..1ab27cbb 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -7,6 +7,8 @@ import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -35,10 +37,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.Iterator; import java.util.List; public class SchematicWorld extends World { - // private static final AnvilSaveHandler SAVE_HANDLER = new AnvilSaveHandler(Minecraft.getMinecraft().mcDataDir, "tmp/schematica", false); + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); private static final Comparator BLOCK_COMPARATOR = new Comparator() { @Override @@ -55,23 +58,22 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { private final List tileEntities = new ArrayList(); private final List blockList = new ArrayList(); private short width; - private short length; private short height; + private short length; public final Vector3i position = new Vector3i(); public boolean isRendering; public int renderingLayer; public SchematicWorld() { - // TODO: revert if any issues arise super(new SaveHandlerSchematic(), "Schematica", WORLD_SETTINGS, null, null); this.icon = SchematicWorld.DEFAULT_ICON.copy(); this.blocks = null; this.metadata = null; this.tileEntities.clear(); this.width = 0; - this.length = 0; this.height = 0; + this.length = 0; this.isRendering = false; this.renderingLayer = -1; @@ -82,12 +84,12 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L this.icon = icon != null ? icon : SchematicWorld.DEFAULT_ICON.copy(); - this.blocks = blocks.clone(); - this.metadata = metadata.clone(); + this.blocks = blocks != null ? blocks.clone() : new short[width][height][length]; + this.metadata = metadata != null ? metadata.clone() : new byte[width][height][length]; this.width = width; - this.length = length; this.height = height; + this.length = length; if (tileEntities != null) { this.tileEntities.addAll(tileEntities); @@ -102,11 +104,13 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L } } - generateBlockList(); + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { + generateBlockList(); + } } - public SchematicWorld(String iconName, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { - this(SchematicUtil.getIconFromName(iconName), blocks, metadata, tileEntities, width, height, length); + public SchematicWorld(String iconName, short width, short height, short length) { + this(SchematicUtil.getIconFromName(iconName), null, null, null, width, height, length); } private void generateBlockList() { @@ -208,12 +212,32 @@ private int getBlockId(int x, int y, int z) { } public Block getBlockRaw(int x, int y, int z) { - return GameData.getBlockRegistry().getObjectById(getBlockIdRaw(x, y, z)); + return BLOCK_REGISTRY.getObjectById(getBlockIdRaw(x, y, z)); } @Override public Block getBlock(int x, int y, int z) { - return GameData.getBlockRegistry().getObjectById(getBlockId(x, y, z)); + return BLOCK_REGISTRY.getObjectById(getBlockId(x, y, z)); + } + + public boolean setBlock(int x, int y, int z, Block block, int metadata) { + return setBlock(x, y, z, block, metadata, 0); + } + + @Override + public boolean setBlock(int x, int y, int z, Block block, int metadata, int flags) { + if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { + return false; + } + + final int id = BLOCK_REGISTRY.getId(block); + if (id == -1) { + return false; + } + + this.blocks[x][y][z] = (short) id; + this.metadata[x][y][z] = (byte) metadata; + return true; } @Override @@ -226,6 +250,28 @@ public TileEntity getTileEntity(int x, int y, int z) { return null; } + @Override + public void setTileEntity(int x, int y, int z, TileEntity tileEntity) { + if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { + return; + } + + removeTileEntity(x, y, z); + + this.tileEntities.add(tileEntity); + } + + @Override + public void removeTileEntity(int x, int y, int z) { + final Iterator iterator = this.tileEntities.iterator(); + while (iterator.hasNext()) { + final TileEntity tileEntity = iterator.next(); + if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { + iterator.remove(); + } + } + } + @SideOnly(Side.CLIENT) @Override public int getSkyBlockTypeBrightness(EnumSkyBlock skyBlock, int x, int y, int z) { From aece62dbbff6a4198b317e9f75641d513585e9bb Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 25 Nov 2014 20:57:04 +0100 Subject: [PATCH 119/314] Extracted chunk-wise code in preparation for scheduled/delayed schematic creation. --- .../schematica/proxy/CommonProxy.java | 70 +++++++++++-------- .../schematica/world/SchematicWorld.java | 5 +- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 2ebd2668..f783ed6e 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -59,40 +59,11 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i short height = (short) (Math.abs(maxY - minY) + 1); short length = (short) (Math.abs(maxZ - minZ) + 1); - final SchematicWorld schematic = new SchematicWorld("", width, height, length); + final SchematicWorld schematic = new SchematicWorld(null, width, height, length); for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX++) { for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ++) { - int localMinX = minX < (chunkX << 4) ? 0 : (minX & 15); - int localMaxX = maxX > ((chunkX << 4) + 15) ? 15 : (maxX & 15); - int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); - int localMaxZ = maxZ > ((chunkZ << 4) + 15) ? 15 : (maxZ & 15); - - for (int chunkLocalX = localMinX; chunkLocalX <= localMaxX; chunkLocalX++) { - for (int y = minY; y <= maxY; y++) { - for (int chunkLocalZ = localMinZ; chunkLocalZ <= localMaxZ; chunkLocalZ++) { - int x = chunkLocalX | (chunkX << 4); - int z = chunkLocalZ | (chunkZ << 4); - - final Block block = world.getBlock(x, y, z); - final int metadata = world.getBlockMetadata(x, y, z); - final boolean success = schematic.setBlock(x - minX, y - minY, z - minZ, block, metadata); - - if (success && block.hasTileEntity(metadata)) { - final TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity != null) { - try { - final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); - schematic.setTileEntity(x - minX, y - minY, z - minZ, reloadedTileEntity); - } catch (TileEntityException e) { - Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), e); - schematic.setBlock(x - minX, y - minY, z - minZ, Blocks.bedrock); - } - } - } - } - } - } + copyChunkToSchematic(schematic, world, chunkX, chunkZ, minX, maxX, minY, maxY, minZ, maxZ); } } @@ -104,6 +75,43 @@ public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i return null; } + protected void copyChunkToSchematic(final SchematicWorld schematic, final World world, final int chunkX, final int chunkZ, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { + final int localMinX = minX < (chunkX << 4) ? 0 : (minX & 15); + final int localMaxX = maxX > ((chunkX << 4) + 15) ? 15 : (maxX & 15); + final int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); + final int localMaxZ = maxZ > ((chunkZ << 4) + 15) ? 15 : (maxZ & 15); + + for (int chunkLocalX = localMinX; chunkLocalX <= localMaxX; chunkLocalX++) { + for (int chunkLocalZ = localMinZ; chunkLocalZ <= localMaxZ; chunkLocalZ++) { + for (int y = minY; y <= maxY; y++) { + final int x = chunkLocalX | (chunkX << 4); + final int z = chunkLocalZ | (chunkZ << 4); + + final int localX = x - minX; + final int localY = y - minY; + final int localZ = z - minZ; + + final Block block = world.getBlock(x, y, z); + final int metadata = world.getBlockMetadata(x, y, z); + final boolean success = schematic.setBlock(localX, localY, localZ, block, metadata); + + if (success && block.hasTileEntity(metadata)) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + try { + final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); + schematic.setTileEntity(localX, localY, localZ, reloadedTileEntity); + } catch (TileEntityException e) { + Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), e); + schematic.setBlock(localX, localY, localZ, Blocks.bedrock); + } + } + } + } + } + } + } + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { try { String iconName = ""; diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 1ab27cbb..46fca59e 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -5,7 +5,6 @@ import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; -import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; @@ -109,8 +108,8 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L } } - public SchematicWorld(String iconName, short width, short height, short length) { - this(SchematicUtil.getIconFromName(iconName), null, null, null, width, height, length); + public SchematicWorld(ItemStack icon, short width, short height, short length) { + this(icon, null, null, null, width, height, length); } private void generateBlockList() { From 255688b2115b20c832b20fbef1bc0c58e6f19d22 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 26 Nov 2014 17:27:03 +0100 Subject: [PATCH 120/314] Simplified the proxy classes. --- .../lunatrius/schematica/Schematica.java | 25 +++------------ .../schematica/proxy/ClientProxy.java | 31 ++++++++++++------- .../schematica/proxy/CommonProxy.java | 25 +++++++++++++-- .../schematica/proxy/ServerProxy.java | 11 ++----- 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 8bea15f2..1dc10e65 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -1,9 +1,5 @@ package com.github.lunatrius.schematica; -import com.github.lunatrius.core.version.VersionChecker; -import com.github.lunatrius.schematica.command.CommandSchematicaSave; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.proxy.CommonProxy; import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.Mod; @@ -34,34 +30,21 @@ public boolean checkModList(Map versions, Side side) { @EventHandler public void preInit(FMLPreInitializationEvent event) { - Reference.logger = event.getModLog(); - ConfigurationHandler.init(event.getSuggestedConfigurationFile()); - proxy.setConfigEntryClasses(); - - proxy.registerKeybindings(); - proxy.createFolders(); - - VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); + proxy.preInit(event); } @EventHandler public void init(FMLInitializationEvent event) { - PacketHandler.init(); - - try { - proxy.registerEvents(); - } catch (Exception e) { - Reference.logger.fatal("Could not initialize the mod!", e); - throw new RuntimeException(e); - } + proxy.init(event); } @EventHandler public void postInit(FMLPostInitializationEvent event) { + proxy.postInit(event); } @EventHandler public void serverStarting(FMLServerStartingEvent event) { - event.registerServerCommand(new CommandSchematicaSave()); + proxy.serverStarting(event); } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index c0eb9f97..5289be71 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -16,12 +16,15 @@ import cpw.mods.fml.client.config.GuiConfigEntries; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.config.Property; import net.minecraftforge.common.util.ForgeDirection; import java.io.File; @@ -144,24 +147,30 @@ public static void moveSchematicToPlayer(SchematicWorld schematic) { } @Override - public void setConfigEntryClasses() { - ConfigurationHandler.propAlpha.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propBlockDelta.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propPlaceDelay.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propTimeout.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propTooltipX.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - ConfigurationHandler.propTooltipY.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); - } + public void preInit(FMLPreInitializationEvent event) { + super.preInit(event); + + final Property[] sliders = { + ConfigurationHandler.propAlpha, + ConfigurationHandler.propBlockDelta, + ConfigurationHandler.propPlaceDelay, + ConfigurationHandler.propTimeout, + ConfigurationHandler.propTooltipX, + ConfigurationHandler.propTooltipY + }; + for (Property prop : sliders) { + prop.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); + } - @Override - public void registerKeybindings() { for (KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) { ClientRegistry.registerKeyBinding(keyBinding); } } @Override - public void registerEvents() { + public void init(FMLInitializationEvent event) { + super.init(event); + FMLCommonHandler.instance().bus().register(KeyInputHandler.INSTANCE); FMLCommonHandler.instance().bus().register(TickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index f783ed6e..fa8baa53 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,13 +1,20 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.core.version.VersionChecker; +import com.github.lunatrius.schematica.command.CommandSchematicaSave; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.nbt.TileEntityException; +import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -20,11 +27,23 @@ public abstract class CommonProxy { public boolean isSaveEnabled = true; public boolean isLoadEnabled = true; - public abstract void setConfigEntryClasses(); + public void preInit(FMLPreInitializationEvent event) { + Reference.logger = event.getModLog(); + ConfigurationHandler.init(event.getSuggestedConfigurationFile()); - public abstract void registerKeybindings(); + VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); + } + + public void init(FMLInitializationEvent event) { + PacketHandler.init(); + } - public abstract void registerEvents(); + public void postInit(FMLPostInitializationEvent event) { + } + + public void serverStarting(FMLServerStartingEvent event) { + event.registerServerCommand(new CommandSchematicaSave()); + } public void createFolders() { if (!ConfigurationHandler.schematicDirectory.exists()) { diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index ed1d026c..15b88094 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -4,6 +4,7 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.event.FMLInitializationEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; @@ -12,15 +13,9 @@ public class ServerProxy extends CommonProxy { @Override - public void setConfigEntryClasses() { - } + public void init(FMLInitializationEvent event) { + super.init(event); - @Override - public void registerKeybindings() { - } - - @Override - public void registerEvents() { FMLCommonHandler.instance().bus().register(PlayerHandler.INSTANCE); } From 9459fd41bc6c886ccd0d6023e97b31cdb76c4717 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 26 Nov 2014 20:36:18 +0100 Subject: [PATCH 121/314] Added queued schematic saving. This will prevent the client/server from freezing when saving a schematic. --- .../client/gui/GuiSchematicSave.java | 2 +- .../schematica/handler/QueueTickHandler.java | 52 +++++++++++ .../schematica/proxy/CommonProxy.java | 89 ++++++++----------- .../lunatrius/schematica/reference/Names.java | 1 + .../world/chunk/SchematicContainer.java | 82 +++++++++++++++++ .../assets/schematica/lang/en_US.lang | 3 +- 6 files changed, 175 insertions(+), 54 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java create mode 100644 src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index c715a216..42eb7ca2 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -217,7 +217,7 @@ protected void actionPerformed(GuiButton guiButton) { this.btnSave.enabled = ClientProxy.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; - if (Schematica.proxy.saveSchematic(null, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { + if (Schematica.proxy.saveSchematic(this.mc.thePlayer, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { this.filename = ""; this.tfFilename.setText(this.filename); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java new file mode 100644 index 00000000..3acbf545 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -0,0 +1,52 @@ +package com.github.lunatrius.schematica.handler; + +import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.world.chunk.SchematicContainer; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import net.minecraft.util.ChatComponentTranslation; + +import java.util.ArrayDeque; +import java.util.Queue; + +public class QueueTickHandler { + public static final QueueTickHandler INSTANCE = new QueueTickHandler(); + + private final Queue queue = new ArrayDeque(); + + private QueueTickHandler() {} + + @SubscribeEvent + public void onServerTick(TickEvent.ServerTickEvent event) { + if (this.queue.size() == 0) { + return; + } + + final SchematicContainer container = this.queue.poll(); + if (container == null) { + return; + } + + if (container.hasNext()) { + if (container.isFirst()) { + final ChatComponentTranslation chatComponent = new ChatComponentTranslation(Names.Command.Save.Message.SAVE_STARTED, container.chunkCount, container.file.getName()); + container.player.addChatMessage(chatComponent); + } + + container.next(); + } + + if (container.hasNext()) { + this.queue.offer(container); + } else { + final boolean success = SchematicFormat.writeToFile(container.file, container.schematic); + final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; + container.player.addChatMessage(new ChatComponentTranslation(message, container.file.getName())); + } + } + + public void queueSchematic(SchematicContainer container) { + this.queue.offer(container); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index fa8baa53..db00030c 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -4,13 +4,15 @@ import com.github.lunatrius.core.version.VersionChecker; import com.github.lunatrius.schematica.command.CommandSchematicaSave; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.handler.QueueTickHandler; import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.nbt.TileEntityException; import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import com.github.lunatrius.schematica.world.chunk.SchematicContainer; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @@ -36,6 +38,8 @@ public void preInit(FMLPreInitializationEvent event) { public void init(FMLInitializationEvent event) { PacketHandler.init(); + + FMLCommonHandler.instance().bus().register(QueueTickHandler.INSTANCE); } public void postInit(FMLPostInitializationEvent event) { @@ -60,41 +64,7 @@ public void resetSettings() { this.isLoadEnabled = true; } - public SchematicWorld getSchematicFromWorld(World world, Vector3i from, Vector3i to) { - try { - int minX = Math.min(from.x, to.x); - int maxX = Math.max(from.x, to.x); - int minY = Math.min(from.y, to.y); - int maxY = Math.max(from.y, to.y); - int minZ = Math.min(from.z, to.z); - int maxZ = Math.max(from.z, to.z); - - int minChunkX = minX >> 4; - int maxChunkX = maxX >> 4; - int minChunkZ = minZ >> 4; - int maxChunkZ = maxZ >> 4; - - short width = (short) (Math.abs(maxX - minX) + 1); - short height = (short) (Math.abs(maxY - minY) + 1); - short length = (short) (Math.abs(maxZ - minZ) + 1); - - final SchematicWorld schematic = new SchematicWorld(null, width, height, length); - - for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX++) { - for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ++) { - copyChunkToSchematic(schematic, world, chunkX, chunkZ, minX, maxX, minY, maxY, minZ, maxZ); - } - } - - return schematic; - } catch (Exception e) { - Reference.logger.error("Failed to extract schematic!", e); - } - - return null; - } - - protected void copyChunkToSchematic(final SchematicWorld schematic, final World world, final int chunkX, final int chunkZ, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { + public void copyChunkToSchematic(final SchematicWorld schematic, final World world, final int chunkX, final int chunkZ, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { final int localMinX = minX < (chunkX << 4) ? 0 : (minX & 15); final int localMaxX = maxX > ((chunkX << 4) + 15) ? 15 : (maxX & 15); final int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); @@ -110,21 +80,25 @@ protected void copyChunkToSchematic(final SchematicWorld schematic, final World final int localY = y - minY; final int localZ = z - minZ; - final Block block = world.getBlock(x, y, z); - final int metadata = world.getBlockMetadata(x, y, z); - final boolean success = schematic.setBlock(localX, localY, localZ, block, metadata); - - if (success && block.hasTileEntity(metadata)) { - final TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity != null) { - try { - final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); - schematic.setTileEntity(localX, localY, localZ, reloadedTileEntity); - } catch (TileEntityException e) { - Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), e); - schematic.setBlock(localX, localY, localZ, Blocks.bedrock); + try { + final Block block = world.getBlock(x, y, z); + final int metadata = world.getBlockMetadata(x, y, z); + final boolean success = schematic.setBlock(localX, localY, localZ, block, metadata); + + if (success && block.hasTileEntity(metadata)) { + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (tileEntity != null) { + try { + final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); + schematic.setTileEntity(localX, localY, localZ, reloadedTileEntity); + } catch (TileEntityException tee) { + Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), tee); + schematic.setBlock(localX, localY, localZ, Blocks.bedrock); + } } } + } catch (Exception e) { + Reference.logger.error("Something went wrong!", e); } } } @@ -145,9 +119,20 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam Reference.logger.error("Failed to parse icon data!", e); } - SchematicWorld schematic = getSchematicFromWorld(world, from, to); - schematic.setIcon(SchematicUtil.getIconFromName(iconName)); - SchematicFormat.writeToFile(directory, filename, schematic); + final int minX = Math.min(from.x, to.x); + final int maxX = Math.max(from.x, to.x); + final int minY = Math.min(from.y, to.y); + final int maxY = Math.max(from.y, to.y); + final int minZ = Math.min(from.z, to.z); + final int maxZ = Math.max(from.z, to.z); + + final short width = (short) (Math.abs(maxX - minX) + 1); + final short height = (short) (Math.abs(maxY - minY) + 1); + final short length = (short) (Math.abs(maxZ - minZ) + 1); + + final SchematicWorld schematic = new SchematicWorld(SchematicUtil.getIconFromName(iconName), width, height, length); + final SchematicContainer container = new SchematicContainer(schematic, player, world, new File(directory, filename), minX, maxX, minY, maxY, minZ, maxZ); + QueueTickHandler.INSTANCE.queueSchematic(container); return true; } catch (Exception e) { diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 7b220e3d..5fff4f73 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -66,6 +66,7 @@ public static final class Save { public static final class Message { public static final String USAGE = "schematica.command.save.usage"; public static final String PLAYERS_ONLY = "schematica.command.save.playersOnly"; + public static final String SAVE_STARTED = "schematica.command.save.started"; public static final String SAVE_SUCCESSFUL = "schematica.command.save.saveSucceeded"; public static final String SAVE_FAILED = "schematica.command.save.saveFailed"; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java new file mode 100644 index 00000000..a1fb6c1a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java @@ -0,0 +1,82 @@ +package com.github.lunatrius.schematica.world.chunk; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +import java.io.File; + +public class SchematicContainer { + public final SchematicWorld schematic; + public final EntityPlayer player; + public final World world; + public final File file; + + public final int minX; + public final int maxX; + public final int minY; + public final int maxY; + public final int minZ; + public final int maxZ; + + public final int minChunkX; + public final int maxChunkX; + public final int minChunkZ; + public final int maxChunkZ; + + public int curChunkX; + public int curChunkZ; + + public final int chunkCount; + public int processedChunks; + + public SchematicContainer(SchematicWorld schematic, EntityPlayer player, World world, File file, int minX, int maxX, int minY, int maxY, int minZ, int maxZ) { + this.schematic = schematic; + this.player = player; + this.world = world; + this.file = file; + + this.minX = minX; + this.maxX = maxX; + this.minY = minY; + this.maxY = maxY; + this.minZ = minZ; + this.maxZ = maxZ; + + this.minChunkX = this.minX >> 4; + this.maxChunkX = this.maxX >> 4; + this.minChunkZ = this.minZ >> 4; + this.maxChunkZ = this.maxZ >> 4; + + this.curChunkX = this.minChunkX; + this.curChunkZ = this.minChunkZ; + + this.chunkCount = (this.maxChunkX - this.minChunkX + 1) * (this.maxChunkZ - this.minChunkZ + 1); + } + + public void next() { + if (!hasNext()) { + return; + } + + Reference.logger.debug(String.format("Copying chunk at [%d,%d] into %s", this.curChunkX, this.curChunkZ, this.file.getName())); + Schematica.proxy.copyChunkToSchematic(this.schematic, this.world, this.curChunkX, this.curChunkZ, this.minX, this.maxX, this.minY, this.maxY, this.minZ, this.maxZ); + + this.processedChunks++; + this.curChunkX++; + if (this.curChunkX >= this.maxChunkX) { + this.curChunkX = this.minChunkX; + this.curChunkZ++; + } + } + + public boolean isFirst() { + return this.curChunkX == this.minChunkX && this.curChunkZ == this.minChunkZ; + } + + public boolean hasNext() { + return this.curChunkX <= this.maxChunkX && this.curChunkZ <= this.maxChunkZ; + } +} diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 9cbd6676..33b1076e 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -101,7 +101,8 @@ schematica.key.save=Save schematic schematica.key.control=Manipulate schematic # commands - save -schematica.command.save.playersOnly=This command can only be sent by players. schematica.command.save.usage=/schematicaSave +schematica.command.save.playersOnly=This command can only be used by players. +schematica.command.save.started=Started saving %d chunks into %s. schematica.command.save.saveSucceeded=Successfully saved %s. schematica.command.save.saveFailed=There was a problem saving the schematic %s. From 5b7314b6cd2951cee250b74024255d8840ea0222 Mon Sep 17 00:00:00 2001 From: Steven Blom Date: Sat, 29 Nov 2014 23:04:01 +1030 Subject: [PATCH 122/314] List and Remove commands for quota management. Server directories are now by UUID, and have the concept of public/private directories. Quotas are currently limited to 8mb. --- .../command/CommandSchematicaList.java | 115 ++++++++++++++++++ .../command/CommandSchematicaRemove.java | 104 ++++++++++++++++ .../command/CommandSchematicaSave.java | 29 ++++- .../handler/ConfigurationHandler.java | 7 ++ .../schematica/proxy/ClientProxy.java | 10 ++ .../schematica/proxy/CommonProxy.java | 8 ++ .../schematica/proxy/ServerProxy.java | 49 ++++++++ .../lunatrius/schematica/reference/Names.java | 32 +++++ .../assets/schematica/lang/en_US.lang | 16 +++ 9 files changed, 367 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java create mode 100644 src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java new file mode 100644 index 00000000..c6aa6418 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -0,0 +1,115 @@ +package com.github.lunatrius.schematica.command; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Names; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.util.*; +import org.apache.commons.io.FilenameUtils; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.LinkedList; + +public class CommandSchematicaList extends CommandBase { + @Override + public String getCommandName() { + return Names.Command.List.NAME; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return Names.Command.List.Message.USAGE; + } + + @Override + public int getRequiredPermissionLevel() { + return 3; + } + + @Override + public void processCommand(ICommandSender sender, String[] arguments) { + if (!(sender instanceof EntityPlayer)) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYERS_ONLY)); + return; + } + + int page = 0; + try { + if (arguments.length > 0) { + page = Integer.parseInt(arguments[0]) - 1; + if (page < 0) { + page = 0; + } + } + } catch (NumberFormatException e) { + throw new WrongUsageException(getCommandUsage(sender)); + } + + final EntityPlayer player = (EntityPlayer) sender; + int pageSize = 9; //maximum number of lines available without opening chat. + int pageStart = page * pageSize; + int pageEnd = pageStart + pageSize; + int currentFile = 0; + + String removeCommandFormat = "/%s %s"; + + LinkedList componentsToSend = new LinkedList(); + + File file = Schematica.proxy.getPlayerSchematicDirectory(player, true); + final File[] files = file.listFiles(new FilenameFilter() { + @Override + public boolean accept(File file, String s) { + return s.endsWith(".schematic"); + } + }); + for (File path : files) { + if (currentFile >= pageStart && currentFile < pageEnd) { + String fileName = FilenameUtils.removeExtension(path.getName()); + + IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", (currentFile + 1), humanReadableByteCount(path.length()), fileName)); + String removeCommand = String.format(removeCommandFormat, Names.Command.Remove.NAME, fileName); + + IChatComponent removeLink = new ChatComponentTranslation(Names.Command.List.Message.REMOVE) + .setChatStyle( + new ChatStyle() + .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, removeCommand)) + .setColor(EnumChatFormatting.RED) + ); + chatComponent.appendSibling(removeLink); + chatComponent.appendText("]"); + + componentsToSend.add(chatComponent); + } + ++currentFile; + } + + if (currentFile == 0) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.NO_SCHEMATICS)); + return; + } + + final int totalPages = (currentFile - 1) / pageSize; + if (page > totalPages) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.NO_SUCH_PAGE)); + return; + } + sender.addChatMessage(new ChatComponentText("")); + sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1)); + for (IChatComponent chatComponent : componentsToSend) { + sender.addChatMessage(chatComponent); + } + } + + //http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java + public static String humanReadableByteCount(long bytes) { + final int unit = 1024; + if (bytes < unit) return bytes + " B"; + int exp = (int) (Math.log(bytes) / Math.log(unit)); + String pre = ("KMGTPE").charAt(exp - 1) + ("i"); + return String.format("%3.0f %sB", bytes / Math.pow(unit, exp), pre); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java new file mode 100644 index 00000000..81dc4c78 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -0,0 +1,104 @@ +package com.github.lunatrius.schematica.command; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Names; +import com.google.common.base.Charsets; +import com.google.common.hash.Hashing; +import joptsimple.internal.Strings; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.util.*; + +import java.io.File; +import java.util.Arrays; + +public class CommandSchematicaRemove extends CommandBase { + @Override + public String getCommandName() { + return Names.Command.Remove.NAME; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return Names.Command.Remove.Message.USAGE; + } + + @Override + public int getRequiredPermissionLevel() { + return 3; + } + + @Override + public void processCommand(ICommandSender sender, String[] arguments) { + if (arguments.length < 1) { + throw new WrongUsageException(getCommandUsage(sender)); + } + + if (!(sender instanceof EntityPlayer)) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.PLAYERS_ONLY)); + return; + } + + final EntityPlayer player = (EntityPlayer) sender; + + boolean delete = false; + String name = Strings.join(arguments, " "); + + if (arguments.length > 1) { + //check if the last parameter is a hash, which constitutes a confirmation. + String potentialNameHash = arguments[arguments.length - 1]; + if (potentialNameHash.length() == 32) { + //We probably have a match. + String[] a = Arrays.copyOfRange(arguments, 0, arguments.length - 1); + //The name then should be everything except the last element + name = Strings.join(a, " "); + + String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); + + if (potentialNameHash.equals(hash)) { + delete = true; + } + } + } + + File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + + File file = new File(schematicDirectory, String.format("%s.schematic", name)); + if (file.exists()) { + if (delete) { + if (file.delete()) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_REMOVED, name)); + } else { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND, name)); + } + } else { + + String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); + + String commandCommandFormat = "/%s %s %s"; + String confirmCommand = String.format(commandCommandFormat, Names.Command.Remove.NAME, name, hash); + final IChatComponent chatComponent = new ChatComponentTranslation(Names.Command.Remove.Message.ARE_YOU_SURE_START, name) + .appendSibling(new ChatComponentText(" [")) + .appendSibling( + //Confirmation link + new ChatComponentTranslation(Names.Command.Remove.Message.YES) + .setChatStyle( + new ChatStyle() + .setColor(EnumChatFormatting.RED) + .setChatClickEvent( + new ClickEvent(ClickEvent.Action.RUN_COMMAND, confirmCommand) + ) + ) + ) + .appendSibling(new ChatComponentText("]")); + + sender.addChatMessage(chatComponent); + } + } else { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND, name)); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index a1f2c2b3..b8dee53e 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -2,7 +2,6 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.command.CommandBase; @@ -11,6 +10,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentTranslation; +import java.io.File; + public class CommandSchematicaSave extends CommandBase { @Override public String getCommandName() { @@ -38,6 +39,13 @@ public void processCommand(ICommandSender sender, String[] arguments) { return; } + final EntityPlayer player = (EntityPlayer) sender; + + if (Schematica.proxy.isPlayerQuotaExceeded(player)) { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.QUOTA_EXCEEDED)); + return; + } + Vector3i from = new Vector3i(); Vector3i to = new Vector3i(); String filename; @@ -53,10 +61,25 @@ public void processCommand(ICommandSender sender, String[] arguments) { throw new WrongUsageException(getCommandUsage(sender)); } - final EntityPlayer player = (EntityPlayer) sender; Reference.logger.info(String.format("Saving schematic from %s to %s to %s", from, to, filename)); + final File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + if (schematicDirectory == null) { + //Chances are that if this is null, we could not retrieve their UUID. + Reference.logger.info(String.format("Unable to determine the schematic directory for player %s", player)); + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE)); + return; + } + + if (!schematicDirectory.exists()) { + if (!schematicDirectory.mkdirs()) { + Reference.logger.info(String.format("Could not create player schematic directory %s", schematicDirectory.getAbsolutePath())); + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE)); + return; + } + } + try { - Schematica.proxy.saveSchematic(player, ConfigurationHandler.schematicDirectory, filename, player.getEntityWorld(), from, to); + Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), from, to); sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); } catch (Exception e) { sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_FAILED, name)); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 710bbef7..eebf0410 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -43,6 +43,7 @@ public class ConfigurationHandler { public static final boolean PRINTERENABLED_DEFAULT = true; public static final boolean SAVEENABLED_DEFAULT = true; public static final boolean LOADENABLED_DEFAULT = true; + public static final int PLAYERQUOTAKILOBYTES_DEFAULT = 8192; public static boolean enableAlpha = ENABLEALPHA_DEFAULT; public static float alpha = (float) ALPHA_DEFAULT; @@ -66,6 +67,7 @@ public class ConfigurationHandler { public static boolean printerEnabled = PRINTERENABLED_DEFAULT; public static boolean saveEnabled = SAVEENABLED_DEFAULT; public static boolean loadEnabled = LOADENABLED_DEFAULT; + public static int playerQuotaKilobytes = PLAYERQUOTAKILOBYTES_DEFAULT; public static Property propEnableAlpha = null; public static Property propAlpha = null; @@ -88,6 +90,7 @@ public class ConfigurationHandler { public static Property propPrinterEnabled = null; public static Property propSaveEnabled = null; public static Property propLoadEnabled = null; + public static Property propPlayerQuotaKilobytes = null; public static void init(File configFile) { if (configuration == null) { @@ -195,6 +198,10 @@ private static void loadConfiguration() { propLoadEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.LOAD_ENABLED); loadEnabled = propLoadEnabled.getBoolean(LOADENABLED_DEFAULT); + propPlayerQuotaKilobytes = configuration.get(Names.Config.Category.SERVER, Names.Config.PLAYER_QUOTA_KILOBYTES, PLAYERQUOTAKILOBYTES_DEFAULT, Names.Config.PLAYER_QUOTA_KILOBYTES_DESC); + propPlayerQuotaKilobytes.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLAYER_QUOTA_KILOBYTES); + playerQuotaKilobytes = propPlayerQuotaKilobytes.getInt(PLAYERQUOTAKILOBYTES_DEFAULT); + Schematica.proxy.createFolders(); if (configuration.hasChanged()) { diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 5289be71..92b920cb 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -249,4 +249,14 @@ public SchematicWorld getActiveSchematic() { public SchematicWorld getActiveSchematic(EntityPlayer player) { return getActiveSchematic(); } + + @Override + public boolean isPlayerQuotaExceeded(EntityPlayer player) { + return false; + } + + @Override + public File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory) { + return ConfigurationHandler.schematicDirectory; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index db00030c..cdf65835 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -2,6 +2,8 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.core.version.VersionChecker; +import com.github.lunatrius.schematica.command.CommandSchematicaList; +import com.github.lunatrius.schematica.command.CommandSchematicaRemove; import com.github.lunatrius.schematica.command.CommandSchematicaSave; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.QueueTickHandler; @@ -47,6 +49,8 @@ public void postInit(FMLPostInitializationEvent event) { public void serverStarting(FMLServerStartingEvent event) { event.registerServerCommand(new CommandSchematicaSave()); + event.registerServerCommand(new CommandSchematicaList()); + event.registerServerCommand(new CommandSchematicaRemove()); } public void createFolders() { @@ -150,4 +154,8 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam public abstract SchematicWorld getActiveSchematic(); public abstract SchematicWorld getActiveSchematic(EntityPlayer player); + + public abstract boolean isPlayerQuotaExceeded(EntityPlayer player); + + public abstract File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory); } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 15b88094..a04336a1 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.PlayerHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -10,6 +11,7 @@ import java.io.File; import java.io.IOException; +import java.util.UUID; public class ServerProxy extends CommonProxy { @Override @@ -52,4 +54,51 @@ public SchematicWorld getActiveSchematic() { public SchematicWorld getActiveSchematic(EntityPlayer player) { return null; } + + @Override + public boolean isPlayerQuotaExceeded(EntityPlayer player) { + int spaceUsed = 0; + + //Space used by private directory + File schematicDirectory = getPlayerSchematicDirectory(player, true); + spaceUsed += getSpaceUsedByDirectory(schematicDirectory); + + //Space used by public directory + schematicDirectory = getPlayerSchematicDirectory(player, false); + spaceUsed += getSpaceUsedByDirectory(schematicDirectory); + return ((spaceUsed / 1024) > ConfigurationHandler.playerQuotaKilobytes); + } + + private int getSpaceUsedByDirectory(File directory) { + int spaceUsed = 0; + //If we don't have a player directory yet, then they haven't uploaded any files yet. + if (directory == null || !directory.exists()) { + return 0; + } + + File[] files = directory.listFiles(); + if (files == null) { + files = new File[0]; + } + for (File path : files) { + spaceUsed += path.length(); + } + return spaceUsed; + } + + @Override + public File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory) { + final UUID playerId = player.getUniqueID(); + if (playerId == null) { + Reference.logger.warn("Unable to identify player", player.toString()); + return null; + } + + File playerDir = new File(ConfigurationHandler.schematicDirectory.getAbsolutePath(), playerId.toString()); + if (privateDirectory) { + return new File(playerDir, "private"); + } else { + return new File(playerDir, "public"); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 5fff4f73..e4f3f07a 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -58,6 +58,9 @@ public static final class Category { public static final String LOAD_ENABLED = "loadEnabled"; public static final String LOAD_ENABLED_DESC = "Allow players to load schematics."; + public static final String PLAYER_QUOTA_KILOBYTES = "playerQuotaKilobytes"; + public static final String PLAYER_QUOTA_KILOBYTES_DESC = "Amount of storage provided per-player for schematics on the server."; + public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; } @@ -69,10 +72,39 @@ public static final class Message { public static final String SAVE_STARTED = "schematica.command.save.started"; public static final String SAVE_SUCCESSFUL = "schematica.command.save.saveSucceeded"; public static final String SAVE_FAILED = "schematica.command.save.saveFailed"; + public static final String QUOTA_EXCEEDED = "schematica.command.save.quotaExceeded"; + public static final String PLAYER_SCHEMATIC_DIR_UNAVAILABLE = "schematica.command.save.playerSchematicDirUnavailable"; } public static final String NAME = "schematicaSave"; } + + public static final class List { + public static final class Message { + public static final String USAGE = "schematica.command.list.usage"; + public static final String LIST_NOT_AVAILABLE = "schematica.command.list.notAvailable"; + public static final String REMOVE = "schematica.command.list.remove"; + public static final String PAGE_HEADER = "schematica.command.list.header"; + public static final String NO_SUCH_PAGE = "schematica.command.list.noSuchPage"; + public static final String NO_SCHEMATICS = "schematica.command.list.noSchematics"; + } + + public static final String NAME = "schematicaList"; + } + + public static final class Remove { + public static final class Message { + public static final String USAGE = "schematica.command.remove.usage"; + public static final String PLAYERS_ONLY = "schematica.command.save.playersOnly"; + public static final String SCHEMATIC_REMOVED = "schematica.command.remove.schematicRemoved"; + public static final String SCHEMATIC_NOT_FOUND = "schematica.command.remove.schematicNotFound"; + public static final String ARE_YOU_SURE_START = "schematica.command.remove.areYouSure"; + public static final String YES = "gui.yes"; + } + + public static final String NAME = "schematicaRemove"; + } + } public static final class ModId { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 33b1076e..93081fb3 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -106,3 +106,19 @@ schematica.command.save.playersOnly=This command can only be used by players. schematica.command.save.started=Started saving %d chunks into %s. schematica.command.save.saveSucceeded=Successfully saved %s. schematica.command.save.saveFailed=There was a problem saving the schematic %s. +schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +schematica.command.list.usage=/schematicaList [page] +schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +schematica.command.list.remove=Remove +schematica.command.list.header=Schematic List - Page %d of %d +schematica.command.list.noSuchPage=No such page +schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +schematica.command.remove.usage=/schematicaRemove +schematica.command.remove.schematicRemoved=Schematic "%s" removed. +schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +schematica.command.remove.areYouSure=Are you sure? From 10d9af046b02030a97ee80f043b4f78b163f0e70 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 1 Dec 2014 16:35:32 +0100 Subject: [PATCH 123/314] Fixed odd schematic behavior when the player is on huge +/- XZ coordinates. --- gradle.properties | 2 +- .../schematica/FileFilterSchematic.java | 4 +- .../renderer/RendererSchematicChunk.java | 5 ++- .../RendererSchematicChunkComparator.java | 12 +++--- .../renderer/RendererSchematicGlobal.java | 42 +++++++++---------- .../command/CommandSchematicaList.java | 17 ++++---- .../command/CommandSchematicaRemove.java | 6 ++- .../schematica/proxy/ClientProxy.java | 10 ++--- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/gradle.properties b/gradle.properties index fd9a6d61..cb68a968 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ version_micro=3 version_minecraft=1.7.10 version_forge=10.13.2.1230 version_minforge=10.13.0.1185 -version_lunatriuscore=1.1.2.16 +version_lunatriuscore=1.1.2.18 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java b/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java index 85bdff69..9d644583 100644 --- a/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java @@ -1,12 +1,12 @@ package com.github.lunatrius.schematica; import java.io.File; +import java.io.FileFilter; -public class FileFilterSchematic implements java.io.FileFilter { +public class FileFilterSchematic implements FileFilter { private final boolean directory; public FileFilterSchematic(boolean dir) { - super(); this.directory = dir; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 2e7f1622..f9ca3516 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; import com.github.lunatrius.schematica.handler.ConfigurationHandler; @@ -36,13 +37,13 @@ public class RendererSchematicChunk { public boolean isInFrustrum = false; - public final Vector3f centerPosition = new Vector3f(); + public final Vector3d centerPosition = new Vector3d(); private final Minecraft minecraft = Minecraft.getMinecraft(); private final Profiler profiler = this.minecraft.mcProfiler; private final SchematicWorld schematic; private final List tileEntities = new ArrayList(); - private final Vector3f distance = new Vector3f(); + private final Vector3d distance = new Vector3d(); private final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java index cc411b0b..2bd90687 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java @@ -1,14 +1,14 @@ package com.github.lunatrius.schematica.client.renderer; -import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.proxy.ClientProxy; import java.util.Comparator; public class RendererSchematicChunkComparator implements Comparator { - private final Vector3f position = new Vector3f(); - private final Vector3f schematicPosition = new Vector3f(); + private final Vector3d position = new Vector3d(); + private final Vector3d schematicPosition = new Vector3d(); @Override public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { @@ -17,13 +17,13 @@ public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchem } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { return 1; } else { - final float dist1 = this.position.lengthSquaredTo(rendererSchematicChunk1.centerPosition); - final float dist2 = this.position.lengthSquaredTo(rendererSchematicChunk2.centerPosition); + final double dist1 = this.position.lengthSquaredTo(rendererSchematicChunk1.centerPosition); + final double dist2 = this.position.lengthSquaredTo(rendererSchematicChunk2.centerPosition); return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); } } public void setPosition(Vector3i position) { - this.position.set(ClientProxy.playerPosition).sub(position.toVector3f(this.schematicPosition)); + this.position.set(ClientProxy.playerPosition).sub(position.toVector3d(this.schematicPosition)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index e7a73d12..37fc19f8 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; -import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -51,14 +51,14 @@ public void render(SchematicWorld schematic) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); - Vector3f playerPosition = ClientProxy.playerPosition.clone(); - Vector3f extra = new Vector3f(); + Vector3d playerPosition = ClientProxy.playerPosition.clone(); + Vector3d extra = new Vector3d(); if (schematic != null) { - extra.add(schematic.position.toVector3f()); + extra.add(schematic.position.toVector3d()); playerPosition.sub(extra); } - GL11.glTranslatef(-playerPosition.x, -playerPosition.y, -playerPosition.z); + GL11.glTranslated(-playerPosition.x, -playerPosition.y, -playerPosition.z); this.profiler.startSection("schematic"); if (schematic != null && schematic.isRendering) { @@ -90,22 +90,22 @@ public void render(SchematicWorld schematic) { } if (ClientProxy.isRenderingGuide) { - Vector3f start; - Vector3f end; - - start = ClientProxy.pointMin.toVector3f().sub(extra); - end = ClientProxy.pointMax.toVector3f().sub(extra).add(1, 1, 1); - RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); - - start = ClientProxy.pointA.toVector3f().sub(extra); - end = start.clone().add(1, 1, 1); - RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - - start = ClientProxy.pointB.toVector3f().sub(extra); - end = start.clone().add(1, 1, 1); - RenderHelper.drawCuboidOutline(start, end, RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - RenderHelper.drawCuboidSurface(start, end, RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); + Vector3d start = new Vector3d(); + Vector3d end = new Vector3d(); + + ClientProxy.pointMin.toVector3d(start).sub(extra); + ClientProxy.pointMax.toVector3d(end).sub(extra).add(1, 1, 1); + RenderHelper.drawCuboidOutline(start.toVector3f(), end.toVector3f(), RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); + + ClientProxy.pointA.toVector3d(start).sub(extra); + end.set(start).add(1, 1, 1); + RenderHelper.drawCuboidOutline(start.toVector3f(), end.toVector3f(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); + RenderHelper.drawCuboidSurface(start.toVector3f(), end.toVector3f(), RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); + + ClientProxy.pointB.toVector3d(start).sub(extra); + end.set(start).add(1, 1, 1); + RenderHelper.drawCuboidOutline(start.toVector3f(), end.toVector3f(), RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); + RenderHelper.drawCuboidSurface(start.toVector3f(), end.toVector3f(), RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); } int quadCount = RenderHelper.getQuadCount(); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index c6aa6418..f5fe25ee 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.command; +import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import net.minecraft.command.CommandBase; @@ -7,14 +8,19 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; -import net.minecraft.util.*; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; import org.apache.commons.io.FilenameUtils; import java.io.File; -import java.io.FilenameFilter; import java.util.LinkedList; public class CommandSchematicaList extends CommandBase { + private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); + @Override public String getCommandName() { return Names.Command.List.NAME; @@ -60,12 +66,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { LinkedList componentsToSend = new LinkedList(); File file = Schematica.proxy.getPlayerSchematicDirectory(player, true); - final File[] files = file.listFiles(new FilenameFilter() { - @Override - public boolean accept(File file, String s) { - return s.endsWith(".schematic"); - } - }); + final File[] files = file.listFiles(FILE_FILTER_SCHEMATIC); for (File path : files) { if (currentFile >= pageStart && currentFile < pageEnd) { String fileName = FilenameUtils.removeExtension(path.getName()); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 81dc4c78..df629359 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -10,7 +10,11 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; -import net.minecraft.util.*; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; import java.io.File; import java.util.Arrays; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 92b920cb..da26767b 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.core.util.vector.Vector3f; +import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; @@ -39,7 +39,7 @@ public class ClientProxy extends CommonProxy { public static boolean isRenderingGuide = false; public static boolean isPendingReset = false; - public static final Vector3f playerPosition = new Vector3f(); + public static final Vector3d playerPosition = new Vector3d(); public static ForgeDirection orientation = ForgeDirection.UNKNOWN; public static int rotationRender = 0; @@ -53,9 +53,9 @@ public class ClientProxy extends CommonProxy { private SchematicWorld schematicWorld = null; public static void setPlayerData(EntityPlayer player, float partialTicks) { - playerPosition.x = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks); - playerPosition.y = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks); - playerPosition.z = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks); + playerPosition.x = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; + playerPosition.y = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; + playerPosition.z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; orientation = getOrientation(player); From d61a7bb39d393a0d5d542451dc450708f3ee7955 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 3 Dec 2014 13:45:10 +0100 Subject: [PATCH 124/314] Include the chunks on the higher X coordinate. Fixes #61 --- .../lunatrius/schematica/world/chunk/SchematicContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java index a1fb6c1a..fb028e67 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java @@ -66,7 +66,7 @@ public void next() { this.processedChunks++; this.curChunkX++; - if (this.curChunkX >= this.maxChunkX) { + if (this.curChunkX > this.maxChunkX) { this.curChunkX = this.minChunkX; this.curChunkZ++; } From 7d511e93ac7f325fb6b4cd68a62ffe28cac8e1e9 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 5 Dec 2014 05:22:08 +0100 Subject: [PATCH 125/314] Temporary fix for saving schematics on servers. --- .../schematica/handler/QueueTickHandler.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 3acbf545..7640bff1 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -1,10 +1,13 @@ package com.github.lunatrius.schematica.handler; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.SchematicContainer; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.util.ChatComponentTranslation; import java.util.ArrayDeque; @@ -17,8 +20,33 @@ public class QueueTickHandler { private QueueTickHandler() {} + @SubscribeEvent + public void onClientTick(TickEvent.ClientTickEvent event) { + if (event.phase == TickEvent.Phase.START) { + return; + } + + // TODO: find a better way... maybe? + try { + final EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; + if (player != null && !player.sendQueue.getNetworkManager().isLocalChannel()) { + processQueue(); + } + } catch (Exception e) { + Reference.logger.error("Something went wrong...", e); + } + } + @SubscribeEvent public void onServerTick(TickEvent.ServerTickEvent event) { + if (event.phase == TickEvent.Phase.START) { + return; + } + + processQueue(); + } + + private void processQueue() { if (this.queue.size() == 0) { return; } From fd568960e48bbb9dae8df602e931a4861cf9eb78 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 8 Dec 2014 02:46:08 +0100 Subject: [PATCH 126/314] Correctly handle all rotated pillar blocks (haybales, logs). --- .../com/github/lunatrius/schematica/config/BlockInfo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 6dd9bd9e..8b1d3ce3 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -10,9 +10,9 @@ import net.minecraft.block.BlockEnderChest; import net.minecraft.block.BlockFurnace; import net.minecraft.block.BlockHopper; -import net.minecraft.block.BlockLog; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPumpkin; +import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockTorch; import net.minecraft.init.Blocks; @@ -258,9 +258,9 @@ public static void populatePlacementMaps() { addPlacementMapping(BlockEnderChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); addPlacementMapping(BlockFurnace.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); addPlacementMapping(BlockHopper.class, new PlacementData(PlacementType.BLOCK, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockLog.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC).setMaskMetaInHand(0x3)); addPlacementMapping(BlockPistonBase.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); addPlacementMapping(BlockPumpkin.class, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0xF)); + addPlacementMapping(BlockRotatedPillar.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC).setMaskMetaInHand(0x3)); addPlacementMapping(BlockStairs.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 1, 0).setOffset(0x4, 0.0f, 1.0f).setMaskMeta(0x3)); addPlacementMapping(BlockTorch.class, new PlacementData(PlacementType.BLOCK, 5, -1, 3, 4, 1, 2).setMaskMeta(0xF)); From 8740ba2de34b50037b42197221ea1be6df463e41 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 13 Dec 2014 00:50:52 +0100 Subject: [PATCH 127/314] Add the schematic icon to the starting message. --- .../schematica/network/message/MessageSchematicBegin.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java index 729b25f5..5102ba02 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java @@ -1,12 +1,15 @@ package com.github.lunatrius.schematica.network.message; import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; +import net.minecraft.item.ItemStack; public class MessageSchematicBegin implements IMessage, IMessageHandler { + public ItemStack icon; public int width; public int height; public int length; @@ -15,6 +18,7 @@ public MessageSchematicBegin() { } public MessageSchematicBegin(SchematicWorld schematic) { + this.icon = schematic.getIcon(); this.width = schematic.getWidth(); this.height = schematic.getHeight(); this.length = schematic.getLength(); @@ -22,6 +26,7 @@ public MessageSchematicBegin(SchematicWorld schematic) { @Override public void fromBytes(ByteBuf buf) { + this.icon = ByteBufUtils.readItemStack(buf); this.width = buf.readShort(); this.height = buf.readShort(); this.length = buf.readShort(); @@ -29,6 +34,7 @@ public void fromBytes(ByteBuf buf) { @Override public void toBytes(ByteBuf buf) { + ByteBufUtils.writeItemStack(buf, this.icon); buf.writeShort(this.width); buf.writeShort(this.height); buf.writeShort(this.length); From 81d4bab74c49d3ec0e265577c639509830281280 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 13 Dec 2014 01:00:04 +0100 Subject: [PATCH 128/314] Extracted chunk dimension constants into a separate class. --- .../renderer/RendererSchematicChunk.java | 13 +++----- .../renderer/RendererSchematicGlobal.java | 7 +++-- .../message/MessageSchematicChunk.java | 31 +++++++++---------- .../schematica/reference/Constants.java | 9 ++++++ 4 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/reference/Constants.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index f9ca3516..ae6271df 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -5,6 +5,7 @@ import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; @@ -27,10 +28,6 @@ import java.util.List; public class RendererSchematicChunk { - public static final int CHUNK_WIDTH = 16; - public static final int CHUNK_HEIGHT = 16; - public static final int CHUNK_LENGTH = 16; - private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); private static boolean canUpdate = false; @@ -54,11 +51,11 @@ public class RendererSchematicChunk { public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int baseY, int baseZ) { this.schematic = schematicWorld; - this.boundingBox.setBounds(baseX * CHUNK_WIDTH, baseY * CHUNK_HEIGHT, baseZ * CHUNK_LENGTH, (baseX + 1) * CHUNK_WIDTH, (baseY + 1) * CHUNK_HEIGHT, (baseZ + 1) * CHUNK_LENGTH); + this.boundingBox.setBounds(baseX * Constants.SchematicChunk.WIDTH, baseY * Constants.SchematicChunk.HEIGHT, baseZ * Constants.SchematicChunk.LENGTH, (baseX + 1) * Constants.SchematicChunk.WIDTH, (baseY + 1) * Constants.SchematicChunk.HEIGHT, (baseZ + 1) * Constants.SchematicChunk.LENGTH); - this.centerPosition.x = (int) ((baseX + 0.5) * CHUNK_WIDTH); - this.centerPosition.y = (int) ((baseY + 0.5) * CHUNK_HEIGHT); - this.centerPosition.z = (int) ((baseZ + 0.5) * CHUNK_LENGTH); + this.centerPosition.x = (int) ((baseX + 0.5) * Constants.SchematicChunk.WIDTH); + this.centerPosition.y = (int) ((baseY + 0.5) * Constants.SchematicChunk.HEIGHT); + this.centerPosition.z = (int) ((baseZ + 0.5) * Constants.SchematicChunk.LENGTH); int x, y, z; for (TileEntity tileEntity : this.schematic.getTileEntities()) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index 37fc19f8..bbb8d2d7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -3,6 +3,7 @@ import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; @@ -168,9 +169,9 @@ private void sortAndUpdate(SchematicWorld schematic) { } public void createRendererSchematicChunks(SchematicWorld schematic) { - int width = (schematic.getWidth() - 1) / RendererSchematicChunk.CHUNK_WIDTH + 1; - int height = (schematic.getHeight() - 1) / RendererSchematicChunk.CHUNK_HEIGHT + 1; - int length = (schematic.getLength() - 1) / RendererSchematicChunk.CHUNK_LENGTH + 1; + int width = (schematic.getWidth() - 1) / Constants.SchematicChunk.WIDTH + 1; + int height = (schematic.getHeight() - 1) / Constants.SchematicChunk.HEIGHT + 1; + int length = (schematic.getLength() - 1) / Constants.SchematicChunk.LENGTH + 1; destroyRendererSchematicChunks(); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java index c79d9808..a1354ac9 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.network.message; import com.github.lunatrius.schematica.nbt.NBTHelper; +import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -15,10 +16,6 @@ import java.util.List; public class MessageSchematicChunk implements IMessage, IMessageHandler { - public static final int CHUNK_WIDTH = 16; - public static final int CHUNK_HEIGHT = 16; - public static final int CHUNK_LENGTH = 16; - public int baseX; public int baseY; public int baseZ; @@ -36,14 +33,14 @@ public MessageSchematicChunk(SchematicWorld schematic, int baseX, int baseY, int this.baseY = baseY; this.baseZ = baseZ; - this.blocks = new short[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; - this.metadata = new byte[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; + this.blocks = new short[Constants.SchematicChunk.WIDTH][Constants.SchematicChunk.HEIGHT][Constants.SchematicChunk.LENGTH]; + this.metadata = new byte[Constants.SchematicChunk.WIDTH][Constants.SchematicChunk.HEIGHT][Constants.SchematicChunk.LENGTH]; this.tileEntities = new ArrayList(); this.entities = new ArrayList(); - for (int x = 0; x < CHUNK_WIDTH; x++) { - for (int y = 0; y < CHUNK_HEIGHT; y++) { - for (int z = 0; z < CHUNK_LENGTH; z++) { + for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { + for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { + for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { this.blocks[x][y][z] = (short) schematic.getBlockIdRaw(baseX + x, baseY + y, baseZ + z); this.metadata[x][y][z] = (byte) schematic.getBlockMetadata(baseX + x, baseY + y, baseZ + z); final TileEntity tileEntity = schematic.getTileEntity(baseX + x, baseY + y, baseZ + z); @@ -61,14 +58,14 @@ public void fromBytes(ByteBuf buf) { this.baseY = buf.readShort(); this.baseZ = buf.readShort(); - this.blocks = new short[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; - this.metadata = new byte[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_LENGTH]; + this.blocks = new short[Constants.SchematicChunk.WIDTH][Constants.SchematicChunk.HEIGHT][Constants.SchematicChunk.LENGTH]; + this.metadata = new byte[Constants.SchematicChunk.WIDTH][Constants.SchematicChunk.HEIGHT][Constants.SchematicChunk.LENGTH]; this.tileEntities = new ArrayList(); this.entities = new ArrayList(); - for (int x = 0; x < CHUNK_WIDTH; x++) { - for (int y = 0; y < CHUNK_HEIGHT; y++) { - for (int z = 0; z < CHUNK_LENGTH; z++) { + for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { + for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { + for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { this.blocks[x][y][z] = buf.readShort(); this.metadata[x][y][z] = buf.readByte(); } @@ -88,9 +85,9 @@ public void toBytes(ByteBuf buf) { buf.writeShort(this.baseY); buf.writeShort(this.baseZ); - for (int x = 0; x < CHUNK_WIDTH; x++) { - for (int y = 0; y < CHUNK_HEIGHT; y++) { - for (int z = 0; z < CHUNK_LENGTH; z++) { + for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { + for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { + for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { buf.writeShort(this.blocks[x][y][z]); buf.writeByte(this.metadata[x][y][z]); } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java new file mode 100644 index 00000000..689548b7 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java @@ -0,0 +1,9 @@ +package com.github.lunatrius.schematica.reference; + +public class Constants { + public static final class SchematicChunk { + public static final int WIDTH = 16; + public static final int HEIGHT = 16; + public static final int LENGTH = 16; + } +} From 9847df888ca1753789fb279acd2febd8e59c2048 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 13 Dec 2014 01:03:58 +0100 Subject: [PATCH 129/314] Rename the schematic transfer classes. --- ...ssageSchematicBegin.java => MessageDownloadBegin.java} | 8 ++++---- ...ssageSchematicChunk.java => MessageDownloadChunk.java} | 8 ++++---- .../{MessageSchematicEnd.java => MessageDownloadEnd.java} | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) rename src/main/java/com/github/lunatrius/schematica/network/message/{MessageSchematicBegin.java => MessageDownloadBegin.java} (80%) rename src/main/java/com/github/lunatrius/schematica/network/message/{MessageSchematicChunk.java => MessageDownloadChunk.java} (92%) rename src/main/java/com/github/lunatrius/schematica/network/message/{MessageSchematicEnd.java => MessageDownloadEnd.java} (73%) diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java similarity index 80% rename from src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java rename to src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java index 5102ba02..76238ddb 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java @@ -8,16 +8,16 @@ import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -public class MessageSchematicBegin implements IMessage, IMessageHandler { +public class MessageDownloadBegin implements IMessage, IMessageHandler { public ItemStack icon; public int width; public int height; public int length; - public MessageSchematicBegin() { + public MessageDownloadBegin() { } - public MessageSchematicBegin(SchematicWorld schematic) { + public MessageDownloadBegin(SchematicWorld schematic) { this.icon = schematic.getIcon(); this.width = schematic.getWidth(); this.height = schematic.getHeight(); @@ -41,7 +41,7 @@ public void toBytes(ByteBuf buf) { } @Override - public IMessage onMessage(MessageSchematicBegin message, MessageContext ctx) { + public IMessage onMessage(MessageDownloadBegin message, MessageContext ctx) { // TODO: implement return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java similarity index 92% rename from src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java rename to src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java index a1354ac9..0bff38b2 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java @@ -15,7 +15,7 @@ import java.util.ArrayList; import java.util.List; -public class MessageSchematicChunk implements IMessage, IMessageHandler { +public class MessageDownloadChunk implements IMessage, IMessageHandler { public int baseX; public int baseY; public int baseZ; @@ -25,10 +25,10 @@ public class MessageSchematicChunk implements IMessage, IMessageHandler tileEntities; public List entities; - public MessageSchematicChunk() { + public MessageDownloadChunk() { } - public MessageSchematicChunk(SchematicWorld schematic, int baseX, int baseY, int baseZ) { + public MessageDownloadChunk(SchematicWorld schematic, int baseX, int baseY, int baseZ) { this.baseX = baseX; this.baseY = baseY; this.baseZ = baseZ; @@ -102,7 +102,7 @@ public void toBytes(ByteBuf buf) { } @Override - public IMessage onMessage(MessageSchematicChunk message, MessageContext ctx) { + public IMessage onMessage(MessageDownloadChunk message, MessageContext ctx) { // TODO: implement return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java similarity index 73% rename from src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java rename to src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index 6b594b5c..5804819e 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -5,7 +5,7 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; -public class MessageSchematicEnd implements IMessage, IMessageHandler { +public class MessageDownloadEnd implements IMessage, IMessageHandler { @Override public void fromBytes(ByteBuf buf) { // TODO: implement @@ -17,7 +17,7 @@ public void toBytes(ByteBuf buf) { } @Override - public IMessage onMessage(MessageSchematicEnd message, MessageContext ctx) { + public IMessage onMessage(MessageDownloadEnd message, MessageContext ctx) { // TODO: implement return null; } From 0bb3e44add1f873f82adb28e31aba9629d44e5f8 Mon Sep 17 00:00:00 2001 From: hieroglyphic Date: Tue, 23 Dec 2014 08:14:57 +0900 Subject: [PATCH 130/314] ko_KR.lang --- .../assets/schematica/lang/ko_KR.lang | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index 943d5b40..8501fce0 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -19,8 +19,8 @@ schematica.gui.operations=동작 schematica.gui.point.red=빨간 점 schematica.gui.point.blue=푸른 점 schematica.gui.saveselection=선택 영역을 schematic으로 저장 -# schematica.gui.on=ON -# schematica.gui.off=OFF +# schematica.gui.on=켜기 +# schematica.gui.off=끄기 schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,19 +28,19 @@ schematica.gui.materials=재료 schematica.gui.materialname=재료 schematica.gui.materialamount=양 schematica.gui.printer=프린터 -# schematica.gui.unknownblock=Unknown Block +# schematica.gui.unknownblock=알 수 없는 블럭 # gui - config - categories schematica.config.category.render=렌더링 schematica.config.category.render.tooltip=렌더링 관련 설정. schematica.config.category.printer=프린터 schematica.config.category.printer.tooltip=프린터 관련 설정. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. +# schematica.config.category.tooltip=툴팁 +# schematica.config.category.tooltip.tooltip=툴팁 관련 설정. schematica.config.category.general=일반 schematica.config.category.general.tooltip=일반 설정. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. +# schematica.config.category.server=서버 +# schematica.config.category.server.tooltip=서버 측 설정. # gui - config - render schematica.config.alphaEnabled=알파 활성화됨 @@ -75,24 +75,24 @@ schematica.config.swapSlots=슬롯 바꾸기 schematica.config.swapSlots.tooltip=프린터는 인벤토리의 아이템을 바꾸기 위해 이 슬롯들을 사용합니다. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. +# schematica.config.tooltipEnabled=툴팁 활성화됨 +# schematica.config.tooltipEnabled.tooltip=Schematic의 블럭 위에 마우스를 올릴 때 툴팁을 표시합니다. +# schematica.config.tooltipX=툴팁 X +# schematica.config.tooltipX.tooltip=툴팁 X에 관련. +# schematica.config.tooltipY=툴팁 Y +# schematica.config.tooltipY.tooltip=툴팁 Y에 관련. # gui - config - general schematica.config.schematicDirectory=Schematic 디렉토리 schematica.config.schematicDirectory.tooltip=Schematic 디렉토리. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. +# schematica.config.printerEnabled=프린터 허용 +# schematica.config.printerEnabled.tooltip=플레이어가 프린터를 쓰는 것을 허용. +# schematica.config.saveEnabled=저장 허용 +# schematica.config.saveEnabled.tooltip=플레이어가 schematic을 저장하는 것을 허용. +# schematica.config.loadEnabled=불러오기 허용 +# schematica.config.loadEnabled.tooltip=플레이어가 schematic을 불러오는 것을 허용. # keys schematica.key.category=Schematica @@ -101,7 +101,7 @@ schematica.key.save=Schematic 저장 schematica.key.control=Schematic 조작 # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.playersOnly=이 커맨드는 오직 플레이어만 사용할 수 있습니다. +# schematica.command.save.usage=/schematicaSave <이름> +# schematica.command.save.saveSucceeded=%s을(를) 성공적으로 저장하였습니다. +# schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제가 발생하였습니다. From 0f3860986a91ce7a0a5b1897b28ef5e1492db038 Mon Sep 17 00:00:00 2001 From: hieroglyphic Date: Wed, 24 Dec 2014 00:42:37 +0900 Subject: [PATCH 131/314] ko_KR.lang thanks! --- .../assets/schematica/lang/ko_KR.lang | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index 8501fce0..0dac8b8d 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -19,8 +19,8 @@ schematica.gui.operations=동작 schematica.gui.point.red=빨간 점 schematica.gui.point.blue=푸른 점 schematica.gui.saveselection=선택 영역을 schematic으로 저장 -# schematica.gui.on=켜기 -# schematica.gui.off=끄기 +schematica.gui.on=켜기 +schematica.gui.off=끄기 schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,19 +28,19 @@ schematica.gui.materials=재료 schematica.gui.materialname=재료 schematica.gui.materialamount=양 schematica.gui.printer=프린터 -# schematica.gui.unknownblock=알 수 없는 블럭 +schematica.gui.unknownblock=알 수 없는 블럭 # gui - config - categories schematica.config.category.render=렌더링 schematica.config.category.render.tooltip=렌더링 관련 설정. schematica.config.category.printer=프린터 schematica.config.category.printer.tooltip=프린터 관련 설정. -# schematica.config.category.tooltip=툴팁 -# schematica.config.category.tooltip.tooltip=툴팁 관련 설정. +schematica.config.category.tooltip=툴팁 +schematica.config.category.tooltip.tooltip=툴팁 관련 설정. schematica.config.category.general=일반 schematica.config.category.general.tooltip=일반 설정. -# schematica.config.category.server=서버 -# schematica.config.category.server.tooltip=서버 측 설정. +schematica.config.category.server=서버 +schematica.config.category.server.tooltip=서버 측 설정. # gui - config - render schematica.config.alphaEnabled=알파 활성화됨 @@ -75,24 +75,24 @@ schematica.config.swapSlots=슬롯 바꾸기 schematica.config.swapSlots.tooltip=프린터는 인벤토리의 아이템을 바꾸기 위해 이 슬롯들을 사용합니다. # gui - config - tooltip -# schematica.config.tooltipEnabled=툴팁 활성화됨 -# schematica.config.tooltipEnabled.tooltip=Schematic의 블럭 위에 마우스를 올릴 때 툴팁을 표시합니다. -# schematica.config.tooltipX=툴팁 X -# schematica.config.tooltipX.tooltip=툴팁 X에 관련. -# schematica.config.tooltipY=툴팁 Y -# schematica.config.tooltipY.tooltip=툴팁 Y에 관련. +schematica.config.tooltipEnabled=툴팁 활성화됨 +schematica.config.tooltipEnabled.tooltip=Schematic의 블럭 위에 마우스를 올릴 때 툴팁을 표시합니다. +schematica.config.tooltipX=툴팁 X +schematica.config.tooltipX.tooltip=툴팁 X에 관련. +schematica.config.tooltipY=툴팁 Y +schematica.config.tooltipY.tooltip=툴팁 Y에 관련. # gui - config - general schematica.config.schematicDirectory=Schematic 디렉토리 schematica.config.schematicDirectory.tooltip=Schematic 디렉토리. # gui - config - server -# schematica.config.printerEnabled=프린터 허용 -# schematica.config.printerEnabled.tooltip=플레이어가 프린터를 쓰는 것을 허용. -# schematica.config.saveEnabled=저장 허용 -# schematica.config.saveEnabled.tooltip=플레이어가 schematic을 저장하는 것을 허용. -# schematica.config.loadEnabled=불러오기 허용 -# schematica.config.loadEnabled.tooltip=플레이어가 schematic을 불러오는 것을 허용. +schematica.config.printerEnabled=프린터 허용 +schematica.config.printerEnabled.tooltip=플레이어가 프린터를 쓰는 것을 허용. +schematica.config.saveEnabled=저장 허용 +schematica.config.saveEnabled.tooltip=플레이어가 schematic을 저장하는 것을 허용. +schematica.config.loadEnabled=불러오기 허용 +schematica.config.loadEnabled.tooltip=플레이어가 schematic을 불러오는 것을 허용. # keys schematica.key.category=Schematica @@ -101,7 +101,7 @@ schematica.key.save=Schematic 저장 schematica.key.control=Schematic 조작 # commands - save -# schematica.command.save.playersOnly=이 커맨드는 오직 플레이어만 사용할 수 있습니다. -# schematica.command.save.usage=/schematicaSave <이름> -# schematica.command.save.saveSucceeded=%s을(를) 성공적으로 저장하였습니다. -# schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제가 발생하였습니다. +schematica.command.save.playersOnly=이 커맨드는 오직 플레이어만 사용할 수 있습니다. +schematica.command.save.usage=/schematicaSave <이름> +schematica.command.save.saveSucceeded=%s을(를) 성공적으로 저장하였습니다. +schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제가 발생하였습니다. From 958406a063cd064b0ba380ce4f56db6c3081fd7e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 26 Dec 2014 18:39:44 +0100 Subject: [PATCH 132/314] Added server side schematicaDownload command. --- .../command/CommandSchematicaDownload.java | 84 +++++++++++++++++ .../schematica/handler/DownloadHandler.java | 90 +++++++++++++++++++ .../schematica/handler/PlayerHandler.java | 7 ++ .../schematica/network/PacketHandler.java | 11 +++ .../network/message/MessageDownloadBegin.java | 6 +- .../message/MessageDownloadBeginAck.java | 32 +++++++ .../network/message/MessageDownloadChunk.java | 29 +++++- .../message/MessageDownloadChunkAck.java | 49 ++++++++++ .../network/message/MessageDownloadEnd.java | 29 +++++- .../network/transfer/SchematicTransfer.java | 75 ++++++++++++++++ .../schematica/proxy/CommonProxy.java | 2 + .../schematica/proxy/ServerProxy.java | 8 ++ .../schematica/reference/Constants.java | 5 ++ .../lunatrius/schematica/reference/Names.java | 11 +++ .../assets/schematica/lang/en_US.lang | 6 ++ 15 files changed, 437 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java create mode 100644 src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java new file mode 100644 index 00000000..221cc9a3 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -0,0 +1,84 @@ +package com.github.lunatrius.schematica.command; + +import com.github.lunatrius.schematica.FileFilterSchematic; +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.handler.DownloadHandler; +import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; +import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.ChatComponentTranslation; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class CommandSchematicaDownload extends CommandBase { + private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); + + @Override + public String getCommandName() { + return Names.Command.Download.NAME; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return Names.Command.Download.Message.USAGE; + } + + @Override + public int getRequiredPermissionLevel() { + return 3; + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args) { + if (!(sender instanceof EntityPlayer)) { + throw new CommandException(Names.Command.Download.Message.PLAYERS_ONLY); + } + + final File directory = Schematica.proxy.getPlayerSchematicDirectory((EntityPlayer) sender, true); + final File[] files = directory.listFiles(FILE_FILTER_SCHEMATIC); + + if (files != null) { + final List filenames = new ArrayList(); + + for (File file : files) { + filenames.add(file.getName()); + } + + return getListOfStringsFromIterableMatchingLastWord(args, filenames); + } + + return null; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (args.length < 1) { + throw new WrongUsageException(getCommandUsage(sender)); + } + + if (!(sender instanceof EntityPlayerMP)) { + throw new CommandException(Names.Command.Download.Message.PLAYERS_ONLY); + } + + final String filename = args[0]; + final EntityPlayerMP player = (EntityPlayerMP) sender; + final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + final SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); + + if (schematic != null) { + DownloadHandler.INSTANCE.transferMap.put(player, new SchematicTransfer(schematic, filename)); + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_STARTED, filename)); + } else { + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_FAILED)); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java new file mode 100644 index 00000000..026ee4ed --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -0,0 +1,90 @@ +package com.github.lunatrius.schematica.handler; + +import com.github.lunatrius.schematica.network.PacketHandler; +import com.github.lunatrius.schematica.network.message.MessageDownloadBegin; +import com.github.lunatrius.schematica.network.message.MessageDownloadChunk; +import com.github.lunatrius.schematica.network.message.MessageDownloadEnd; +import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; +import com.github.lunatrius.schematica.reference.Constants; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; +import net.minecraft.entity.player.EntityPlayerMP; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class DownloadHandler { + public static final DownloadHandler INSTANCE = new DownloadHandler(); + + public SchematicWorld schematic = null; + + public final Map transferMap = new LinkedHashMap(); + + private DownloadHandler() {} + + @SubscribeEvent + public void onServerTick(TickEvent.ServerTickEvent event) { + if (event.phase == TickEvent.Phase.START) { + return; + } + + processQueue(); + } + + private void processQueue() { + if (this.transferMap.size() == 0) { + return; + } + + final EntityPlayerMP player = this.transferMap.keySet().iterator().next(); + final SchematicTransfer transfer = this.transferMap.remove(player); + + if (transfer == null) { + return; + } + + if (!transfer.state.isWaiting()) { + if (++transfer.timeout >= Constants.Network.TIMEOUT) { + if (++transfer.retries >= Constants.Network.RETRIES) { + Reference.logger.warn(String.format("%s's download was dropped!", player.getDisplayName())); + return; + } + + Reference.logger.warn(String.format("%s's download timed out, retrying (#%d)", player.getDisplayName(), transfer.retries)); + + sendChunk(player, transfer); + transfer.timeout = 0; + } + } else if (transfer.state == SchematicTransfer.State.BEGIN_WAIT) { + sendBegin(player, transfer); + } else if (transfer.state == SchematicTransfer.State.CHUNK_WAIT) { + sendChunk(player, transfer); + } else if (transfer.state == SchematicTransfer.State.END_WAIT) { + sendEnd(player, transfer); + return; + } + + this.transferMap.put(player, transfer); + } + + private void sendBegin(EntityPlayerMP player, SchematicTransfer transfer) { + transfer.setState(SchematicTransfer.State.BEGIN); + + MessageDownloadBegin message = new MessageDownloadBegin(transfer.schematic); + PacketHandler.INSTANCE.sendTo(message, player); + } + + private void sendChunk(EntityPlayerMP player, SchematicTransfer transfer) { + transfer.setState(SchematicTransfer.State.CHUNK); + + MessageDownloadChunk message = new MessageDownloadChunk(transfer.schematic, transfer.baseX, transfer.baseY, transfer.baseZ); + PacketHandler.INSTANCE.sendTo(message, player); + } + + private void sendEnd(EntityPlayerMP player, SchematicTransfer transfer) { + MessageDownloadEnd message = new MessageDownloadEnd(transfer.name); + PacketHandler.INSTANCE.sendTo(message, player); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java index eb5c743a..555352d5 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java @@ -22,4 +22,11 @@ public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { } } } + + @SubscribeEvent + public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) { + if (event.player instanceof EntityPlayerMP) { + DownloadHandler.INSTANCE.transferMap.remove(event.player); + } + } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java index 65f941e6..e7ad299e 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java @@ -1,6 +1,11 @@ package com.github.lunatrius.schematica.network; import com.github.lunatrius.schematica.network.message.MessageCapabilities; +import com.github.lunatrius.schematica.network.message.MessageDownloadBegin; +import com.github.lunatrius.schematica.network.message.MessageDownloadBeginAck; +import com.github.lunatrius.schematica.network.message.MessageDownloadChunk; +import com.github.lunatrius.schematica.network.message.MessageDownloadChunkAck; +import com.github.lunatrius.schematica.network.message.MessageDownloadEnd; import com.github.lunatrius.schematica.reference.Reference; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; @@ -11,5 +16,11 @@ public class PacketHandler { public static void init() { INSTANCE.registerMessage(MessageCapabilities.class, MessageCapabilities.class, 0, Side.CLIENT); + + INSTANCE.registerMessage(MessageDownloadBegin.class, MessageDownloadBegin.class, 1, Side.CLIENT); + INSTANCE.registerMessage(MessageDownloadBeginAck.class, MessageDownloadBeginAck.class, 2, Side.SERVER); + INSTANCE.registerMessage(MessageDownloadChunk.class, MessageDownloadChunk.class, 3, Side.CLIENT); + INSTANCE.registerMessage(MessageDownloadChunkAck.class, MessageDownloadChunkAck.class, 4, Side.SERVER); + INSTANCE.registerMessage(MessageDownloadEnd.class, MessageDownloadEnd.class, 5, Side.CLIENT); } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java index 76238ddb..3054d625 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; @@ -42,7 +43,8 @@ public void toBytes(ByteBuf buf) { @Override public IMessage onMessage(MessageDownloadBegin message, MessageContext ctx) { - // TODO: implement - return null; + DownloadHandler.INSTANCE.schematic = new SchematicWorld(message.icon, (short) message.width, (short) message.height, (short) message.length); + + return new MessageDownloadBeginAck(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java new file mode 100644 index 00000000..5f36e755 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java @@ -0,0 +1,32 @@ +package com.github.lunatrius.schematica.network.message; + +import com.github.lunatrius.schematica.handler.DownloadHandler; +import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayerMP; + +public class MessageDownloadBeginAck implements IMessage, IMessageHandler { + @Override + public void fromBytes(ByteBuf buf) { + // NOOP + } + + @Override + public void toBytes(ByteBuf buf) { + // NOOP + } + + @Override + public IMessage onMessage(MessageDownloadBeginAck message, MessageContext ctx) { + EntityPlayerMP player = ctx.getServerHandler().playerEntity; + SchematicTransfer transfer = DownloadHandler.INSTANCE.transferMap.get(player); + if (transfer != null) { + transfer.setState(SchematicTransfer.State.CHUNK_WAIT); + } + + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java index 0bff38b2..d2b86523 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -7,7 +8,10 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; +import cpw.mods.fml.common.registry.GameData; import io.netty.buffer.ByteBuf; +import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -16,6 +20,8 @@ import java.util.List; public class MessageDownloadChunk implements IMessage, IMessageHandler { + public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + public int baseX; public int baseY; public int baseZ; @@ -52,6 +58,24 @@ public MessageDownloadChunk(SchematicWorld schematic, int baseX, int baseY, int } } + private void copyToSchematic(final SchematicWorld schematic) { + for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { + for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { + for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { + short id = this.blocks[x][y][z]; + byte meta = this.metadata[x][y][z]; + Block block = BLOCK_REGISTRY.getObjectById(id); + + schematic.setBlock(this.baseX + x, this.baseY + y, this.baseZ + z, block, meta); + } + } + } + + for (TileEntity tileEntity : this.tileEntities) { + schematic.setTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity); + } + } + @Override public void fromBytes(ByteBuf buf) { this.baseX = buf.readShort(); @@ -103,7 +127,8 @@ public void toBytes(ByteBuf buf) { @Override public IMessage onMessage(MessageDownloadChunk message, MessageContext ctx) { - // TODO: implement - return null; + message.copyToSchematic(DownloadHandler.INSTANCE.schematic); + + return new MessageDownloadChunkAck(message.baseX, message.baseY, message.baseZ); } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java new file mode 100644 index 00000000..3d0a01cf --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java @@ -0,0 +1,49 @@ +package com.github.lunatrius.schematica.network.message; + +import com.github.lunatrius.schematica.handler.DownloadHandler; +import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayerMP; + +public class MessageDownloadChunkAck implements IMessage, IMessageHandler { + private int baseX; + private int baseY; + private int baseZ; + + public MessageDownloadChunkAck() { + } + + public MessageDownloadChunkAck(final int baseX, final int baseY, final int baseZ) { + this.baseX = baseX; + this.baseY = baseY; + this.baseZ = baseZ; + } + + @Override + public void fromBytes(ByteBuf buf) { + this.baseX = buf.readShort(); + this.baseY = buf.readShort(); + this.baseZ = buf.readShort(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeShort(this.baseX); + buf.writeShort(this.baseY); + buf.writeShort(this.baseZ); + } + + @Override + public IMessage onMessage(MessageDownloadChunkAck message, MessageContext ctx) { + EntityPlayerMP player = ctx.getServerHandler().playerEntity; + SchematicTransfer transfer = DownloadHandler.INSTANCE.transferMap.get(player); + if (transfer != null) { + transfer.confirmChunk(message.baseX, message.baseY, message.baseZ); + } + + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index 5804819e..3e6a12d6 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -1,24 +1,47 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.handler.DownloadHandler; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; +import java.io.File; + public class MessageDownloadEnd implements IMessage, IMessageHandler { + public String name; + + public MessageDownloadEnd() { + } + + public MessageDownloadEnd(String name) { + this.name = name; + } + @Override public void fromBytes(ByteBuf buf) { - // TODO: implement + this.name = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { - // TODO: implement + ByteBufUtils.writeUTF8String(buf, this.name); } @Override public IMessage onMessage(MessageDownloadEnd message, MessageContext ctx) { - // TODO: implement + File directory = Schematica.proxy.getPlayerSchematicDirectory(null, true); + boolean success = SchematicFormat.writeToFile(directory, message.name, DownloadHandler.INSTANCE.schematic); + + if (success) { + // TODO: add message + } + + DownloadHandler.INSTANCE.schematic = null; + return null; } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java b/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java new file mode 100644 index 00000000..67eb8dc3 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java @@ -0,0 +1,75 @@ +package com.github.lunatrius.schematica.network.transfer; + +import com.github.lunatrius.schematica.reference.Constants; +import com.github.lunatrius.schematica.world.SchematicWorld; + +public class SchematicTransfer { + public enum State { + BEGIN_WAIT(true), BEGIN, CHUNK_WAIT(true), CHUNK, END_WAIT(true), END; + private boolean waiting; + + State() { } + + State(boolean waiting) { + this.waiting = waiting; + } + + public boolean isWaiting() { + return this.waiting; + } + } + + public final SchematicWorld schematic; + public final String name; + + public final int width; + public final int height; + public final int length; + + public State state = State.BEGIN_WAIT; + public int timeout = 0; + public int retries = 0; + + public int baseX = 0; + public int baseY = 0; + public int baseZ = 0; + + public SchematicTransfer(final SchematicWorld schematic, String name) { + this.schematic = schematic; + this.name = name; + + this.width = schematic.getWidth(); + this.height = schematic.getHeight(); + this.length = schematic.getLength(); + } + + public boolean confirmChunk(final int chunkX, final int chunkY, final int chunkZ) { + if (chunkX == this.baseX && chunkY == this.baseY && chunkZ == this.baseZ) { + setState(State.CHUNK_WAIT); + this.baseX += Constants.SchematicChunk.WIDTH; + + if (this.baseX > this.width) { + this.baseX = 0; + this.baseY += Constants.SchematicChunk.HEIGHT; + + if (this.baseY > this.height) { + this.baseY = 0; + this.baseZ += Constants.SchematicChunk.LENGTH; + + if (this.baseZ > this.length) { + setState(State.END_WAIT); + return false; + } + } + } + } + + return true; + } + + public void setState(State state) { + this.state = state; + this.timeout = 0; + this.retries = 0; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index cdf65835..2e2bf121 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.command.CommandSchematicaRemove; import com.github.lunatrius.schematica.command.CommandSchematicaSave; import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.handler.QueueTickHandler; import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.nbt.TileEntityException; @@ -42,6 +43,7 @@ public void init(FMLInitializationEvent event) { PacketHandler.init(); FMLCommonHandler.instance().bus().register(QueueTickHandler.INSTANCE); + FMLCommonHandler.instance().bus().register(DownloadHandler.INSTANCE); } public void postInit(FMLPostInitializationEvent event) { diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index a04336a1..ef4b93b3 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -1,11 +1,13 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.schematica.command.CommandSchematicaDownload; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.PlayerHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; @@ -21,6 +23,12 @@ public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(PlayerHandler.INSTANCE); } + @Override + public void serverStarting(FMLServerStartingEvent event) { + super.serverStarting(event); + event.registerServerCommand(new CommandSchematicaDownload()); + } + @Override public File getDataDirectory() { final File file = MinecraftServer.getServer().getFile("."); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java index 689548b7..13fb30cf 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java @@ -1,6 +1,11 @@ package com.github.lunatrius.schematica.reference; public class Constants { + public static final class Network { + public static final int TIMEOUT = 15 * 20; + public static final int RETRIES = 5; + } + public static final class SchematicChunk { public static final int WIDTH = 16; public static final int HEIGHT = 16; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index e4f3f07a..4d85998f 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -105,6 +105,17 @@ public static final class Message { public static final String NAME = "schematicaRemove"; } + public static final class Download { + public static final class Message { + public static final String USAGE = "schematica.command.download.usage"; + public static final String PLAYERS_ONLY = "schematica.command.save.playersOnly"; + public static final String DOWNLOAD_STARTED = "schematica.command.download.started"; + public static final String DOWNLOAD_SUCCEEDED = "schematica.command.download.downloadSucceeded"; + public static final String DOWNLOAD_FAILED = "schematica.command.download.downloadFail"; + } + + public static final String NAME = "schematicaDownload"; + } } public static final class ModId { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 93081fb3..0409c002 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -122,3 +122,9 @@ schematica.command.remove.usage=/schematicaRemove schematica.command.remove.schematicRemoved=Schematic "%s" removed. schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. schematica.command.remove.areYouSure=Are you sure? + +# commands - download +schematica.command.download.usage=/schematicaDownload +schematica.command.download.started=Started downloading %s... +schematica.command.download.downloadSucceeded=Successfully downloaded %s. +schematica.command.download.downloadFail=Download failed. From d8a0b4cdb1541639477817e010f5306567193235 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 26 Dec 2014 18:53:27 +0100 Subject: [PATCH 133/314] Localization update. --- .../assets/schematica/lang/ca_ES.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/cs_CZ.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/da_DK.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/de_DE.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/en_GB.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/en_PT.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/es_ES.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/es_MX.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/fi_FI.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/fr_FR.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/hu_HU.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/it_IT.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/ko_KR.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/la_LA.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/lt_LT.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/nl_NL.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/no_NO.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/pl_PL.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/pt_PT.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/ru_RU.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/sk_SK.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/sl_SI.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/th_TH.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/tr_TR.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/uk_UA.lang | 25 ++++++++++++++++++- .../assets/schematica/lang/zh_CN.lang | 25 ++++++++++++++++++- 26 files changed, 624 insertions(+), 26 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index cad0d812..48c4c0da 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -101,7 +101,30 @@ schematica.key.save=Guardar esquema schematica.key.control=Manipular esquema # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 8e445b25..41574bc4 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -101,7 +101,30 @@ schematica.key.save=Uložit schéma schematica.key.control=Manipulovat se schématem # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 285f6b16..a02e2afa 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -101,7 +101,30 @@ schematica.key.save=Gem schematic schematica.key.control=Manipulér schematic # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 3c46d8a3..fd8dcef7 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -101,7 +101,30 @@ schematica.key.save=Schematic speichern schematica.key.control=Schematic verändern # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 361c31f4..1c886e3d 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -101,7 +101,30 @@ schematica.key.save=Save schematic schematica.key.control=Manipulate schematic # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index da65f977..48cce079 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -101,7 +101,30 @@ schematica.key.save=Keep yer blueprint schematica.key.control=Change yer blueprint # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 7504e173..0e433444 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -101,7 +101,30 @@ schematica.key.save=Guardar esquema schematica.key.control=Editar esquema # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index c43a5940..9bfa0ac4 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -101,7 +101,30 @@ schematica.key.save=Guardar esquema schematica.key.control=Manipular esquema # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index a99906c4..6d098404 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -101,7 +101,30 @@ schematica.key.save=Tallenna kaava schematica.key.control=Käsittele kaavaa # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 50538be4..566686e9 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -101,7 +101,30 @@ schematica.key.save=Enregistrer le schematic schematica.key.control=Manipuler le schematic # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 0341a103..2aa920b3 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -101,7 +101,30 @@ schematica.key.save=Klisé mentése schematica.key.control=Klisé módosítása # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index e84ab62a..19ab47c3 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -101,7 +101,30 @@ schematica.key.save=Salva schematica schematica.key.control=Manipola schematica # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index 0dac8b8d..81096f00 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -101,7 +101,30 @@ schematica.key.save=Schematic 저장 schematica.key.control=Schematic 조작 # commands - save -schematica.command.save.playersOnly=이 커맨드는 오직 플레이어만 사용할 수 있습니다. schematica.command.save.usage=/schematicaSave <이름> +schematica.command.save.playersOnly=이 커맨드는 오직 플레이어만 사용할 수 있습니다. +# schematica.command.save.started=Started saving %d chunks into %s. schematica.command.save.saveSucceeded=%s을(를) 성공적으로 저장하였습니다. schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제가 발생하였습니다. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index acaca937..fcd601e2 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -101,7 +101,30 @@ schematica.gui.materialamount=Numerus # schematica.key.control=Manipulate schematic # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 58c40899..2b2d102c 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -101,7 +101,30 @@ schematica.key.save=Iðsaugoti schemà schematica.key.control=Manipuliuoti schemà # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 80953237..f80ae0f8 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -101,7 +101,30 @@ schematica.key.save=Sla schematic op schematica.key.control=Bewerk schematic # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 75b902be..2c7c6cb0 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -101,7 +101,30 @@ schematica.key.save=Lagre tegning schematica.key.control=Manipuler tegning # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index bc64fb38..961ca3b1 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -101,7 +101,30 @@ schematica.key.save=Zapisywanie schematu schematica.key.control=Manipulacja schematem # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index b106f1e1..9612a784 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -101,7 +101,30 @@ schematica.key.save=Guardar schematica schematica.key.control=Manipular schematica # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 39939f5c..022e5bd3 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -101,7 +101,30 @@ schematica.key.save=Сохранить схему schematica.key.control=Манипулирование схемой # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index a3c2935d..42db9670 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -101,7 +101,30 @@ schematica.key.save=Uložiť schému schematica.key.control=Manipulovať so schémou # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index b6218722..d48e3cd3 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -101,7 +101,30 @@ schematica.key.save=Shrani shemo schematica.key.control=Manipuliraj shemo # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index d890ddd6..c390e371 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -101,7 +101,30 @@ schematica.key.save=บันทึกไฟล์ Schematic schematica.key.control=จัดการ Schematic # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 88bc1346..6bad64a1 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -101,7 +101,30 @@ schematica.key.save=Şematiki kaydet schematica.key.control=Şematiki işleyin # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index bb3d4cbc..ce95290a 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -101,7 +101,30 @@ schematica.key.save=Зберегти технологічну схему schematica.key.control=маніпулювати технологічною схемою схемою # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 2531500a..b7018050 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -101,7 +101,30 @@ schematica.key.save=保存Schematic文件 schematica.key.control=调整Schematic文件 # commands - save -# schematica.command.save.playersOnly=This command can only be sent by players. # schematica.command.save.usage=/schematicaSave +# schematica.command.save.playersOnly=This command can only be used by players. +# schematica.command.save.started=Started saving %d chunks into %s. # schematica.command.save.saveSucceeded=Successfully saved %s. # schematica.command.save.saveFailed=There was a problem saving the schematic %s. +# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. + +# commands - list +# schematica.command.list.usage=/schematicaList [page] +# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +# schematica.command.list.remove=Remove +# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.noSuchPage=No such page +# schematica.command.list.noSchematics=You have no schematics available. + +# commands - remove +# schematica.command.remove.usage=/schematicaRemove +# schematica.command.remove.schematicRemoved=Schematic "%s" removed. +# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +# schematica.command.remove.areYouSure=Are you sure? + +# commands - download +# schematica.command.download.usage=/schematicaDownload +# schematica.command.download.started=Started downloading %s... +# schematica.command.download.downloadSucceeded=Successfully downloaded %s. +# schematica.command.download.downloadFail=Download failed. From d1ccde865f7591d1d77e5e4c2c3a68eff4cf8639 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Dec 2014 21:13:29 +0100 Subject: [PATCH 134/314] Added a message to notify the player about a finished download. Added a download button to the schematic list. Slightly tweaked the list header. --- .../command/CommandSchematicaDownload.java | 5 +++-- .../command/CommandSchematicaList.java | 19 ++++++++++++++----- .../network/message/MessageDownloadEnd.java | 5 ++++- .../lunatrius/schematica/reference/Names.java | 1 + .../assets/schematica/lang/ca_ES.lang | 3 ++- .../assets/schematica/lang/cs_CZ.lang | 3 ++- .../assets/schematica/lang/da_DK.lang | 3 ++- .../assets/schematica/lang/de_DE.lang | 3 ++- .../assets/schematica/lang/en_GB.lang | 3 ++- .../assets/schematica/lang/en_PT.lang | 3 ++- .../assets/schematica/lang/en_US.lang | 3 ++- .../assets/schematica/lang/es_ES.lang | 3 ++- .../assets/schematica/lang/es_MX.lang | 3 ++- .../assets/schematica/lang/fi_FI.lang | 3 ++- .../assets/schematica/lang/fr_FR.lang | 3 ++- .../assets/schematica/lang/hu_HU.lang | 3 ++- .../assets/schematica/lang/it_IT.lang | 3 ++- .../assets/schematica/lang/ko_KR.lang | 3 ++- .../assets/schematica/lang/la_LA.lang | 3 ++- .../assets/schematica/lang/lt_LT.lang | 3 ++- .../assets/schematica/lang/nl_NL.lang | 3 ++- .../assets/schematica/lang/no_NO.lang | 3 ++- .../assets/schematica/lang/pl_PL.lang | 3 ++- .../assets/schematica/lang/pt_PT.lang | 3 ++- .../assets/schematica/lang/ru_RU.lang | 3 ++- .../assets/schematica/lang/sk_SK.lang | 3 ++- .../assets/schematica/lang/sl_SI.lang | 3 ++- .../assets/schematica/lang/th_TH.lang | 3 ++- .../assets/schematica/lang/tr_TR.lang | 3 ++- .../assets/schematica/lang/uk_UA.lang | 3 ++- .../assets/schematica/lang/zh_CN.lang | 3 ++- 31 files changed, 76 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 221cc9a3..bcdbeadb 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChatComponentTranslation; +import org.apache.commons.io.FilenameUtils; import java.io.File; import java.util.ArrayList; @@ -50,7 +51,7 @@ public List addTabCompletionOptions(ICommandSender sender, String[] args) { final List filenames = new ArrayList(); for (File file : files) { - filenames.add(file.getName()); + filenames.add(FilenameUtils.removeExtension(file.getName())); } return getListOfStringsFromIterableMatchingLastWord(args, filenames); @@ -69,7 +70,7 @@ public void processCommand(ICommandSender sender, String[] args) { throw new CommandException(Names.Command.Download.Message.PLAYERS_ONLY); } - final String filename = args[0]; + final String filename = args[0] + ".schematic"; final EntityPlayerMP player = (EntityPlayerMP) sender; final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); final SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index f5fe25ee..b0c5c228 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -61,8 +61,6 @@ public void processCommand(ICommandSender sender, String[] arguments) { int pageEnd = pageStart + pageSize; int currentFile = 0; - String removeCommandFormat = "/%s %s"; - LinkedList componentsToSend = new LinkedList(); File file = Schematica.proxy.getPlayerSchematicDirectory(player, true); @@ -72,7 +70,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { String fileName = FilenameUtils.removeExtension(path.getName()); IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", (currentFile + 1), humanReadableByteCount(path.length()), fileName)); - String removeCommand = String.format(removeCommandFormat, Names.Command.Remove.NAME, fileName); + String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); IChatComponent removeLink = new ChatComponentTranslation(Names.Command.List.Message.REMOVE) .setChatStyle( @@ -81,6 +79,16 @@ public void processCommand(ICommandSender sender, String[] arguments) { .setColor(EnumChatFormatting.RED) ); chatComponent.appendSibling(removeLink); + chatComponent.appendText("]["); + + String downloadCommand = String.format("/%s %s", Names.Command.Download.NAME, fileName); + IChatComponent downloadLink = new ChatComponentTranslation(Names.Command.List.Message.DOWNLOAD) + .setChatStyle( + new ChatStyle() + .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, downloadCommand)) + .setColor(EnumChatFormatting.GREEN) + ); + chatComponent.appendSibling(downloadLink); chatComponent.appendText("]"); componentsToSend.add(chatComponent); @@ -98,8 +106,9 @@ public void processCommand(ICommandSender sender, String[] arguments) { sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.NO_SUCH_PAGE)); return; } - sender.addChatMessage(new ChatComponentText("")); - sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1)); + + sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1) + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_GREEN))); for (IChatComponent chatComponent : componentsToSend) { sender.addChatMessage(chatComponent); } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index 3e6a12d6..72eedf8d 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -2,12 +2,15 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.DownloadHandler; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentTranslation; import java.io.File; @@ -37,7 +40,7 @@ public IMessage onMessage(MessageDownloadEnd message, MessageContext ctx) { boolean success = SchematicFormat.writeToFile(directory, message.name, DownloadHandler.INSTANCE.schematic); if (success) { - // TODO: add message + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_SUCCEEDED, message.name)); } DownloadHandler.INSTANCE.schematic = null; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 4d85998f..63a5d56b 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -84,6 +84,7 @@ public static final class Message { public static final String USAGE = "schematica.command.list.usage"; public static final String LIST_NOT_AVAILABLE = "schematica.command.list.notAvailable"; public static final String REMOVE = "schematica.command.list.remove"; + public static final String DOWNLOAD = "schematica.command.list.download"; public static final String PAGE_HEADER = "schematica.command.list.header"; public static final String NO_SUCH_PAGE = "schematica.command.list.noSuchPage"; public static final String NO_SCHEMATICS = "schematica.command.list.noSchematics"; diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 48c4c0da..a6492e15 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipular esquema # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 41574bc4..bc507fea 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipulovat se schématem # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index a02e2afa..0a973635 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipulér schematic # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index fd8dcef7..563b37fc 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -113,7 +113,8 @@ schematica.key.control=Schematic verändern # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 1c886e3d..6ed955f8 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipulate schematic # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 48cce079..5d458ae1 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -113,7 +113,8 @@ schematica.key.control=Change yer blueprint # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 0409c002..213b8282 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -113,7 +113,8 @@ schematica.command.save.playerSchematicDirUnavailable=There was a problem on the schematica.command.list.usage=/schematicaList [page] schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. schematica.command.list.remove=Remove -schematica.command.list.header=Schematic List - Page %d of %d +schematica.command.list.download=Download +schematica.command.list.header=--- Showing schematics page %d of %d --- schematica.command.list.noSuchPage=No such page schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 0e433444..ea9082eb 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -113,7 +113,8 @@ schematica.key.control=Editar esquema # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 9bfa0ac4..07296dc6 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipular esquema # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 6d098404..9676d8d7 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -113,7 +113,8 @@ schematica.key.control=Käsittele kaavaa # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 566686e9..ec2b6f76 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipuler le schematic # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 2aa920b3..1ef9d1fe 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -113,7 +113,8 @@ schematica.key.control=Klisé módosítása # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 19ab47c3..54e28ed3 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipola schematica # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index 81096f00..817bdbe8 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -113,7 +113,8 @@ schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제 # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index fcd601e2..463d6d7e 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -113,7 +113,8 @@ schematica.gui.materialamount=Numerus # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 2b2d102c..493a6a71 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipuliuoti schemà # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index f80ae0f8..d9064a41 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -113,7 +113,8 @@ schematica.key.control=Bewerk schematic # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 2c7c6cb0..d33b4fe0 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipuler tegning # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 961ca3b1..eca3fe78 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipulacja schematem # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 9612a784..8818f95e 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipular schematica # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 022e5bd3..628ad402 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -113,7 +113,8 @@ schematica.key.control=Манипулирование схемой # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 42db9670..c311a9b6 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipulovať so schémou # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index d48e3cd3..f58d1a4b 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -113,7 +113,8 @@ schematica.key.control=Manipuliraj shemo # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index c390e371..a5af4efc 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -113,7 +113,8 @@ schematica.key.control=จัดการ Schematic # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 6bad64a1..964a7a17 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -113,7 +113,8 @@ schematica.key.control=Şematiki işleyin # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index ce95290a..5c232198 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -113,7 +113,8 @@ schematica.key.control=маніпулювати технологічною сх # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index b7018050..fb91bdd1 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -113,7 +113,8 @@ schematica.key.control=调整Schematic文件 # schematica.command.list.usage=/schematicaList [page] # schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. # schematica.command.list.remove=Remove -# schematica.command.list.header=Schematic List - Page %d of %d +# schematica.command.list.download=Download +# schematica.command.list.header=--- Showing schematics page %d of %d --- # schematica.command.list.noSuchPage=No such page # schematica.command.list.noSchematics=You have no schematics available. From 90b7044f221783d37bfd3d74210c2eb4d2dbd74e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Dec 2014 22:03:51 +0100 Subject: [PATCH 135/314] Added a base command for easier permission management. --- .../command/CommandSchematicaBase.java | 17 +++++++++++++++++ .../command/CommandSchematicaDownload.java | 7 +------ .../command/CommandSchematicaList.java | 7 +------ .../command/CommandSchematicaRemove.java | 7 +------ .../command/CommandSchematicaSave.java | 7 +------ 5 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java new file mode 100644 index 00000000..c7295fb6 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java @@ -0,0 +1,17 @@ +package com.github.lunatrius.schematica.command; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; + +public abstract class CommandSchematicaBase extends CommandBase { + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + // TODO: add logic for the client side when ready + return super.canCommandSenderUseCommand(sender); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index bcdbeadb..819c6b01 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; -public class CommandSchematicaDownload extends CommandBase { +public class CommandSchematicaDownload extends CommandSchematicaBase { private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); @Override @@ -33,11 +33,6 @@ public String getCommandUsage(ICommandSender sender) { return Names.Command.Download.Message.USAGE; } - @Override - public int getRequiredPermissionLevel() { - return 3; - } - @Override public List addTabCompletionOptions(ICommandSender sender, String[] args) { if (!(sender instanceof EntityPlayer)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index b0c5c228..98041d47 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -18,7 +18,7 @@ import java.io.File; import java.util.LinkedList; -public class CommandSchematicaList extends CommandBase { +public class CommandSchematicaList extends CommandSchematicaBase { private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); @Override @@ -31,11 +31,6 @@ public String getCommandUsage(ICommandSender sender) { return Names.Command.List.Message.USAGE; } - @Override - public int getRequiredPermissionLevel() { - return 3; - } - @Override public void processCommand(ICommandSender sender, String[] arguments) { if (!(sender instanceof EntityPlayer)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index df629359..9e613f42 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -19,7 +19,7 @@ import java.io.File; import java.util.Arrays; -public class CommandSchematicaRemove extends CommandBase { +public class CommandSchematicaRemove extends CommandSchematicaBase { @Override public String getCommandName() { return Names.Command.Remove.NAME; @@ -30,11 +30,6 @@ public String getCommandUsage(ICommandSender sender) { return Names.Command.Remove.Message.USAGE; } - @Override - public int getRequiredPermissionLevel() { - return 3; - } - @Override public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length < 1) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index b8dee53e..02402d4c 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -12,7 +12,7 @@ import java.io.File; -public class CommandSchematicaSave extends CommandBase { +public class CommandSchematicaSave extends CommandSchematicaBase { @Override public String getCommandName() { return Names.Command.Save.NAME; @@ -23,11 +23,6 @@ public String getCommandUsage(ICommandSender p_71518_1_) { return Names.Command.Save.Message.USAGE; } - @Override - public int getRequiredPermissionLevel() { - return 3; - } - @Override public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length < 7) { From 576369701fa2f22b711e73791f318ccfd70d7c38 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Dec 2014 22:33:28 +0100 Subject: [PATCH 136/314] Extracted file utility classes into it's own class. Replaced some error messages with exceptions. Added safety checks to make sure that files are actually in a (sub)folder. --- .../command/CommandSchematicaDownload.java | 10 ++++-- .../command/CommandSchematicaList.java | 20 +++-------- .../command/CommandSchematicaRemove.java | 23 ++++++------ .../command/CommandSchematicaSave.java | 16 ++++----- .../lunatrius/schematica/util/FileUtils.java | 36 +++++++++++++++++++ 5 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/util/FileUtils.java diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 819c6b01..399b2245 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -5,9 +5,10 @@ import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.util.FileUtils; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; -import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; @@ -68,13 +69,18 @@ public void processCommand(ICommandSender sender, String[] args) { final String filename = args[0] + ".schematic"; final EntityPlayerMP player = (EntityPlayerMP) sender; final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + if (!FileUtils.contains(directory, filename)) { + Reference.logger.error(player.getDisplayName() + " has tried to download the file " + filename); + throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); + } + final SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); if (schematic != null) { DownloadHandler.INSTANCE.transferMap.put(player, new SchematicTransfer(schematic, filename)); sender.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_STARTED, filename)); } else { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_FAILED)); + throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 98041d47..1c765aec 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -3,7 +3,8 @@ import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; -import net.minecraft.command.CommandBase; +import com.github.lunatrius.schematica.util.FileUtils; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; @@ -34,8 +35,7 @@ public String getCommandUsage(ICommandSender sender) { @Override public void processCommand(ICommandSender sender, String[] arguments) { if (!(sender instanceof EntityPlayer)) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYERS_ONLY)); - return; + throw new CommandException(Names.Command.Save.Message.PLAYERS_ONLY); } int page = 0; @@ -64,7 +64,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { if (currentFile >= pageStart && currentFile < pageEnd) { String fileName = FilenameUtils.removeExtension(path.getName()); - IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", (currentFile + 1), humanReadableByteCount(path.length()), fileName)); + IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), fileName)); String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); IChatComponent removeLink = new ChatComponentTranslation(Names.Command.List.Message.REMOVE) @@ -98,8 +98,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { final int totalPages = (currentFile - 1) / pageSize; if (page > totalPages) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.NO_SUCH_PAGE)); - return; + throw new CommandException(Names.Command.List.Message.NO_SUCH_PAGE); } sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1) @@ -108,13 +107,4 @@ public void processCommand(ICommandSender sender, String[] arguments) { sender.addChatMessage(chatComponent); } } - - //http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java - public static String humanReadableByteCount(long bytes) { - final int unit = 1024; - if (bytes < unit) return bytes + " B"; - int exp = (int) (Math.log(bytes) / Math.log(unit)); - String pre = ("KMGTPE").charAt(exp - 1) + ("i"); - return String.format("%3.0f %sB", bytes / Math.pow(unit, exp), pre); - } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 9e613f42..abadaa41 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -2,10 +2,12 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.util.FileUtils; import com.google.common.base.Charsets; import com.google.common.hash.Hashing; import joptsimple.internal.Strings; -import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; @@ -37,8 +39,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { } if (!(sender instanceof EntityPlayer)) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.PLAYERS_ONLY)); - return; + throw new CommandException(Names.Command.Remove.Message.PLAYERS_ONLY); } final EntityPlayer player = (EntityPlayer) sender; @@ -63,22 +64,24 @@ public void processCommand(ICommandSender sender, String[] arguments) { } } + String filename = String.format("%s.schematic", name); File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + File file = new File(schematicDirectory, filename); + if (!FileUtils.contains(schematicDirectory, file)) { + Reference.logger.error(player.getDisplayName() + " has tried to download the file " + filename); + throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); + } - File file = new File(schematicDirectory, String.format("%s.schematic", name)); if (file.exists()) { if (delete) { if (file.delete()) { sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_REMOVED, name)); } else { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND, name)); + throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } } else { - String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); - - String commandCommandFormat = "/%s %s %s"; - String confirmCommand = String.format(commandCommandFormat, Names.Command.Remove.NAME, name, hash); + String confirmCommand = String.format("/%s %s %s", Names.Command.Remove.NAME, name, hash); final IChatComponent chatComponent = new ChatComponentTranslation(Names.Command.Remove.Message.ARE_YOU_SURE_START, name) .appendSibling(new ChatComponentText(" [")) .appendSibling( @@ -97,7 +100,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { sender.addChatMessage(chatComponent); } } else { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND, name)); + throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 02402d4c..fabe5ddf 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -4,7 +4,7 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; @@ -30,15 +30,13 @@ public void processCommand(ICommandSender sender, String[] arguments) { } if (!(sender instanceof EntityPlayer)) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYERS_ONLY)); - return; + throw new CommandException(Names.Command.Save.Message.PLAYERS_ONLY); } final EntityPlayer player = (EntityPlayer) sender; if (Schematica.proxy.isPlayerQuotaExceeded(player)) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.QUOTA_EXCEEDED)); - return; + throw new CommandException(Names.Command.Save.Message.QUOTA_EXCEEDED); } Vector3i from = new Vector3i(); @@ -61,15 +59,13 @@ public void processCommand(ICommandSender sender, String[] arguments) { if (schematicDirectory == null) { //Chances are that if this is null, we could not retrieve their UUID. Reference.logger.info(String.format("Unable to determine the schematic directory for player %s", player)); - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE)); - return; + throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); } if (!schematicDirectory.exists()) { if (!schematicDirectory.mkdirs()) { Reference.logger.info(String.format("Could not create player schematic directory %s", schematicDirectory.getAbsolutePath())); - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE)); - return; + throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); } } @@ -77,7 +73,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), from, to); sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); } catch (Exception e) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_FAILED, name)); + throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/util/FileUtils.java b/src/main/java/com/github/lunatrius/schematica/util/FileUtils.java new file mode 100644 index 00000000..7db37813 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/util/FileUtils.java @@ -0,0 +1,36 @@ +package com.github.lunatrius.schematica.util; + +import com.github.lunatrius.schematica.reference.Reference; + +import java.io.File; +import java.io.IOException; + +public class FileUtils { + // http://stackoverflow.com/a/3758880/1166946 + public static String humanReadableByteCount(final long bytes) { + final int unit = 1024; + if (bytes < unit) { + return bytes + " B"; + } + + int exp = (int) (Math.log(bytes) / Math.log(unit)); + final String pre = "KMGTPE".charAt(exp - 1) + "i"; + + return String.format("%3.0f %sB", bytes / Math.pow(unit, exp), pre); + } + + public static boolean contains(final File root, final String filename) { + return contains(root, new File(root, filename)); + } + + // http://stackoverflow.com/q/18227634/1166946 + public static boolean contains(final File root, final File file) { + try { + return file.getCanonicalPath().startsWith(root.getCanonicalPath() + File.separator); + } catch (IOException e) { + Reference.logger.error("", e); + } + + return false; + } +} From ae8870f0c9850c3bfc8961de63227a5adb0f9953 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 27 Dec 2014 23:07:33 +0100 Subject: [PATCH 137/314] Make use of the new curse property additionalArtifact. --- gradle.properties | 2 +- gradle/scripts/curseforge.gradle | 35 ++------------------------------ 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/gradle.properties b/gradle.properties index cb68a968..2e0d7128 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version_major=1 version_minor=7 -version_micro=3 +version_micro=4 version_minecraft=1.7.10 version_forge=10.13.2.1230 version_minforge=10.13.0.1185 diff --git a/gradle/scripts/curseforge.gradle b/gradle/scripts/curseforge.gradle index 4905c471..dc7517e0 100644 --- a/gradle/scripts/curseforge.gradle +++ b/gradle/scripts/curseforge.gradle @@ -1,44 +1,13 @@ -buildscript { - repositories { - mavenCentral() - maven { - name = 'forge' - url = 'http://files.minecraftforge.net/maven' - } - maven { - name = 'sonatype' - url = 'https://oss.sonatype.org/content/repositories/snapshots/' - } - } - dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - } -} - apply plugin: 'curseforge' -import net.minecraftforge.gradle.curseforge.CurseUploadTask; - if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curseforge_id')) { curse { dependsOn signJars releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release' - } - - task curseDev(dependsOn: 'signJars', type: CurseUploadTask) { - releaseType = 'alpha' - artifact = devJar.archivePath - } - - task curseSource(dependsOn: 'signJars', type: CurseUploadTask) { - releaseType = 'alpha' - artifact = sourceJar.archivePath - } - - configure([curse, curseDev, curseSource]) { apiKey = project.api_key_curseforge projectId = project.extra_curseforge_id changelog = '' - addGameVersion minecraft.version + + additionalArtifact devJar, sourceJar } } From 04fac350ae6e5098c842392395cf3c70ce80077d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 7 Jan 2015 22:20:53 +0100 Subject: [PATCH 138/314] Replaced all buttons for position/layer control with a single numeric field. Layers are now a separate mode and the last selected layer will be remembered. --- gradle.properties | 4 +- .../schematica/SchematicPrinter.java | 7 +- .../client/gui/GuiSchematicControl.java | 204 +++++++---------- .../client/gui/GuiSchematicLoad.java | 8 +- .../client/gui/GuiSchematicMaterials.java | 8 +- .../client/gui/GuiSchematicMaterialsSlot.java | 6 +- .../client/gui/GuiSchematicSave.java | 214 ++++++------------ .../renderer/RendererSchematicChunk.java | 9 +- .../schematica/proxy/ClientProxy.java | 5 - .../schematica/reference/Constants.java | 7 +- .../schematica/world/SchematicWorld.java | 14 +- 11 files changed, 177 insertions(+), 309 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2e0d7128..25e7260a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ version_major=1 version_minor=7 -version_micro=4 +version_micro=5 version_minecraft=1.7.10 version_forge=10.13.2.1230 version_minforge=10.13.0.1185 -version_lunatriuscore=1.1.2.18 +version_lunatriuscore=1.1.2.20 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 9e79bff6..7ac58f2f 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -112,12 +112,11 @@ public boolean print() { final int slot = player.inventory.currentItem; final boolean isSneaking = player.isSneaking(); + final boolean isRenderingLayer = this.schematic.isRenderingLayer; final int renderingLayer = this.schematic.renderingLayer; for (int y = minY; y < maxY; y++) { - if (renderingLayer >= 0) { - if (y != renderingLayer) { - continue; - } + if (isRenderingLayer && y != renderingLayer) { + continue; } for (int x = minX; x < maxX; x++) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 21025833..622089dc 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -1,41 +1,31 @@ package com.github.lunatrius.schematica.client.gui; +import com.github.lunatrius.core.client.gui.GuiNumericField; +import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -public class GuiSchematicControl extends GuiScreen { - private static final Vector3i ZERO = new Vector3i(); - - @SuppressWarnings("unused") - private final GuiScreen prevGuiScreen; - +public class GuiSchematicControl extends GuiScreenBase { private final SchematicWorld schematic; private final SchematicPrinter printer; private int centerX = 0; private int centerY = 0; - private GuiButton btnDecX = null; - private GuiButton btnAmountX = null; - private GuiButton btnIncX = null; - - private GuiButton btnDecY = null; - private GuiButton btnAmountY = null; - private GuiButton btnIncY = null; - - private GuiButton btnDecZ = null; - private GuiButton btnAmountZ = null; - private GuiButton btnIncZ = null; + private GuiNumericField numericX = null; + private GuiNumericField numericY = null; + private GuiNumericField numericZ = null; - private GuiButton btnDecLayer = null; - private GuiButton btnIncLayer = null; + private GuiButton btnLayerMode = null; + private GuiNumericField nfLayer = null; private GuiButton btnHide = null; private GuiButton btnMove = null; @@ -45,22 +35,22 @@ public class GuiSchematicControl extends GuiScreen { private GuiButton btnMaterials = null; private GuiButton btnPrint = null; - private int incrementX = 0; - private int incrementY = 0; - private int incrementZ = 0; - private final String strMoveSchematic = I18n.format("schematica.gui.moveschematic"); - private final String strLayers = I18n.format("schematica.gui.layers"); private final String strOperations = I18n.format("schematica.gui.operations"); private final String strAll = I18n.format("schematica.gui.all"); + private final String strLayers = I18n.format("schematica.gui.layers"); private final String strX = I18n.format("schematica.gui.x"); private final String strY = I18n.format("schematica.gui.y"); private final String strZ = I18n.format("schematica.gui.z"); private final String strMaterials = I18n.format("schematica.gui.materials"); private final String strPrinter = I18n.format("schematica.gui.printer"); + private final String strHide = I18n.format("schematica.gui.hide"); + private final String strShow = I18n.format("schematica.gui.show"); + private final String strOn = I18n.format("schematica.gui.on"); + private final String strOff = I18n.format("schematica.gui.off"); public GuiSchematicControl(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; + super(guiScreen); this.schematic = Schematica.proxy.getActiveSchematic(); this.printer = SchematicPrinter.INSTANCE; } @@ -74,40 +64,22 @@ public void initGui() { int id = 0; - this.btnDecX = new GuiButton(id++, this.centerX - 50, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecX); - - this.btnAmountX = new GuiButton(id++, this.centerX - 15, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementX])); - this.buttonList.add(this.btnAmountX); + this.numericX = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY - 30, 100, 20); + this.buttonList.add(this.numericX); - this.btnIncX = new GuiButton(id++, this.centerX + 20, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncX); + this.numericY = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY - 5, 100, 20); + this.buttonList.add(this.numericY); - this.btnDecY = new GuiButton(id++, this.centerX - 50, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecY); + this.numericZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY + 20, 100, 20); + this.buttonList.add(this.numericZ); - this.btnAmountY = new GuiButton(id++, this.centerX - 15, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementY])); - this.buttonList.add(this.btnAmountY); + this.btnLayerMode = new GuiButton(id++, this.width - 90, this.height - 150 - 25, 80, 20, this.schematic != null && this.schematic.isRenderingLayer ? this.strLayers : this.strAll); + this.buttonList.add(this.btnLayerMode); - this.btnIncY = new GuiButton(id++, this.centerX + 20, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncY); + this.nfLayer = new GuiNumericField(this.fontRendererObj, id++, this.width - 90, this.height - 150, 80, 20); + this.buttonList.add(this.nfLayer); - this.btnDecZ = new GuiButton(id++, this.centerX - 50, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecZ); - - this.btnAmountZ = new GuiButton(id++, this.centerX - 15, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementZ])); - this.buttonList.add(this.btnAmountZ); - - this.btnIncZ = new GuiButton(id++, this.centerX + 20, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncZ); - - this.btnDecLayer = new GuiButton(id++, this.width - 90, this.height - 150, 25, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecLayer); - - this.btnIncLayer = new GuiButton(id++, this.width - 35, this.height - 150, 25, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncLayer); - - this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, I18n.format(this.schematic != null && this.schematic.isRendering ? "schematica.gui.hide" : "schematica.gui.show")); + this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, this.schematic != null && this.schematic.isRendering ? this.strHide : this.strShow); this.buttonList.add(this.btnHide); this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format("schematica.gui.movehere")); @@ -119,26 +91,19 @@ public void initGui() { this.btnRotate = new GuiButton(id++, this.width - 90, this.height - 30, 80, 20, I18n.format("schematica.gui.rotate")); this.buttonList.add(this.btnRotate); - this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, I18n.format("schematica.gui.materials")); + this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, this.strMaterials); this.buttonList.add(this.btnMaterials); - this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, I18n.format(this.printer.isPrinting() ? "schematica.gui.on" : "schematica.gui.off")); + this.btnPrint = new GuiButton(id++, 10, this.height - 30, 80, 20, this.printer.isPrinting() ? this.strOn : this.strOff); this.buttonList.add(this.btnPrint); - this.btnDecX.enabled = this.schematic != null; - this.btnAmountX.enabled = this.schematic != null; - this.btnIncX.enabled = this.schematic != null; - - this.btnDecY.enabled = this.schematic != null; - this.btnAmountY.enabled = this.schematic != null; - this.btnIncY.enabled = this.schematic != null; + this.numericX.setEnabled(this.schematic != null); + this.numericY.setEnabled(this.schematic != null); + this.numericZ.setEnabled(this.schematic != null); - this.btnDecZ.enabled = this.schematic != null; - this.btnAmountZ.enabled = this.schematic != null; - this.btnIncZ.enabled = this.schematic != null; + this.btnLayerMode.enabled = this.schematic != null; + this.nfLayer.setEnabled(this.schematic != null && this.schematic.isRenderingLayer); - this.btnDecLayer.enabled = this.schematic != null; - this.btnIncLayer.enabled = this.schematic != null; this.btnHide.enabled = this.schematic != null; this.btnMove.enabled = this.schematic != null; // this.btnFlip.enabled = this.settings.schematic != null; @@ -146,70 +111,76 @@ public void initGui() { this.btnRotate.enabled = this.schematic != null; this.btnMaterials.enabled = this.schematic != null; this.btnPrint.enabled = this.schematic != null && this.printer.isEnabled(); + + setMinMax(this.numericX); + setMinMax(this.numericY); + setMinMax(this.numericZ); + + if (this.schematic != null) { + setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); + } + + this.nfLayer.setMinimum(0); + this.nfLayer.setMaximum(this.schematic != null ? this.schematic.getHeight() - 1 : 0); + if (this.schematic != null) { + this.nfLayer.setValue(this.schematic.renderingLayer); + } + } + + private void setMinMax(GuiNumericField numericField) { + numericField.setMinimum(Constants.World.MINIMUM_COORD); + numericField.setMaximum(Constants.World.MAXIMUM_COORD); + } + + private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, Vector3i point) { + numX.setValue(point.x); + numY.setValue(point.y); + numZ.setValue(point.z); } @Override protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { - if (guiButton.id == this.btnDecX.id) { - this.schematic.position.x -= ClientProxy.INCREMENTS[this.incrementX]; - RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnIncX.id) { - this.schematic.position.x += ClientProxy.INCREMENTS[this.incrementX]; - RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnAmountX.id) { - this.incrementX = (this.incrementX + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementX]); - } else if (guiButton.id == this.btnDecY.id) { - this.schematic.position.y -= ClientProxy.INCREMENTS[this.incrementY]; - RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnIncY.id) { - this.schematic.position.y += ClientProxy.INCREMENTS[this.incrementY]; + if (this.schematic == null) { + return; + } + + if (guiButton.id == this.numericX.id) { + this.schematic.position.x = this.numericX.getValue(); RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnAmountY.id) { - this.incrementY = (this.incrementY + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementY]); - } else if (guiButton.id == this.btnDecZ.id) { - this.schematic.position.z -= ClientProxy.INCREMENTS[this.incrementZ]; + } else if (guiButton.id == this.numericY.id) { + this.schematic.position.y = this.numericY.getValue(); RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnIncZ.id) { - this.schematic.position.z += ClientProxy.INCREMENTS[this.incrementZ]; + } else if (guiButton.id == this.numericZ.id) { + this.schematic.position.z = this.numericZ.getValue(); RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnAmountZ.id) { - this.incrementZ = (this.incrementZ + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementZ]); - } else if (guiButton.id == this.btnDecLayer.id) { - if (this.schematic != null) { - this.schematic.decrementRenderingLayer(); - } + } else if (guiButton.id == this.btnLayerMode.id) { + this.schematic.isRenderingLayer = !this.schematic.isRenderingLayer; + this.btnLayerMode.displayString = this.schematic.isRenderingLayer ? this.strLayers : this.strAll; + this.nfLayer.setEnabled(this.schematic.isRenderingLayer); RendererSchematicGlobal.INSTANCE.refresh(); - } else if (guiButton.id == this.btnIncLayer.id) { - if (this.schematic != null) { - this.schematic.incrementRenderingLayer(); - } + } else if (guiButton.id == this.nfLayer.id) { + this.schematic.renderingLayer = this.nfLayer.getValue(); RendererSchematicGlobal.INSTANCE.refresh(); } else if (guiButton.id == this.btnHide.id) { - this.btnHide.displayString = I18n.format(this.schematic != null && this.schematic.toggleRendering() ? "schematica.gui.hide" : "schematica.gui.show"); + this.btnHide.displayString = this.schematic.toggleRendering() ? this.strHide : this.strShow; } else if (guiButton.id == this.btnMove.id) { ClientProxy.moveSchematicToPlayer(this.schematic); RendererSchematicGlobal.INSTANCE.refresh(); + setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); } else if (guiButton.id == this.btnFlip.id) { - if (this.schematic != null) { - this.schematic.flip(); - RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); - SchematicPrinter.INSTANCE.refresh(); - } + this.schematic.flip(); + RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); + SchematicPrinter.INSTANCE.refresh(); } else if (guiButton.id == this.btnRotate.id) { - if (this.schematic != null) { - this.schematic.rotate(); - RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); - SchematicPrinter.INSTANCE.refresh(); - } + this.schematic.rotate(); + RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); + SchematicPrinter.INSTANCE.refresh(); } else if (guiButton.id == this.btnMaterials.id) { this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); } else if (guiButton.id == this.btnPrint.id && this.printer.isEnabled()) { boolean isPrinting = this.printer.togglePrinting(); - this.btnPrint.displayString = I18n.format(isPrinting ? "schematica.gui.on" : "schematica.gui.off"); + this.btnPrint.displayString = isPrinting ? this.strOn : this.strOff; } } } @@ -224,18 +195,9 @@ public void drawScreen(int par1, int par2, float par3) { drawCenteredString(this.fontRendererObj, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); drawCenteredString(this.fontRendererObj, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); - int renderingLayer = this.schematic != null ? this.schematic.renderingLayer : -1; - drawCenteredString(this.fontRendererObj, renderingLayer < 0 ? this.strAll : Integer.toString(renderingLayer + 1), this.width - 50, this.height - 145, 0xFFFFFF); - - Vector3i position = this.schematic != null ? this.schematic.position : ZERO; drawString(this.fontRendererObj, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(position.x), this.centerX + 55, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(position.y), this.centerX + 55, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(position.z), this.centerX + 55, this.centerY + 26, 0xFFFFFF); super.drawScreen(par1, par2, par3); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 7dc9e887..5cf4895b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.gui; +import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.ConfigurationHandler; @@ -21,11 +22,10 @@ import java.util.ArrayList; import java.util.List; -public class GuiSchematicLoad extends GuiScreen { +public class GuiSchematicLoad extends GuiScreenBase { private static final FileFilterSchematic FILE_FILTER_FOLDER = new FileFilterSchematic(true); private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); - private final GuiScreen prevGuiScreen; private GuiSchematicLoadSlot guiSchematicLoadSlot; private GuiButton btnOpenDir = null; @@ -38,7 +38,7 @@ public class GuiSchematicLoad extends GuiScreen { protected final List schematicFiles = new ArrayList(); public GuiSchematicLoad(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; + super(guiScreen); } @Override @@ -78,7 +78,7 @@ protected void actionPerformed(GuiButton guiButton) { if (Schematica.proxy.isLoadEnabled) { loadSchematic(); } - this.mc.displayGuiScreen(this.prevGuiScreen); + this.mc.displayGuiScreen(this.parentScreen); } else { this.guiSchematicLoadSlot.actionPerformed(guiButton); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java index 673da284..6ad40105 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.gui; +import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; @@ -10,8 +11,7 @@ import java.util.ArrayList; import java.util.List; -public class GuiSchematicMaterials extends GuiScreen { - private final GuiScreen prevGuiScreen; +public class GuiSchematicMaterials extends GuiScreenBase { private GuiSchematicMaterialsSlot guiSchematicMaterialsSlot; private GuiButton btnDone = null; @@ -22,7 +22,7 @@ public class GuiSchematicMaterials extends GuiScreen { protected final List blockList; public GuiSchematicMaterials(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; + super(guiScreen); SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null) { this.blockList = schematic.getBlockList(); @@ -45,7 +45,7 @@ public void initGui() { protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnDone.id) { - this.mc.displayGuiScreen(this.prevGuiScreen); + this.mc.displayGuiScreen(this.parentScreen); } else { this.guiSchematicMaterialsSlot.actionPerformed(guiButton); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index 0b36a1f9..20211bfb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -51,7 +51,7 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat String itemName; String amount = Integer.toString(itemStack.stackSize); - if (itemStack != null && itemStack.getItem() != null) { + if (itemStack.getItem() != null) { itemName = itemStack.getItem().getItemStackDisplayName(itemStack); } else { itemName = this.strUnknownBlock; @@ -59,7 +59,7 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, itemStack); - this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 16777215); - this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 6, 16777215); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 6, 0xFFFFFF); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 42eb7ca2..6be20b66 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -1,55 +1,32 @@ package com.github.lunatrius.schematica.client.gui; +import com.github.lunatrius.core.client.gui.GuiNumericField; +import com.github.lunatrius.core.client.gui.GuiScreenBase; +import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Constants; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; -public class GuiSchematicSave extends GuiScreen { - @SuppressWarnings("unused") - private final GuiScreen prevGuiScreen; - +public class GuiSchematicSave extends GuiScreenBase { private int centerX = 0; private int centerY = 0; private GuiButton btnPointA = null; - private GuiButton btnDecAX = null; - private GuiButton btnAmountAX = null; - private GuiButton btnIncAX = null; - - private GuiButton btnDecAY = null; - private GuiButton btnAmountAY = null; - private GuiButton btnIncAY = null; - - private GuiButton btnDecAZ = null; - private GuiButton btnAmountAZ = null; - private GuiButton btnIncAZ = null; + private GuiNumericField numericAX = null; + private GuiNumericField numericAY = null; + private GuiNumericField numericAZ = null; private GuiButton btnPointB = null; - private GuiButton btnDecBX = null; - private GuiButton btnAmountBX = null; - private GuiButton btnIncBX = null; - - private GuiButton btnDecBY = null; - private GuiButton btnAmountBY = null; - private GuiButton btnIncBY = null; - - private GuiButton btnDecBZ = null; - private GuiButton btnAmountBZ = null; - private GuiButton btnIncBZ = null; - - private int incrementAX = 0; - private int incrementAY = 0; - private int incrementAZ = 0; - - private int incrementBX = 0; - private int incrementBY = 0; - private int incrementBZ = 0; + private GuiNumericField numericBX = null; + private GuiNumericField numericBY = null; + private GuiNumericField numericBZ = null; private GuiButton btnEnable = null; private GuiButton btnSave = null; @@ -61,9 +38,11 @@ public class GuiSchematicSave extends GuiScreen { private final String strX = I18n.format("schematica.gui.x"); private final String strY = I18n.format("schematica.gui.y"); private final String strZ = I18n.format("schematica.gui.z"); + private final String strOn = I18n.format("schematica.gui.on"); + private final String strOff = I18n.format("schematica.gui.off"); public GuiSchematicSave(GuiScreen guiScreen) { - this.prevGuiScreen = guiScreen; + super(guiScreen); } @Override @@ -78,67 +57,32 @@ public void initGui() { this.btnPointA = new GuiButton(id++, this.centerX - 130, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.red")); this.buttonList.add(this.btnPointA); - this.btnDecAX = new GuiButton(id++, this.centerX - 130, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecAX); - - this.btnAmountAX = new GuiButton(id++, this.centerX - 95, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAX])); - this.buttonList.add(this.btnAmountAX); - - this.btnIncAX = new GuiButton(id++, this.centerX - 60, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncAX); - - this.btnDecAY = new GuiButton(id++, this.centerX - 130, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecAY); + this.numericAX = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY - 30); + this.buttonList.add(this.numericAX); - this.btnAmountAY = new GuiButton(id++, this.centerX - 95, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAY])); - this.buttonList.add(this.btnAmountAY); + this.numericAY = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY - 5); + this.buttonList.add(this.numericAY); - this.btnIncAY = new GuiButton(id++, this.centerX - 60, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncAY); - - this.btnDecAZ = new GuiButton(id++, this.centerX - 130, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecAZ); - - this.btnAmountAZ = new GuiButton(id++, this.centerX - 95, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ])); - this.buttonList.add(this.btnAmountAZ); - - this.btnIncAZ = new GuiButton(id++, this.centerX - 60, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncAZ); + this.numericAZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY + 20); + this.buttonList.add(this.numericAZ); this.btnPointB = new GuiButton(id++, this.centerX + 30, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.blue")); this.buttonList.add(this.btnPointB); - this.btnDecBX = new GuiButton(id++, this.centerX + 30, this.centerY - 30, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecBX); - - this.btnAmountBX = new GuiButton(id++, this.centerX + 65, this.centerY - 30, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBX])); - this.buttonList.add(this.btnAmountBX); - - this.btnIncBX = new GuiButton(id++, this.centerX + 100, this.centerY - 30, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncBX); + this.numericBX = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY - 30); + this.buttonList.add(this.numericBX); - this.btnDecBY = new GuiButton(id++, this.centerX + 30, this.centerY - 5, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecBY); + this.numericBY = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY - 5); + this.buttonList.add(this.numericBY); - this.btnAmountBY = new GuiButton(id++, this.centerX + 65, this.centerY - 5, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBY])); - this.buttonList.add(this.btnAmountBY); + this.numericBZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY + 20); + this.buttonList.add(this.numericBZ); - this.btnIncBY = new GuiButton(id++, this.centerX + 100, this.centerY - 5, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncBY); - - this.btnDecBZ = new GuiButton(id++, this.centerX + 30, this.centerY + 20, 30, 20, I18n.format("schematica.gui.decrease")); - this.buttonList.add(this.btnDecBZ); - - this.btnAmountBZ = new GuiButton(id++, this.centerX + 65, this.centerY + 20, 30, 20, Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ])); - this.buttonList.add(this.btnAmountBZ); - - this.btnIncBZ = new GuiButton(id++, this.centerX + 100, this.centerY + 20, 30, 20, I18n.format("schematica.gui.increase")); - this.buttonList.add(this.btnIncBZ); - - this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off")); + this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, ClientProxy.isRenderingGuide ? this.strOn : this.strOff); this.buttonList.add(this.btnEnable); this.tfFilename = new GuiTextField(this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); + this.textFields.add(this.tfFilename); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format("schematica.gui.save")); this.btnSave.enabled = ClientProxy.isRenderingGuide; @@ -146,6 +90,27 @@ public void initGui() { this.tfFilename.setMaxStringLength(1024); this.tfFilename.setText(this.filename); + + setMinMax(this.numericAX); + setMinMax(this.numericAY); + setMinMax(this.numericAZ); + setMinMax(this.numericBX); + setMinMax(this.numericBY); + setMinMax(this.numericBZ); + + setPoint(this.numericAX, this.numericAY, this.numericAZ, ClientProxy.pointA); + setPoint(this.numericBX, this.numericBY, this.numericBZ, ClientProxy.pointB); + } + + private void setMinMax(GuiNumericField numericField) { + numericField.setMinimum(Constants.World.MINIMUM_COORD); + numericField.setMaximum(Constants.World.MAXIMUM_COORD); + } + + private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, Vector3i point) { + numX.setValue(point.x); + numY.setValue(point.y); + numZ.setValue(point.z); } @Override @@ -154,66 +119,32 @@ protected void actionPerformed(GuiButton guiButton) { if (guiButton.id == this.btnPointA.id) { ClientProxy.movePointToPlayer(ClientProxy.pointA); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnDecAX.id) { - ClientProxy.pointA.x -= ClientProxy.INCREMENTS[this.incrementAX]; + setPoint(this.numericAX, this.numericAY, this.numericAZ, ClientProxy.pointA); + } else if (guiButton.id == this.numericAX.id) { + ClientProxy.pointA.x = this.numericAX.getValue(); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncAX.id) { - ClientProxy.pointA.x += ClientProxy.INCREMENTS[this.incrementAX]; + } else if (guiButton.id == this.numericAY.id) { + ClientProxy.pointA.y = this.numericAY.getValue(); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountAX.id) { - this.incrementAX = (this.incrementAX + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountAX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAX]); - } else if (guiButton.id == this.btnDecAY.id) { - ClientProxy.pointA.y -= ClientProxy.INCREMENTS[this.incrementAY]; + } else if (guiButton.id == this.numericAZ.id) { + ClientProxy.pointA.z = this.numericAZ.getValue(); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncAY.id) { - ClientProxy.pointA.y += ClientProxy.INCREMENTS[this.incrementAY]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountAY.id) { - this.incrementAY = (this.incrementAY + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountAY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAY]); - } else if (guiButton.id == this.btnDecAZ.id) { - ClientProxy.pointA.z -= ClientProxy.INCREMENTS[this.incrementAZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncAZ.id) { - ClientProxy.pointA.z += ClientProxy.INCREMENTS[this.incrementAZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountAZ.id) { - this.incrementAZ = (this.incrementAZ + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountAZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementAZ]); } else if (guiButton.id == this.btnPointB.id) { ClientProxy.movePointToPlayer(ClientProxy.pointB); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnDecBX.id) { - ClientProxy.pointB.x -= ClientProxy.INCREMENTS[this.incrementBX]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncBX.id) { - ClientProxy.pointB.x += ClientProxy.INCREMENTS[this.incrementBX]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountBX.id) { - this.incrementBX = (this.incrementBX + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountBX.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBX]); - } else if (guiButton.id == this.btnDecBY.id) { - ClientProxy.pointB.y -= ClientProxy.INCREMENTS[this.incrementBY]; + setPoint(this.numericBX, this.numericBY, this.numericBZ, ClientProxy.pointB); + } else if (guiButton.id == this.numericBX.id) { + ClientProxy.pointB.x = this.numericBX.getValue(); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncBY.id) { - ClientProxy.pointB.y += ClientProxy.INCREMENTS[this.incrementBY]; + } else if (guiButton.id == this.numericBY.id) { + ClientProxy.pointB.y = this.numericBY.getValue(); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountBY.id) { - this.incrementBY = (this.incrementBY + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountBY.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBY]); - } else if (guiButton.id == this.btnDecBZ.id) { - ClientProxy.pointB.z -= ClientProxy.INCREMENTS[this.incrementBZ]; + } else if (guiButton.id == this.numericBZ.id) { + ClientProxy.pointB.z = this.numericBZ.getValue(); ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnIncBZ.id) { - ClientProxy.pointB.z += ClientProxy.INCREMENTS[this.incrementBZ]; - ClientProxy.updatePoints(); - } else if (guiButton.id == this.btnAmountBZ.id) { - this.incrementBZ = (this.incrementBZ + 1) % ClientProxy.INCREMENTS.length; - this.btnAmountBZ.displayString = Integer.toString(ClientProxy.INCREMENTS[this.incrementBZ]); } else if (guiButton.id == this.btnEnable.id) { ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; - this.btnEnable.displayString = I18n.format(ClientProxy.isRenderingGuide ? "schematica.gui.on" : "schematica.gui.off"); + this.btnEnable.displayString = ClientProxy.isRenderingGuide ? this.strOn : this.strOff; this.btnSave.enabled = ClientProxy.isRenderingGuide; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; @@ -225,23 +156,10 @@ protected void actionPerformed(GuiButton guiButton) { } } - @Override - protected void mouseClicked(int x, int y, int action) { - this.tfFilename.mouseClicked(x, y, action); - super.mouseClicked(x, y, action); - } - @Override protected void keyTyped(char character, int code) { - this.tfFilename.textboxKeyTyped(character, code); - this.filename = this.tfFilename.getText(); super.keyTyped(character, code); - } - - @Override - public void updateScreen() { - this.tfFilename.updateCursorCounter(); - super.updateScreen(); + this.filename = this.tfFilename.getText(); } @Override @@ -268,8 +186,6 @@ public void drawScreen(int par1, int par2, float par3) { drawString(this.fontRendererObj, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); - this.tfFilename.drawTextBox(); - super.drawScreen(par1, par2, par3); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index ae6271df..b7e2c02c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -127,7 +127,7 @@ public void updateRenderer() { maxZ = Math.min((int) this.boundingBox.maxZ, this.schematic.getLength()); int renderingLayer = this.schematic.renderingLayer; - if (renderingLayer >= 0) { + if (this.schematic.isRenderingLayer) { if (renderingLayer >= minY && renderingLayer < maxY) { minY = renderingLayer; maxY = renderingLayer + 1; @@ -353,11 +353,8 @@ public void renderTileEntities(int renderPass) { y = tileEntity.yCoord; z = tileEntity.zCoord; - int renderingLayer = this.schematic.renderingLayer; - if (renderingLayer >= 0) { - if (renderingLayer != y) { - continue; - } + if (this.schematic.isRenderingLayer && this.schematic.renderingLayer != y) { + continue; } mcBlock = mcWorld.getBlock(x + this.schematic.position.x, y + this.schematic.position.y, z + this.schematic.position.z); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index da26767b..2ed1bdd8 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -31,11 +31,6 @@ import java.io.IOException; public class ClientProxy extends CommonProxy { - // TODO: remove this and replace the 3 sepparate buttons with a single control - public static final int[] INCREMENTS = { - 1, 5, 15, 50, 250 - }; - public static boolean isRenderingGuide = false; public static boolean isPendingReset = false; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java index 13fb30cf..47e54eb5 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.reference; -public class Constants { +public final class Constants { public static final class Network { public static final int TIMEOUT = 15 * 20; public static final int RETRIES = 5; @@ -11,4 +11,9 @@ public static final class SchematicChunk { public static final int HEIGHT = 16; public static final int LENGTH = 16; } + + public static final class World { + public static final int MINIMUM_COORD = -30000000; + public static final int MAXIMUM_COORD = +30000000; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 46fca59e..0b1090f3 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -62,6 +62,7 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { public final Vector3i position = new Vector3i(); public boolean isRendering; + public boolean isRenderingLayer; public int renderingLayer; public SchematicWorld() { @@ -75,7 +76,8 @@ public SchematicWorld() { this.length = 0; this.isRendering = false; - this.renderingLayer = -1; + this.isRenderingLayer = false; + this.renderingLayer = 0; } public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { @@ -204,7 +206,7 @@ public int getBlockIdRaw(int x, int y, int z) { } private int getBlockId(int x, int y, int z) { - if (this.renderingLayer != -1 && this.renderingLayer != y) { + if (this.isRenderingLayer && this.renderingLayer != y) { return 0; } return getBlockIdRaw(x, y, z); @@ -409,14 +411,6 @@ public boolean toggleRendering() { return this.isRendering; } - public void decrementRenderingLayer() { - this.renderingLayer = MathHelper.clamp_int(this.renderingLayer - 1, -1, getHeight() - 1); - } - - public void incrementRenderingLayer() { - this.renderingLayer = MathHelper.clamp_int(this.renderingLayer + 1, -1, getHeight() - 1); - } - public void refreshChests() { for (TileEntity tileEntity : this.tileEntities) { if (tileEntity instanceof TileEntityChest) { From 12c4f657181adad31a3d148931ba8b98c0150e70 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 7 Jan 2015 22:51:32 +0100 Subject: [PATCH 139/314] The material list is now compiled from the whole schematic or a specified layer. --- .../schematica/world/SchematicWorld.java | 180 +++++++++--------- 1 file changed, 88 insertions(+), 92 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 0b1090f3..7e51b164 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -6,7 +6,6 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; import cpw.mods.fml.common.registry.GameData; import cpw.mods.fml.relauncher.Side; @@ -24,7 +23,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntitySkull; -import net.minecraft.util.MathHelper; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.WorldSettings; @@ -55,7 +53,6 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { private short[][][] blocks; private byte[][][] metadata; private final List tileEntities = new ArrayList(); - private final List blockList = new ArrayList(); private short width; private short height; private short length; @@ -104,100 +101,12 @@ public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, L } } } - - if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { - generateBlockList(); - } } public SchematicWorld(ItemStack icon, short width, short height, short length) { this(icon, null, null, null, width, height, length); } - private void generateBlockList() { - this.blockList.clear(); - - int x, y, z, itemDamage; - Block block; - Item item; - ItemStack itemStack; - - for (y = 0; y < this.height; y++) { - for (z = 0; z < this.length; z++) { - for (x = 0; x < this.width; x++) { - block = this.getBlock(x, y, z); - item = Item.getItemFromBlock(block); - itemDamage = this.metadata[x][y][z]; - - if (block == null || block == Blocks.air) { - continue; - } - - if (BlockInfo.BLOCK_LIST_IGNORE_BLOCK.contains(block)) { - continue; - } - - if (BlockInfo.BLOCK_LIST_IGNORE_METADATA.contains(block)) { - itemDamage = 0; - } - - Item tmp = BlockInfo.BLOCK_ITEM_MAP.get(block); - if (tmp != null) { - item = tmp; - Block blockFromItem = Block.getBlockFromItem(item); - if (blockFromItem != Blocks.air) { - block = blockFromItem; - } else { - itemDamage = 0; - } - } - - if (block instanceof BlockLog || block instanceof BlockLeavesBase) { - itemDamage &= 0x03; - } - - if (block instanceof BlockSlab) { - itemDamage &= 0x07; - } - - if (block instanceof BlockDoublePlant) { - if ((itemDamage & 0x08) == 0x08) { - continue; - } - } - - if (block == Blocks.cocoa) { - itemDamage = 0x03; - } - - if (item == Items.skull) { - TileEntity tileEntity = getTileEntity(x, y, z); - if (tileEntity instanceof TileEntitySkull) { - itemDamage = ((TileEntitySkull) tileEntity).func_145904_a(); - } - } - - itemStack = null; - for (ItemStack stack : this.blockList) { - if (stack.getItem() == item && stack.getItemDamage() == itemDamage) { - itemStack = stack; - itemStack.stackSize++; - break; - } - } - - if (itemStack == null) { - itemStack = new ItemStack(item, 1, itemDamage); - if (itemStack.getItem() != null) { - this.blockList.add(itemStack); - } - } - } - } - } - Collections.sort(this.blockList, BLOCK_COMPARATOR); - } - public int getBlockIdRaw(int x, int y, int z) { if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { return 0; @@ -403,7 +312,94 @@ public List getTileEntities() { } public List getBlockList() { - return this.blockList; + final List blockList = new ArrayList(); + + int x, y, z, itemDamage; + Block block; + Item item; + ItemStack itemStack; + + for (y = 0; y < this.height; y++) { + if (this.isRenderingLayer && y != this.renderingLayer) { + continue; + } + + for (z = 0; z < this.length; z++) { + for (x = 0; x < this.width; x++) { + block = this.getBlock(x, y, z); + item = Item.getItemFromBlock(block); + itemDamage = this.metadata[x][y][z]; + + if (block == null || block == Blocks.air) { + continue; + } + + if (BlockInfo.BLOCK_LIST_IGNORE_BLOCK.contains(block)) { + continue; + } + + if (BlockInfo.BLOCK_LIST_IGNORE_METADATA.contains(block)) { + itemDamage = 0; + } + + Item tmp = BlockInfo.BLOCK_ITEM_MAP.get(block); + if (tmp != null) { + item = tmp; + Block blockFromItem = Block.getBlockFromItem(item); + if (blockFromItem != Blocks.air) { + block = blockFromItem; + } else { + itemDamage = 0; + } + } + + if (block instanceof BlockLog || block instanceof BlockLeavesBase) { + itemDamage &= 0x03; + } + + if (block instanceof BlockSlab) { + itemDamage &= 0x07; + } + + if (block instanceof BlockDoublePlant) { + if ((itemDamage & 0x08) == 0x08) { + continue; + } + } + + if (block == Blocks.cocoa) { + itemDamage = 0x03; + } + + if (item == Items.skull) { + TileEntity tileEntity = getTileEntity(x, y, z); + if (tileEntity instanceof TileEntitySkull) { + itemDamage = ((TileEntitySkull) tileEntity).func_145904_a(); + } + } + + itemStack = null; + for (ItemStack stack : blockList) { + if (stack.getItem() == item && stack.getItemDamage() == itemDamage) { + itemStack = stack; + itemStack.stackSize++; + break; + } + } + + if (itemStack == null) { + itemStack = new ItemStack(item, 1, itemDamage); + if (itemStack.getItem() != null) { + blockList.add(itemStack); + } + } + } + } + } + + Collections.sort(blockList, BLOCK_COMPARATOR); + + return blockList; } public boolean toggleRendering() { From ac0a3311080a751d58a47cfa3406835e9cea91dd Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 10 Jan 2015 17:06:37 +0100 Subject: [PATCH 140/314] Fixed NPE, closes #67 --- .../github/lunatrius/schematica/handler/QueueTickHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 7640bff1..8fb5a762 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -29,7 +29,7 @@ public void onClientTick(TickEvent.ClientTickEvent event) { // TODO: find a better way... maybe? try { final EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; - if (player != null && !player.sendQueue.getNetworkManager().isLocalChannel()) { + if (player != null && player.sendQueue != null && !player.sendQueue.getNetworkManager().isLocalChannel()) { processQueue(); } } catch (Exception e) { From ab0f677a3acbf03603e07828a907f482175f35f7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 10 Jan 2015 17:44:47 +0100 Subject: [PATCH 141/314] Added the option to add extra air blocks for the rendering part. --- .../renderer/RendererSchematicChunk.java | 2 +- .../handler/ConfigurationHandler.java | 26 +++++++++++++++++++ .../lunatrius/schematica/reference/Names.java | 2 ++ .../assets/schematica/lang/en_US.lang | 2 ++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index b7e2c02c..7158859b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -274,7 +274,7 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, } } - boolean isAirBlock = mcWorld.isAirBlock(wx, wy, wz); + boolean isAirBlock = mcWorld.isAirBlock(wx, wy, wz) || ConfigurationHandler.isExtraAirBlock(mcBlock); if (!isAirBlock) { if (ConfigurationHandler.highlight && renderPass == 2) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index eebf0410..b7398505 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -6,13 +6,18 @@ import com.google.common.primitives.Ints; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.registry.GameData; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import java.io.File; import java.io.IOException; import java.util.ArrayDeque; +import java.util.HashSet; import java.util.Queue; +import java.util.Set; public class ConfigurationHandler { public static final ConfigurationHandler INSTANCE = new ConfigurationHandler(); @@ -40,6 +45,7 @@ public class ConfigurationHandler { public static final double TOOLTIPY_DEFAULT = 0; public static final String SCHEMATICDIRECTORY_STR = "schematics"; public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); + public static final String[] EXTRAAIRBLOCKS_DEFAULT = { }; public static final boolean PRINTERENABLED_DEFAULT = true; public static final boolean SAVEENABLED_DEFAULT = true; public static final boolean LOADENABLED_DEFAULT = true; @@ -64,6 +70,7 @@ public class ConfigurationHandler { public static float tooltipX = (float) TOOLTIPX_DEFAULT; public static float tooltipY = (float) TOOLTIPY_DEFAULT; public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; + public static String[] extraAirBlocks = EXTRAAIRBLOCKS_DEFAULT; public static boolean printerEnabled = PRINTERENABLED_DEFAULT; public static boolean saveEnabled = SAVEENABLED_DEFAULT; public static boolean loadEnabled = LOADENABLED_DEFAULT; @@ -87,11 +94,14 @@ public class ConfigurationHandler { public static Property propTooltipX = null; public static Property propTooltipY = null; public static Property propSchematicDirectory = null; + public static Property propExtraAirBlocks = null; public static Property propPrinterEnabled = null; public static Property propSaveEnabled = null; public static Property propLoadEnabled = null; public static Property propPlayerQuotaKilobytes = null; + private static final Set extraAirBlockList = new HashSet(); + public static void init(File configFile) { if (configuration == null) { configuration = new Configuration(configFile, VERSION); @@ -186,6 +196,18 @@ private static void loadConfiguration() { Reference.logger.warn("Could not canonize path!", e); } + propExtraAirBlocks = configuration.get(Names.Config.Category.GENERAL, Names.Config.EXTRA_AIR_BLOCKS, EXTRAAIRBLOCKS_DEFAULT, Names.Config.EXTRA_AIR_BLOCKS_DESC); + propExtraAirBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTRA_AIR_BLOCKS); + extraAirBlocks = propExtraAirBlocks.getStringList(); + + extraAirBlockList.clear(); + for (String name : extraAirBlocks) { + final Block block = GameData.getBlockRegistry().getObject(name); + if (block != Blocks.air) { + extraAirBlockList.add(block); + } + } + propPrinterEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.PRINTER_ENABLED, PRINTERENABLED_DEFAULT, Names.Config.PRINTER_ENABLED_DESC); propPrinterEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PRINTER_ENABLED); printerEnabled = propPrinterEnabled.getBoolean(PRINTERENABLED_DEFAULT); @@ -217,4 +239,8 @@ public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent loadConfiguration(); } } + + public static boolean isExtraAirBlock(final Block block) { + return extraAirBlockList.contains(block); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 63a5d56b..a5a0d679 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -50,6 +50,8 @@ public static final class Category { public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; + public static final String EXTRA_AIR_BLOCKS = "extraAirBlocks"; + public static final String EXTRA_AIR_BLOCKS_DESC = "Extra blocks to consider as air for the schematic renderer."; public static final String PRINTER_ENABLED = "printerEnabled"; public static final String PRINTER_ENABLED_DESC = "Allow players to use the printer."; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 213b8282..6daf5c49 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -85,6 +85,8 @@ schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. +schematica.config.extraAirBlocks=Extra Air Blocks +schematica.config.extraAirBlocks.tooltip=Extra blocks to consider as air for the schematic renderer. # gui - config - server schematica.config.printerEnabled=Allow Printer From 6cc8a586581ad8c47cb7e9e2ed1911f14eefca58 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 10 Jan 2015 17:58:59 +0100 Subject: [PATCH 142/314] Consistency stuff. --- .../handler/ConfigurationHandler.java | 158 +++++++++--------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index b7398505..a23f52cb 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -26,55 +26,55 @@ public class ConfigurationHandler { public static Configuration configuration; - public static final boolean ENABLEALPHA_DEFAULT = false; + public static final boolean ENABLE_ALPHA_DEFAULT = false; public static final double ALPHA_DEFAULT = 1.0; public static final boolean HIGHLIGHT_DEFAULT = true; - public static final boolean HIGHLIGHTAIR_DEFAULT = true; - public static final double BLOCKDELTA_DEFAULT = 0.005; - public static final boolean DRAWQUADS_DEFAULT = true; - public static final boolean DRAWLINES_DEFAULT = true; - public static final int PLACEDELAY_DEFAULT = 1; + public static final boolean HIGHLIGHT_AIR_DEFAULT = true; + public static final double BLOCK_DELTA_DEFAULT = 0.005; + public static final boolean DRAW_QUADS_DEFAULT = true; + public static final boolean DRAW_LINES_DEFAULT = true; + public static final int PLACE_DELAY_DEFAULT = 1; public static final int TIMEOUT_DEFAULT = 10; - public static final boolean PLACEINSTANTLY_DEFAULT = false; - public static final boolean DESTROYBLOCKS_DEFAULT = false; - public static final boolean DESTROYINSTANTLY_DEFAULT = false; - public static final boolean PLACEADJACENT_DEFAULT = true; - public static final int[] SWAPSLOTS_DEFAULT = new int[] { }; - public static final boolean TOOLTIPENABLED_DEFAULT = true; - public static final double TOOLTIPX_DEFAULT = 100; - public static final double TOOLTIPY_DEFAULT = 0; - public static final String SCHEMATICDIRECTORY_STR = "schematics"; - public static final File SCHEMATICDIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATICDIRECTORY_STR); - public static final String[] EXTRAAIRBLOCKS_DEFAULT = { }; - public static final boolean PRINTERENABLED_DEFAULT = true; - public static final boolean SAVEENABLED_DEFAULT = true; - public static final boolean LOADENABLED_DEFAULT = true; - public static final int PLAYERQUOTAKILOBYTES_DEFAULT = 8192; - - public static boolean enableAlpha = ENABLEALPHA_DEFAULT; + public static final boolean PLACE_INSTANTLY_DEFAULT = false; + public static final boolean DESTROY_BLOCKS_DEFAULT = false; + public static final boolean DESTROY_INSTANTLY_DEFAULT = false; + public static final boolean PLACE_ADJACENT_DEFAULT = true; + public static final int[] SWAP_SLOTS_DEFAULT = new int[] { }; + public static final boolean TOOLTIP_ENABLED_DEFAULT = true; + public static final double TOOLTIP_X_DEFAULT = 100; + public static final double TOOLTIP_Y_DEFAULT = 0; + public static final String SCHEMATIC_DIRECTORY_STR = "schematics"; + public static final File SCHEMATIC_DIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATIC_DIRECTORY_STR); + public static final String[] EXTRA_AIR_BLOCKS_DEFAULT = { }; + public static final boolean PRINTER_ENABLED_DEFAULT = true; + public static final boolean SAVE_ENABLED_DEFAULT = true; + public static final boolean LOAD_ENABLED_DEFAULT = true; + public static final int PLAYER_QUOTA_KILOBYTES_DEFAULT = 8192; + + public static boolean enableAlpha = ENABLE_ALPHA_DEFAULT; public static float alpha = (float) ALPHA_DEFAULT; public static boolean highlight = HIGHLIGHT_DEFAULT; - public static boolean highlightAir = HIGHLIGHTAIR_DEFAULT; - public static float blockDelta = (float) BLOCKDELTA_DEFAULT; - public static boolean drawQuads = DRAWQUADS_DEFAULT; - public static boolean drawLines = DRAWLINES_DEFAULT; - public static int placeDelay = PLACEDELAY_DEFAULT; + public static boolean highlightAir = HIGHLIGHT_AIR_DEFAULT; + public static float blockDelta = (float) BLOCK_DELTA_DEFAULT; + public static boolean drawQuads = DRAW_QUADS_DEFAULT; + public static boolean drawLines = DRAW_LINES_DEFAULT; + public static int placeDelay = PLACE_DELAY_DEFAULT; public static int timeout = TIMEOUT_DEFAULT; - public static boolean placeInstantly = PLACEINSTANTLY_DEFAULT; - public static boolean destroyBlocks = DESTROYBLOCKS_DEFAULT; - public static boolean destroyInstantly = DESTROYINSTANTLY_DEFAULT; - public static boolean placeAdjacent = PLACEADJACENT_DEFAULT; - public static int[] swapSlots = SWAPSLOTS_DEFAULT; + public static boolean placeInstantly = PLACE_INSTANTLY_DEFAULT; + public static boolean destroyBlocks = DESTROY_BLOCKS_DEFAULT; + public static boolean destroyInstantly = DESTROY_INSTANTLY_DEFAULT; + public static boolean placeAdjacent = PLACE_ADJACENT_DEFAULT; + public static int[] swapSlots = SWAP_SLOTS_DEFAULT; public static Queue swapSlotsQueue = new ArrayDeque(); - public static boolean tooltipEnabled = TOOLTIPENABLED_DEFAULT; - public static float tooltipX = (float) TOOLTIPX_DEFAULT; - public static float tooltipY = (float) TOOLTIPY_DEFAULT; - public static File schematicDirectory = SCHEMATICDIRECTORY_DEFAULT; - public static String[] extraAirBlocks = EXTRAAIRBLOCKS_DEFAULT; - public static boolean printerEnabled = PRINTERENABLED_DEFAULT; - public static boolean saveEnabled = SAVEENABLED_DEFAULT; - public static boolean loadEnabled = LOADENABLED_DEFAULT; - public static int playerQuotaKilobytes = PLAYERQUOTAKILOBYTES_DEFAULT; + public static boolean tooltipEnabled = TOOLTIP_ENABLED_DEFAULT; + public static float tooltipX = (float) TOOLTIP_X_DEFAULT; + public static float tooltipY = (float) TOOLTIP_Y_DEFAULT; + public static File schematicDirectory = SCHEMATIC_DIRECTORY_DEFAULT; + public static String[] extraAirBlocks = EXTRA_AIR_BLOCKS_DEFAULT; + public static boolean printerEnabled = PRINTER_ENABLED_DEFAULT; + public static boolean saveEnabled = SAVE_ENABLED_DEFAULT; + public static boolean loadEnabled = LOAD_ENABLED_DEFAULT; + public static int playerQuotaKilobytes = PLAYER_QUOTA_KILOBYTES_DEFAULT; public static Property propEnableAlpha = null; public static Property propAlpha = null; @@ -110,9 +110,9 @@ public static void init(File configFile) { } private static void loadConfiguration() { - propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLEALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); + propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLE_ALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); propEnableAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA_ENABLED); - enableAlpha = propEnableAlpha.getBoolean(ENABLEALPHA_DEFAULT); + enableAlpha = propEnableAlpha.getBoolean(ENABLE_ALPHA_DEFAULT); propAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA, ALPHA_DEFAULT, Names.Config.ALPHA_DESC, 0.0, 1.0); propAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA); @@ -122,64 +122,64 @@ private static void loadConfiguration() { propHighlight.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT); highlight = propHighlight.getBoolean(HIGHLIGHT_DEFAULT); - propHighlightAir = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT_AIR, HIGHLIGHTAIR_DEFAULT, Names.Config.HIGHLIGHT_AIR_DESC); + propHighlightAir = configuration.get(Names.Config.Category.RENDER, Names.Config.HIGHLIGHT_AIR, HIGHLIGHT_AIR_DEFAULT, Names.Config.HIGHLIGHT_AIR_DESC); propHighlightAir.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.HIGHLIGHT_AIR); - highlightAir = propHighlightAir.getBoolean(HIGHLIGHTAIR_DEFAULT); + highlightAir = propHighlightAir.getBoolean(HIGHLIGHT_AIR_DEFAULT); - propBlockDelta = configuration.get(Names.Config.Category.RENDER, Names.Config.BLOCK_DELTA, BLOCKDELTA_DEFAULT, Names.Config.BLOCK_DELTA_DESC, 0.0, 0.2); + propBlockDelta = configuration.get(Names.Config.Category.RENDER, Names.Config.BLOCK_DELTA, BLOCK_DELTA_DEFAULT, Names.Config.BLOCK_DELTA_DESC, 0.0, 0.2); propBlockDelta.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.BLOCK_DELTA); - blockDelta = (float) propBlockDelta.getDouble(BLOCKDELTA_DEFAULT); + blockDelta = (float) propBlockDelta.getDouble(BLOCK_DELTA_DEFAULT); - propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAWQUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); + propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAW_QUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); propDrawQuads.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_QUADS); - drawQuads = propDrawQuads.getBoolean(DRAWQUADS_DEFAULT); + drawQuads = propDrawQuads.getBoolean(DRAW_QUADS_DEFAULT); - propDrawLines = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_LINES, DRAWLINES_DEFAULT, Names.Config.DRAW_LINES_DESC); + propDrawLines = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_LINES, DRAW_LINES_DEFAULT, Names.Config.DRAW_LINES_DESC); propDrawLines.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_LINES); - drawLines = propDrawLines.getBoolean(DRAWLINES_DEFAULT); + drawLines = propDrawLines.getBoolean(DRAW_LINES_DEFAULT); - propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACEDELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); + propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACE_DELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); propPlaceDelay.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DELAY); - placeDelay = propPlaceDelay.getInt(PLACEDELAY_DEFAULT); + placeDelay = propPlaceDelay.getInt(PLACE_DELAY_DEFAULT); propTimeout = configuration.get(Names.Config.Category.PRINTER, Names.Config.TIMEOUT, TIMEOUT_DEFAULT, Names.Config.TIMEOUT_DESC, 0, 100); propTimeout.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TIMEOUT); timeout = propTimeout.getInt(TIMEOUT_DEFAULT); - propPlaceInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_INSTANTLY, PLACEINSTANTLY_DEFAULT, Names.Config.PLACE_INSTANTLY_DESC); + propPlaceInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_INSTANTLY, PLACE_INSTANTLY_DEFAULT, Names.Config.PLACE_INSTANTLY_DESC); propPlaceInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_INSTANTLY); - placeInstantly = propPlaceInstantly.getBoolean(PLACEINSTANTLY_DEFAULT); + placeInstantly = propPlaceInstantly.getBoolean(PLACE_INSTANTLY_DEFAULT); - propDestroyBlocks = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_BLOCKS, DESTROYBLOCKS_DEFAULT, Names.Config.DESTROY_BLOCKS_DESC); + propDestroyBlocks = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_BLOCKS, DESTROY_BLOCKS_DEFAULT, Names.Config.DESTROY_BLOCKS_DESC); propDestroyBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_BLOCKS); - destroyBlocks = propDestroyBlocks.getBoolean(DESTROYBLOCKS_DEFAULT); + destroyBlocks = propDestroyBlocks.getBoolean(DESTROY_BLOCKS_DEFAULT); - propDestroyInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_INSTANTLY, DESTROYINSTANTLY_DEFAULT, Names.Config.DESTROY_INSTANTLY_DESC); + propDestroyInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.DESTROY_INSTANTLY, DESTROY_INSTANTLY_DEFAULT, Names.Config.DESTROY_INSTANTLY_DESC); propDestroyInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DESTROY_INSTANTLY); - destroyInstantly = propDestroyInstantly.getBoolean(DESTROYINSTANTLY_DEFAULT); + destroyInstantly = propDestroyInstantly.getBoolean(DESTROY_INSTANTLY_DEFAULT); - propPlaceAdjacent = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_ADJACENT, PLACEADJACENT_DEFAULT, Names.Config.PLACE_ADJACENT_DESC); + propPlaceAdjacent = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_ADJACENT, PLACE_ADJACENT_DEFAULT, Names.Config.PLACE_ADJACENT_DESC); propPlaceAdjacent.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_ADJACENT); - placeAdjacent = propPlaceAdjacent.getBoolean(PLACEADJACENT_DEFAULT); + placeAdjacent = propPlaceAdjacent.getBoolean(PLACE_ADJACENT_DEFAULT); - propSwapSlots = configuration.get(Names.Config.Category.PRINTER, Names.Config.SWAP_SLOTS, SWAPSLOTS_DEFAULT, Names.Config.SWAP_SLOTS_DESC, 0, 8); + propSwapSlots = configuration.get(Names.Config.Category.PRINTER, Names.Config.SWAP_SLOTS, SWAP_SLOTS_DEFAULT, Names.Config.SWAP_SLOTS_DESC, 0, 8); propSwapSlots.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SWAP_SLOTS); swapSlots = propSwapSlots.getIntList(); swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); - propTooltipEnabled = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_ENABLED, TOOLTIPENABLED_DEFAULT, Names.Config.TOOLTIP_ENABLED_DESC); + propTooltipEnabled = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_ENABLED, TOOLTIP_ENABLED_DEFAULT, Names.Config.TOOLTIP_ENABLED_DESC); propTooltipEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_ENABLED); - tooltipEnabled = propTooltipEnabled.getBoolean(TOOLTIPENABLED_DEFAULT); + tooltipEnabled = propTooltipEnabled.getBoolean(TOOLTIP_ENABLED_DEFAULT); - propTooltipX = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_X, TOOLTIPX_DEFAULT, Names.Config.TOOLTIP_X_DESC, 0, 100); + propTooltipX = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_X, TOOLTIP_X_DEFAULT, Names.Config.TOOLTIP_X_DESC, 0, 100); propTooltipX.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_X); - tooltipX = (float) propTooltipX.getDouble(TOOLTIPX_DEFAULT); + tooltipX = (float) propTooltipX.getDouble(TOOLTIP_X_DEFAULT); - propTooltipY = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_Y, TOOLTIPY_DEFAULT, Names.Config.TOOLTIP_Y_DESC, 0, 100); + propTooltipY = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_Y, TOOLTIP_Y_DEFAULT, Names.Config.TOOLTIP_Y_DESC, 0, 100); propTooltipY.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_Y); - tooltipY = (float) propTooltipY.getDouble(TOOLTIPY_DEFAULT); + tooltipY = (float) propTooltipY.getDouble(TOOLTIP_Y_DEFAULT); - propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATICDIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); + propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATIC_DIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); schematicDirectory = new File(propSchematicDirectory.getString()); @@ -196,7 +196,7 @@ private static void loadConfiguration() { Reference.logger.warn("Could not canonize path!", e); } - propExtraAirBlocks = configuration.get(Names.Config.Category.GENERAL, Names.Config.EXTRA_AIR_BLOCKS, EXTRAAIRBLOCKS_DEFAULT, Names.Config.EXTRA_AIR_BLOCKS_DESC); + propExtraAirBlocks = configuration.get(Names.Config.Category.GENERAL, Names.Config.EXTRA_AIR_BLOCKS, EXTRA_AIR_BLOCKS_DEFAULT, Names.Config.EXTRA_AIR_BLOCKS_DESC); propExtraAirBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTRA_AIR_BLOCKS); extraAirBlocks = propExtraAirBlocks.getStringList(); @@ -208,21 +208,21 @@ private static void loadConfiguration() { } } - propPrinterEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.PRINTER_ENABLED, PRINTERENABLED_DEFAULT, Names.Config.PRINTER_ENABLED_DESC); + propPrinterEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.PRINTER_ENABLED, PRINTER_ENABLED_DEFAULT, Names.Config.PRINTER_ENABLED_DESC); propPrinterEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PRINTER_ENABLED); - printerEnabled = propPrinterEnabled.getBoolean(PRINTERENABLED_DEFAULT); + printerEnabled = propPrinterEnabled.getBoolean(PRINTER_ENABLED_DEFAULT); - propSaveEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.SAVE_ENABLED, SAVEENABLED_DEFAULT, Names.Config.SAVE_ENABLED_DESC); + propSaveEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.SAVE_ENABLED, SAVE_ENABLED_DEFAULT, Names.Config.SAVE_ENABLED_DESC); propSaveEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SAVE_ENABLED); - saveEnabled = propSaveEnabled.getBoolean(SAVEENABLED_DEFAULT); + saveEnabled = propSaveEnabled.getBoolean(SAVE_ENABLED_DEFAULT); - propLoadEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.LOAD_ENABLED, LOADENABLED_DEFAULT, Names.Config.LOAD_ENABLED_DESC); + propLoadEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.LOAD_ENABLED, LOAD_ENABLED_DEFAULT, Names.Config.LOAD_ENABLED_DESC); propLoadEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.LOAD_ENABLED); - loadEnabled = propLoadEnabled.getBoolean(LOADENABLED_DEFAULT); + loadEnabled = propLoadEnabled.getBoolean(LOAD_ENABLED_DEFAULT); - propPlayerQuotaKilobytes = configuration.get(Names.Config.Category.SERVER, Names.Config.PLAYER_QUOTA_KILOBYTES, PLAYERQUOTAKILOBYTES_DEFAULT, Names.Config.PLAYER_QUOTA_KILOBYTES_DESC); + propPlayerQuotaKilobytes = configuration.get(Names.Config.Category.SERVER, Names.Config.PLAYER_QUOTA_KILOBYTES, PLAYER_QUOTA_KILOBYTES_DEFAULT, Names.Config.PLAYER_QUOTA_KILOBYTES_DESC); propPlayerQuotaKilobytes.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLAYER_QUOTA_KILOBYTES); - playerQuotaKilobytes = propPlayerQuotaKilobytes.getInt(PLAYERQUOTAKILOBYTES_DEFAULT); + playerQuotaKilobytes = propPlayerQuotaKilobytes.getInt(PLAYER_QUOTA_KILOBYTES_DEFAULT); Schematica.proxy.createFolders(); From 1aba3b3964f3a558d05ebd4e0b0ee7f28f006004 Mon Sep 17 00:00:00 2001 From: Steven Blom Date: Tue, 13 Jan 2015 23:45:53 +1030 Subject: [PATCH 143/314] API for hooking into the Schematic Saving process. --- gradle/scripts/artifacts.gradle | 9 ++ .../lunatrius/schematica/api/ISchematic.java | 123 ++++++++++++++++++ .../api/event/DuplicateMappingException.java | 8 ++ .../api/event/PostSchematicCaptureEvent.java | 25 ++++ .../api/event/PreSchematicSaveEvent.java | 56 ++++++++ .../schematica/api/event/package-info.java | 4 + .../schematica/api/package-info.java | 4 + .../schematica/handler/QueueTickHandler.java | 4 + .../lunatrius/schematica/reference/Names.java | 1 + .../world/schematic/SchematicAlpha.java | 23 +++- 10 files changed, 253 insertions(+), 4 deletions(-) create mode 100644 src/api/java/com/github/lunatrius/schematica/api/ISchematic.java create mode 100644 src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java create mode 100644 src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java create mode 100644 src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java create mode 100644 src/api/java/com/github/lunatrius/schematica/api/event/package-info.java create mode 100644 src/api/java/com/github/lunatrius/schematica/api/package-info.java diff --git a/gradle/scripts/artifacts.gradle b/gradle/scripts/artifacts.gradle index a9a640b1..7a527225 100644 --- a/gradle/scripts/artifacts.gradle +++ b/gradle/scripts/artifacts.gradle @@ -11,17 +11,26 @@ jar { task devJar(dependsOn: 'classes', type: Jar) { from sourceSets.main.output + from sourceSets.api.output classifier = 'dev' manifest commonManifest } task sourceJar(dependsOn: 'classes', type: Jar) { from sourceSets.main.allSource + from sourceSets.api.allSource classifier = 'sources' manifest commonManifest } +task apiJar(dependsOn: 'classes', type: Jar) { + from sourceSets.api.output + classifier = 'api' + manifest commonManifest +} + artifacts { archives devJar archives sourceJar + archives apiJar } diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java new file mode 100644 index 00000000..e6527875 --- /dev/null +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -0,0 +1,123 @@ +package com.github.lunatrius.schematica.api; + +import com.github.lunatrius.core.util.vector.Vector3f; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.List; + +public interface ISchematic { + /** + * Gets a block at a given location within the schematic. Requesting a block outside of those bounds returns Air. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @return the block at the requested location. + */ + Block getBlock(int x, int y, int z); + + /** + * Sets the block at the given location, metadata will be set to 0. Attempting to set a block outside of the schematic + * boundaries or with an invalid block will result in no change being made and this method will return false. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @param block the Block to set + * @return true if the block was succesfully set. + */ + boolean setBlock(int x, int y, int z, Block block); + + /** + * Sets the block and metadata at the given location. Attempting to set a block outside of the schematic + * boundaries or with an invalid block will result in no change being made and this method will return false. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @param block the Block to set + * @param metadata the metadata value to set. + * @return true if the block was succesfully set. + */ + boolean setBlock(int x, int y, int z, Block block, int metadata); + + /** + * Gets the Tile Entity at the requested location. If no tile entity exists at that location, null will be returned. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @return the located tile entity. + */ + TileEntity getTileEntity(int x, int y, int z); + + /** + * returns a list of all tile entities in the schematic. + * @return all tile entities. + */ + List getTileEntities(); + + /** + * Add or replace a tile entity to a block at the requested location. Does nothing if the location is out of bounds. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @param tileEntity the Tile Entity to set. + */ + void setTileEntity(int x, int y, int z, TileEntity tileEntity); + + /** + * Removes a Tile Entity from the specific location if it exists, otherwise it silently continues. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + */ + void removeTileEntity(int x, int y, int z); + + /** + * Gets the metadata of the block at the requested location. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @return the Metadata Value + */ + int getBlockMetadata(int x, int y, int z); + + /** + * Modify the metadata of the block at the requested location. + * @param x the X coord in world space. + * @param y the Y coord in world space. + * @param z the Z coord in world space. + * @param metadata the Metadata Value + */ + void setBlockMetadata(int x, int y, int z, int metadata); + + /** + * Retrieves the icon that will be used to save the schematic. + * @return the schematic's future icon. + */ + ItemStack getIcon(); + + /** + * Modifies the icon that will be used when saving the schematic. + * @param icon an ItemStack of the Item you wish you use as the icon. + */ + void setIcon(ItemStack icon); + + /** + * The width of the schematic + * @return the schematic width + */ + int getWidth(); + + /** + * The length of the schematic + * @return the schematic length + */ + int getLength(); + + /** + * The height of the schematic + * @return the schematic height + */ + int getHeight(); +} diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java b/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java new file mode 100644 index 00000000..52019d85 --- /dev/null +++ b/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java @@ -0,0 +1,8 @@ +package com.github.lunatrius.schematica.api.event; + +public class DuplicateMappingException extends Exception { + + public DuplicateMappingException(String s) { + super(s); + } +} diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java new file mode 100644 index 00000000..88eddb03 --- /dev/null +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java @@ -0,0 +1,25 @@ +package com.github.lunatrius.schematica.api.event; + +import com.github.lunatrius.schematica.api.ISchematic; +import cpw.mods.fml.common.eventhandler.Event; + +/** + * This event is fired after an ISchematic has been created out of a part of the world. + * This is an appropriate place to modify the schematic's blocks, metadata and tile entities before they are persisted. + * Register to this event using MinecraftForge.EVENT_BUS + */ +public class PostSchematicCaptureEvent extends Event { + private final ISchematic schematic; + + public PostSchematicCaptureEvent(ISchematic schematic) { + this.schematic = schematic; + } + + /** + * The collected schematic + * @return the schematic that was just generated. + */ + public ISchematic getSchematic() { + return schematic; + } +} diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java new file mode 100644 index 00000000..c6d422c9 --- /dev/null +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java @@ -0,0 +1,56 @@ +package com.github.lunatrius.schematica.api.event; + +import cpw.mods.fml.common.eventhandler.Event; +import net.minecraft.nbt.NBTTagCompound; +import java.util.Map; + +/** + * This event is fired after the schematic has been Captured, but before it is serialized to the schematic format. + * This is your opportunity to add Metadata. + * Register to this event using MinecraftForge.EVENT_BUS + */ +public class PreSchematicSaveEvent extends Event { + private final Map mappings; + + /** + * The Extended Metadata tag compound provides a facility to add custom metadata to the schematic. + */ + public final NBTTagCompound extendedMetadata; + + public PreSchematicSaveEvent(Map mappings) { + this.mappings = mappings; + this.extendedMetadata = new NBTTagCompound(); + } + + /** + * Replaces the block mapping from one name to another. Use this method with care as it is possible that the schematic + * will not be usable or will have blocks missing if you use an invalid value. + * + * Attempting to remap two blocks to the same name will result in a DuplicateMappingException. If you wish for this + * type of collision, you can work around it by merging the two sets of block into a single BlockType in the + * PostSchematicCaptureEvent. + * @param oldName The old name of the block mapping. + * @param newName The new name of the block Mapping. + * @return true if a mapping was replaced. + * @throws DuplicateMappingException + */ + public boolean replaceMapping(String oldName, String newName) throws DuplicateMappingException { + if (this.mappings.containsKey(newName)) { + throw new DuplicateMappingException( + String.format( + "Could not replace block type %s, the block type %s already exists in the schematic.", + oldName, newName + ) + ); + } + + Short id = this.mappings.get(oldName); + if (id != null) { + this.mappings.remove(oldName); + this.mappings.put(newName, id); + return true; + } + + return false; + } +} diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java new file mode 100644 index 00000000..0b063b97 --- /dev/null +++ b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "SchematicaAPI", apiVersion = "1.0", provides = "SchematicaAPI|Events") +package com.github.lunatrius.schematica.api.event; + +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/api/java/com/github/lunatrius/schematica/api/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/package-info.java new file mode 100644 index 00000000..7ea63429 --- /dev/null +++ b/src/api/java/com/github/lunatrius/schematica/api/package-info.java @@ -0,0 +1,4 @@ +@API(owner = "SchematicaAPI", apiVersion = "1.0", provides = "SchematicaAPI") +package com.github.lunatrius.schematica.api; + +import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 8fb5a762..a40e48fc 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -68,6 +68,10 @@ private void processQueue() { if (container.hasNext()) { this.queue.offer(container); } else { + //TODO: Post Event on the bus. + //final PostSchematicCaptureEvent event = new PostSchematicCaptureEvent(container.schematic); + //MinecraftForge.EVENT_BUS.post(event); + final boolean success = SchematicFormat.writeToFile(container.file, container.schematic); final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; container.player.addChatMessage(new ChatComponentTranslation(message, container.file.getName())); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index a5a0d679..b472f13e 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -151,6 +151,7 @@ public static final class NBT { public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; public static final String TILE_ENTITIES = "TileEntities"; public static final String ENTITIES = "Entities"; + public static final String EXTENDED_METADATA = "ExtendedMetadata"; } public static final class SBC { diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 726ea767..247c84cf 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.schematica.api.event.PreSchematicSaveEvent; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -106,8 +107,8 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { byte extraBlocks[] = new byte[size]; byte extraBlocksNibble[] = new byte[(int) Math.ceil(size / 2.0)]; boolean extra = false; - NBTTagCompound mapping = new NBTTagCompound(); + Map mappings = new HashMap(); for (int x = 0; x < world.getWidth(); x++) { for (int y = 0; y < world.getHeight(); y++) { for (int z = 0; z < world.getLength(); z++) { @@ -120,8 +121,8 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } String name = GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)); - if (!mapping.hasKey(name)) { - mapping.setShort(name, (short) blockId); + if (!mappings.containsKey(name)) { + mappings.put(name, (short)blockId); } } } @@ -154,6 +155,16 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } } + + PreSchematicSaveEvent event = new PreSchematicSaveEvent(mappings); + //TODO: Post event on the bus. + //MinecraftForge.EVENT_BUS.post(event); + + NBTTagCompound nbtMapping = new NBTTagCompound(); + for (Map.Entry entry : mappings.entrySet()) { + nbtMapping.setShort(entry.getKey(), entry.getValue()); + } + tagCompound.setString(Names.NBT.MATERIALS, Names.NBT.FORMAT_ALPHA); tagCompound.setByteArray(Names.NBT.BLOCKS, localBlocks); tagCompound.setByteArray(Names.NBT.DATA, localMetadata); @@ -162,7 +173,11 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } tagCompound.setTag(Names.NBT.ENTITIES, new NBTTagList()); tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); - tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, mapping); + tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, nbtMapping); + final NBTTagCompound extendedMetadata = event.extendedMetadata; + if (!extendedMetadata.hasNoTags()) { + tagCompound.setTag(Names.NBT.EXTENDED_METADATA, extendedMetadata); + } return true; } From 36f9fe79428f6f4e2e9194ccb3e4468fa5c96ed8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 17:53:08 +0100 Subject: [PATCH 144/314] Moved the nibble array construction bellow the tile entity serialization. Post the pre save event to the forge bus. --- .../world/schematic/SchematicAlpha.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 247c84cf..df0e412f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; import java.util.ArrayList; @@ -122,20 +123,12 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { String name = GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)); if (!mappings.containsKey(name)) { - mappings.put(name, (short)blockId); + mappings.put(name, (short) blockId); } } } } - for (int i = 0; i < extraBlocksNibble.length; i++) { - if (i * 2 + 1 < extraBlocks.length) { - extraBlocksNibble[i] = (byte) ((extraBlocks[i * 2 + 0] << 4) | extraBlocks[i * 2 + 1]); - } else { - extraBlocksNibble[i] = (byte) (extraBlocks[i * 2 + 0] << 4); - } - } - int count = 20; NBTTagList tileEntitiesList = new NBTTagList(); for (TileEntity tileEntity : world.getTileEntities()) { @@ -155,10 +148,16 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { } } + for (int i = 0; i < extraBlocksNibble.length; i++) { + if (i * 2 + 1 < extraBlocks.length) { + extraBlocksNibble[i] = (byte) ((extraBlocks[i * 2 + 0] << 4) | extraBlocks[i * 2 + 1]); + } else { + extraBlocksNibble[i] = (byte) (extraBlocks[i * 2 + 0] << 4); + } + } PreSchematicSaveEvent event = new PreSchematicSaveEvent(mappings); - //TODO: Post event on the bus. - //MinecraftForge.EVENT_BUS.post(event); + MinecraftForge.EVENT_BUS.post(event); NBTTagCompound nbtMapping = new NBTTagCompound(); for (Map.Entry entry : mappings.entrySet()) { From 225b1936157b37641bbd382b963a87c722e5a4a5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 18:03:09 +0100 Subject: [PATCH 145/314] Added the ISchematic implementation. --- .../schematica/world/storage/Schematic.java | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java new file mode 100644 index 00000000..7c373f31 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -0,0 +1,156 @@ +package com.github.lunatrius.schematica.world.storage; + +import com.github.lunatrius.schematica.api.ISchematic; +import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; +import cpw.mods.fml.common.registry.GameData; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class Schematic implements ISchematic { + private static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + + private ItemStack icon; + private final short[][][] blocks; + private final byte[][][] metadata; + private final List tileEntities = new ArrayList(); + private final int width; + private final int height; + private final int length; + + public Schematic(final int width, final int height, final int length) { + this.icon = DEFAULT_ICON.copy(); + this.blocks = new short[width][height][length]; + this.metadata = new byte[width][height][length]; + + this.width = width; + this.height = height; + this.length = length; + } + + @Override + public Block getBlock(final int x, final int y, final int z) { + if (!isValid(x, y, z)) { + return Blocks.air; + } + + return BLOCK_REGISTRY.getObjectById(this.blocks[x][y][z]); + } + + @Override + public boolean setBlock(final int x, final int y, final int z, final Block block) { + return setBlock(x, y, z, block, 0); + } + + @Override + public boolean setBlock(final int x, final int y, final int z, final Block block, final int metadata) { + if (!isValid(x, y, z)) { + return false; + } + + final int id = BLOCK_REGISTRY.getId(block); + if (id == -1) { + return false; + } + + this.blocks[x][y][z] = (short) id; + setBlockMetadata(x, y, z, metadata); + return true; + } + + @Override + public TileEntity getTileEntity(final int x, final int y, final int z) { + for (final TileEntity tileEntity : this.tileEntities) { + if (tileEntity.xCoord == x || tileEntity.yCoord == y || tileEntity.zCoord == z) { + return tileEntity; + } + } + + return null; + } + + @Override + public List getTileEntities() { + return this.tileEntities; + } + + @Override + public void setTileEntity(final int x, final int y, final int z, final TileEntity tileEntity) { + if (!isValid(x, y, z)) { + return; + } + + this.removeTileEntity(x, y, z); + + this.tileEntities.add(tileEntity); + } + + @Override + public void removeTileEntity(final int x, final int y, final int z) { + final Iterator iterator = this.tileEntities.iterator(); + + while (iterator.hasNext()) { + final TileEntity tileEntity = iterator.next(); + if (tileEntity.xCoord == x || tileEntity.yCoord == y || tileEntity.zCoord == z) { + iterator.remove(); + } + } + } + + @Override + public int getBlockMetadata(final int x, final int y, final int z) { + if (!isValid(x, y, z)) { + return 0; + } + + return this.metadata[x][y][z]; + } + + @Override + public void setBlockMetadata(final int x, final int y, final int z, final int metadata) { + if (!isValid(x, y, z)) { + return; + } + + this.metadata[x][y][z] = (byte) (metadata & 0x0F); + } + + @Override + public ItemStack getIcon() { + return this.icon; + } + + @Override + public void setIcon(final ItemStack icon) { + if (icon != null) { + this.icon = icon; + } else { + this.icon = DEFAULT_ICON.copy(); + } + } + + @Override + public int getWidth() { + return this.width; + } + + @Override + public int getLength() { + return this.length; + } + + @Override + public int getHeight() { + return this.height; + } + + private boolean isValid(final int x, final int y, final int z) { + return !(x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length); + } +} From bc2a28a3d6dee81094b421d92e2cc3518a34b1d1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 18:11:21 +0100 Subject: [PATCH 146/314] Exposed the schematic field in PostSchematicCaptureEvent and removed the getter. --- .../api/event/DuplicateMappingException.java | 1 - .../api/event/PostSchematicCaptureEvent.java | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java b/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java index 52019d85..a2791d0f 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java @@ -1,7 +1,6 @@ package com.github.lunatrius.schematica.api.event; public class DuplicateMappingException extends Exception { - public DuplicateMappingException(String s) { super(s); } diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java index 88eddb03..017108da 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java @@ -9,17 +9,12 @@ * Register to this event using MinecraftForge.EVENT_BUS */ public class PostSchematicCaptureEvent extends Event { - private final ISchematic schematic; + /** + * The schematic that was just generated. + */ + public final ISchematic schematic; public PostSchematicCaptureEvent(ISchematic schematic) { this.schematic = schematic; } - - /** - * The collected schematic - * @return the schematic that was just generated. - */ - public ISchematic getSchematic() { - return schematic; - } } From 0a59d76d01d8dc44418bdec5c44ab67fb35ccec0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 19:41:14 +0100 Subject: [PATCH 147/314] Slight change to the API. --- .../github/lunatrius/schematica/api/ISchematic.java | 10 ++++++---- .../lunatrius/schematica/world/storage/Schematic.java | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java index e6527875..9c6ae298 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -25,7 +25,7 @@ public interface ISchematic { * @param y the Y coord in world space. * @param z the Z coord in world space. * @param block the Block to set - * @return true if the block was succesfully set. + * @return true if the block was successfully set. */ boolean setBlock(int x, int y, int z, Block block); @@ -37,7 +37,7 @@ public interface ISchematic { * @param z the Z coord in world space. * @param block the Block to set * @param metadata the metadata value to set. - * @return true if the block was succesfully set. + * @return true if the block was successfully set. */ boolean setBlock(int x, int y, int z, Block block, int metadata); @@ -83,13 +83,15 @@ public interface ISchematic { int getBlockMetadata(int x, int y, int z); /** - * Modify the metadata of the block at the requested location. + * Modify the metadata of the block at the requested location. Attempting to set metadata outside of the schematic + * boundaries will result in no change being made and this method will return false. * @param x the X coord in world space. * @param y the Y coord in world space. * @param z the Z coord in world space. * @param metadata the Metadata Value + * @return true if the block was successfully set. */ - void setBlockMetadata(int x, int y, int z, int metadata); + boolean setBlockMetadata(int x, int y, int z, int metadata); /** * Retrieves the icon that will be used to save the schematic. diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index 7c373f31..959d7d0a 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -113,12 +113,13 @@ public int getBlockMetadata(final int x, final int y, final int z) { } @Override - public void setBlockMetadata(final int x, final int y, final int z, final int metadata) { + public boolean setBlockMetadata(final int x, final int y, final int z, final int metadata) { if (!isValid(x, y, z)) { - return; + return false; } this.metadata[x][y][z] = (byte) (metadata & 0x0F); + return true; } @Override From f29da79927e806dcfe956e505a2b62bb16b42e1a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 20:46:59 +0100 Subject: [PATCH 148/314] Set the correct API owner. --- .../github/lunatrius/schematica/api/event/package-info.java | 2 +- .../com/github/lunatrius/schematica/api/package-info.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java index 0b063b97..284a7877 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java @@ -1,4 +1,4 @@ @API(owner = "SchematicaAPI", apiVersion = "1.0", provides = "SchematicaAPI|Events") package com.github.lunatrius.schematica.api.event; -import cpw.mods.fml.common.API; \ No newline at end of file +import cpw.mods.fml.common.API; diff --git a/src/api/java/com/github/lunatrius/schematica/api/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/package-info.java index 7ea63429..cb0a33be 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/package-info.java +++ b/src/api/java/com/github/lunatrius/schematica/api/package-info.java @@ -1,4 +1,4 @@ -@API(owner = "SchematicaAPI", apiVersion = "1.0", provides = "SchematicaAPI") +@API(owner = "Schematica", apiVersion = "1.0", provides = "SchematicaAPI") package com.github.lunatrius.schematica.api; -import cpw.mods.fml.common.API; \ No newline at end of file +import cpw.mods.fml.common.API; From a407600411fb2d356ab0e270594bf27396c1797a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 21:53:46 +0100 Subject: [PATCH 149/314] || != && --- .../lunatrius/schematica/world/storage/Schematic.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index 959d7d0a..2c3cd892 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -24,8 +24,8 @@ public class Schematic implements ISchematic { private final int height; private final int length; - public Schematic(final int width, final int height, final int length) { - this.icon = DEFAULT_ICON.copy(); + public Schematic(final ItemStack icon, final int width, final int height, final int length) { + this.icon = icon; this.blocks = new short[width][height][length]; this.metadata = new byte[width][height][length]; @@ -67,7 +67,7 @@ public boolean setBlock(final int x, final int y, final int z, final Block block @Override public TileEntity getTileEntity(final int x, final int y, final int z) { for (final TileEntity tileEntity : this.tileEntities) { - if (tileEntity.xCoord == x || tileEntity.yCoord == y || tileEntity.zCoord == z) { + if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { return tileEntity; } } @@ -97,7 +97,7 @@ public void removeTileEntity(final int x, final int y, final int z) { while (iterator.hasNext()) { final TileEntity tileEntity = iterator.next(); - if (tileEntity.xCoord == x || tileEntity.yCoord == y || tileEntity.zCoord == z) { + if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { iterator.remove(); } } From e0ad007a5ce549c4418b5efd4d04be8d0cd8bf72 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 21:59:28 +0100 Subject: [PATCH 150/314] Make use of the new API. --- .../command/CommandSchematicaDownload.java | 4 +- .../schematica/handler/DownloadHandler.java | 4 +- .../schematica/handler/QueueTickHandler.java | 4 - .../network/message/MessageDownloadBegin.java | 7 +- .../network/message/MessageDownloadChunk.java | 10 +- .../network/transfer/SchematicTransfer.java | 6 +- .../schematica/proxy/ClientProxy.java | 15 +- .../schematica/proxy/CommonProxy.java | 6 +- .../schematica/world/SchematicWorld.java | 223 ++++++------------ .../world/chunk/SchematicContainer.java | 6 +- .../world/schematic/SchematicAlpha.java | 69 +++--- .../world/schematic/SchematicClassic.java | 6 +- .../world/schematic/SchematicFormat.java | 23 +- 13 files changed, 155 insertions(+), 228 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 399b2245..285aea9f 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -2,12 +2,12 @@ import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.util.FileUtils; -import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -74,7 +74,7 @@ public void processCommand(ICommandSender sender, String[] args) { throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } - final SchematicWorld schematic = SchematicFormat.readFromFile(directory, filename); + final ISchematic schematic = SchematicFormat.readFromFile(directory, filename); if (schematic != null) { DownloadHandler.INSTANCE.transferMap.put(player, new SchematicTransfer(schematic, filename)); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java index 026ee4ed..cc83f763 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.handler; +import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.network.message.MessageDownloadBegin; import com.github.lunatrius.schematica.network.message.MessageDownloadChunk; @@ -7,7 +8,6 @@ import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.entity.player.EntityPlayerMP; @@ -18,7 +18,7 @@ public class DownloadHandler { public static final DownloadHandler INSTANCE = new DownloadHandler(); - public SchematicWorld schematic = null; + public ISchematic schematic = null; public final Map transferMap = new LinkedHashMap(); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index a40e48fc..8fb5a762 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -68,10 +68,6 @@ private void processQueue() { if (container.hasNext()) { this.queue.offer(container); } else { - //TODO: Post Event on the bus. - //final PostSchematicCaptureEvent event = new PostSchematicCaptureEvent(container.schematic); - //MinecraftForge.EVENT_BUS.post(event); - final boolean success = SchematicFormat.writeToFile(container.file, container.schematic); final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; container.player.addChatMessage(new ChatComponentTranslation(message, container.file.getName())); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java index 3054d625..792a70d7 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java @@ -1,7 +1,8 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.handler.DownloadHandler; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.storage.Schematic; import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -18,7 +19,7 @@ public class MessageDownloadBegin implements IMessage, IMessageHandler ((chunkX << 4) + 15) ? 15 : (maxX & 15); final int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); @@ -136,7 +138,7 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam final short height = (short) (Math.abs(maxY - minY) + 1); final short length = (short) (Math.abs(maxZ - minZ) + 1); - final SchematicWorld schematic = new SchematicWorld(SchematicUtil.getIconFromName(iconName), width, height, length); + final ISchematic schematic = new Schematic(SchematicUtil.getIconFromName(iconName), width, height, length); final SchematicContainer container = new SchematicContainer(schematic, player, world, new File(directory, filename), minX, maxX, minY, maxY, minZ, maxZ); QueueTickHandler.INSTANCE.queueSchematic(container); diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 7e51b164..675973e3 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -2,12 +2,12 @@ import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; -import cpw.mods.fml.common.registry.GameData; +import com.github.lunatrius.schematica.world.storage.Schematic; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; @@ -34,11 +34,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.Iterator; import java.util.List; public class SchematicWorld extends World { - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); private static final Comparator BLOCK_COMPARATOR = new Comparator() { @Override @@ -49,137 +47,55 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); - private ItemStack icon; - private short[][][] blocks; - private byte[][][] metadata; - private final List tileEntities = new ArrayList(); - private short width; - private short height; - private short length; + private ISchematic schematic; public final Vector3i position = new Vector3i(); public boolean isRendering; public boolean isRenderingLayer; public int renderingLayer; - public SchematicWorld() { + public SchematicWorld(ISchematic schematic) { super(new SaveHandlerSchematic(), "Schematica", WORLD_SETTINGS, null, null); - this.icon = SchematicWorld.DEFAULT_ICON.copy(); - this.blocks = null; - this.metadata = null; - this.tileEntities.clear(); - this.width = 0; - this.height = 0; - this.length = 0; + this.schematic = schematic; + + for (TileEntity tileEntity : schematic.getTileEntities()) { + initializeTileEntity(tileEntity); + } this.isRendering = false; this.isRenderingLayer = false; this.renderingLayer = 0; } - public SchematicWorld(ItemStack icon, short[][][] blocks, byte[][][] metadata, List tileEntities, short width, short height, short length) { - this(); - - this.icon = icon != null ? icon : SchematicWorld.DEFAULT_ICON.copy(); - - this.blocks = blocks != null ? blocks.clone() : new short[width][height][length]; - this.metadata = metadata != null ? metadata.clone() : new byte[width][height][length]; - - this.width = width; - this.height = height; - this.length = length; - - if (tileEntities != null) { - this.tileEntities.addAll(tileEntities); - for (TileEntity tileEntity : this.tileEntities) { - tileEntity.setWorldObj(this); - tileEntity.getBlockType(); - try { - tileEntity.validate(); - } catch (Exception e) { - Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); - } - } - } - } - - public SchematicWorld(ItemStack icon, short width, short height, short length) { - this(icon, null, null, null, width, height, length); - } - - public int getBlockIdRaw(int x, int y, int z) { - if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { - return 0; - } - return this.blocks[x][y][z]; - } - - private int getBlockId(int x, int y, int z) { - if (this.isRenderingLayer && this.renderingLayer != y) { - return 0; - } - return getBlockIdRaw(x, y, z); - } - - public Block getBlockRaw(int x, int y, int z) { - return BLOCK_REGISTRY.getObjectById(getBlockIdRaw(x, y, z)); - } - @Override public Block getBlock(int x, int y, int z) { - return BLOCK_REGISTRY.getObjectById(getBlockId(x, y, z)); - } + if (this.isRenderingLayer && this.renderingLayer != y) { + return Blocks.air; + } - public boolean setBlock(int x, int y, int z, Block block, int metadata) { - return setBlock(x, y, z, block, metadata, 0); + return this.schematic.getBlock(x, y, z); } @Override public boolean setBlock(int x, int y, int z, Block block, int metadata, int flags) { - if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { - return false; - } - - final int id = BLOCK_REGISTRY.getId(block); - if (id == -1) { - return false; - } - - this.blocks[x][y][z] = (short) id; - this.metadata[x][y][z] = (byte) metadata; - return true; + return this.schematic.setBlock(x, y, z, block, metadata); } @Override public TileEntity getTileEntity(int x, int y, int z) { - for (TileEntity tileEntity : this.tileEntities) { - if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { - return tileEntity; - } - } - return null; + return this.schematic.getTileEntity(x, y, z); } @Override public void setTileEntity(int x, int y, int z, TileEntity tileEntity) { - if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { - return; - } - - removeTileEntity(x, y, z); - - this.tileEntities.add(tileEntity); + this.schematic.setTileEntity(x, y, z, tileEntity); + initializeTileEntity(tileEntity); + System.out.println("BUGGER!"); } @Override public void removeTileEntity(int x, int y, int z) { - final Iterator iterator = this.tileEntities.iterator(); - while (iterator.hasNext()) { - final TileEntity tileEntity = iterator.next(); - if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { - iterator.remove(); - } - } + this.schematic.removeTileEntity(x, y, z); } @SideOnly(Side.CLIENT) @@ -195,10 +111,7 @@ public float getLightBrightness(int x, int y, int z) { @Override public int getBlockMetadata(int x, int y, int z) { - if (x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length) { - return 0; - } - return this.metadata[x][y][z]; + return this.schematic.getBlockMetadata(x, y, z); } @Override @@ -233,16 +146,16 @@ public BiomeGenBase getBiomeGenForCoords(int x, int z) { } public int getWidth() { - return this.width; + return this.schematic.getWidth(); } public int getLength() { - return this.length; + return this.schematic.getLength(); } @Override public int getHeight() { - return this.height; + return this.schematic.getHeight(); } @SideOnly(Side.CLIENT) @@ -268,8 +181,7 @@ public boolean blockExists(int x, int y, int z) { @Override public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag) { - this.metadata[x][y][z] = (byte) (metadata & 0xFF); - return true; + return this.schematic.setBlockMetadata(x, y, z, metadata); } @Override @@ -286,29 +198,26 @@ public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _de return block.isSideSolid(this, x, y, z, side); } + public void initializeTileEntity(TileEntity tileEntity) { + tileEntity.setWorldObj(this); + tileEntity.getBlockType(); + try { + tileEntity.validate(); + } catch (Exception e) { + Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); + } + } + public void setIcon(ItemStack icon) { - this.icon = icon; + this.schematic.setIcon(icon); } public ItemStack getIcon() { - return this.icon; - } - - public void setTileEntities(List tileEntities) { - this.tileEntities.clear(); - this.tileEntities.addAll(tileEntities); - for (TileEntity tileEntity : this.tileEntities) { - tileEntity.setWorldObj(this); - try { - tileEntity.validate(); - } catch (Exception e) { - Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); - } - } + return this.schematic.getIcon(); } public List getTileEntities() { - return this.tileEntities; + return this.schematic.getTileEntities(); } public List getBlockList() { @@ -319,16 +228,20 @@ public List getBlockList() { Item item; ItemStack itemStack; - for (y = 0; y < this.height; y++) { + final int width = this.schematic.getWidth(); + final int height = this.schematic.getHeight(); + final int length = this.schematic.getLength(); + + for (y = 0; y < height; y++) { if (this.isRenderingLayer && y != this.renderingLayer) { continue; } - for (z = 0; z < this.length; z++) { - for (x = 0; x < this.width; x++) { - block = this.getBlock(x, y, z); + for (z = 0; z < length; z++) { + for (x = 0; x < width; x++) { + block = getBlock(x, y, z); item = Item.getItemFromBlock(block); - itemDamage = this.metadata[x][y][z]; + itemDamage = getBlockMetadata(x, y, z); if (block == null || block == Blocks.air) { continue; @@ -408,7 +321,7 @@ public boolean toggleRendering() { } public void refreshChests() { - for (TileEntity tileEntity : this.tileEntities) { + for (TileEntity tileEntity : this.schematic.getTileEntities()) { if (tileEntity instanceof TileEntityChest) { TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; tileEntityChest.adjacentChestChecked = false; @@ -463,47 +376,49 @@ public void flip() { } public void rotate() { - short[][][] localBlocks = new short[this.length][this.height][this.width]; - byte[][][] localMetadata = new byte[this.length][this.height][this.width]; + final ItemStack icon = this.schematic.getIcon(); + final int width = this.schematic.getWidth(); + final int height = this.schematic.getHeight(); + final int length = this.schematic.getLength(); + + final ISchematic schematicRotated = new Schematic(icon, length, height, width); - for (int y = 0; y < this.height; y++) { - for (int z = 0; z < this.length; z++) { - for (int x = 0; x < this.width; x++) { + for (int y = 0; y < height; y++) { + for (int z = 0; z < length; z++) { + for (int x = 0; x < width; x++) { try { - getBlock(x, y, this.length - 1 - z).rotateBlock(this, x, y, this.length - 1 - z, ForgeDirection.UP); + getBlock(x, y, length - 1 - z).rotateBlock(this, x, y, length - 1 - z, ForgeDirection.UP); } catch (Exception e) { Reference.logger.debug("Failed to rotate block!", e); } - localBlocks[z][y][x] = this.blocks[x][y][this.length - 1 - z]; - localMetadata[z][y][x] = this.metadata[x][y][this.length - 1 - z]; + + final Block block = getBlock(x, y, length - 1 - z); + final int metadata = getBlockMetadata(x, y, length - 1 - z); + schematicRotated.setBlock(z, y, x, block, metadata); } } } - this.blocks = localBlocks; - this.metadata = localMetadata; - - int coord; - for (TileEntity tileEntity : this.tileEntities) { - coord = tileEntity.zCoord; + for (TileEntity tileEntity : this.schematic.getTileEntities()) { + final int coord = tileEntity.zCoord; tileEntity.zCoord = tileEntity.xCoord; - tileEntity.xCoord = this.length - 1 - coord; - tileEntity.blockMetadata = this.metadata[tileEntity.xCoord][tileEntity.yCoord][tileEntity.zCoord]; + tileEntity.xCoord = length - 1 - coord; + tileEntity.blockMetadata = schematicRotated.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; skullTileEntity.func_145903_a((skullTileEntity.func_145906_b() + 12) & 15); } + + schematicRotated.setTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity); } - short tmp = this.width; - this.width = this.length; - this.length = tmp; + this.schematic = schematicRotated; refreshChests(); } public Vector3f dimensions() { - return new Vector3f(this.width, this.height, this.length); + return new Vector3f(this.schematic.getWidth(), this.schematic.getHeight(), this.schematic.getLength()); } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java index fb028e67..dbcfd463 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java @@ -1,15 +1,15 @@ package com.github.lunatrius.schematica.world.chunk; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import java.io.File; public class SchematicContainer { - public final SchematicWorld schematic; + public final ISchematic schematic; public final EntityPlayer player; public final World world; public final File file; @@ -32,7 +32,7 @@ public class SchematicContainer { public final int chunkCount; public int processedChunks; - public SchematicContainer(SchematicWorld schematic, EntityPlayer player, World world, File file, int minX, int maxX, int minY, int maxY, int minZ, int maxZ) { + public SchematicContainer(ISchematic schematic, EntityPlayer player, World world, File file, int minX, int maxX, int minY, int maxY, int minZ, int maxZ) { this.schematic = schematic; this.player = player; this.world = world; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index df0e412f..e915be47 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -1,9 +1,11 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.api.event.PreSchematicSaveEvent; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.storage.Schematic; +import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -14,15 +16,15 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Set; public class SchematicAlpha extends SchematicFormat { + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + @Override - public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { + public ISchematic readFromNBT(NBTTagCompound tagCompound) { ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); byte localBlocks[] = tagCompound.getByteArray(Names.NBT.BLOCKS); @@ -48,61 +50,61 @@ public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { short length = tagCompound.getShort(Names.NBT.LENGTH); short height = tagCompound.getShort(Names.NBT.HEIGHT); - short[][][] blocks = new short[width][height][length]; - byte[][][] metadata = new byte[width][height][length]; - Short id = null; Map oldToNew = new HashMap(); if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); Set names = mapping.func_150296_c(); for (String name : names) { - oldToNew.put(mapping.getShort(name), (short) GameData.getBlockRegistry().getId(name)); + oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(name)); } } + ISchematic schematic = new Schematic(icon, width, height, length); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < length; z++) { int index = x + (y * length + z) * width; - blocks[x][y][z] = (short) ((localBlocks[index] & 0xFF) | (extra ? ((extraBlocks[index] & 0xFF) << 8) : 0)); - metadata[x][y][z] = (byte) (localMetadata[index] & 0xFF); - if ((id = oldToNew.get(blocks[x][y][z])) != null) { - blocks[x][y][z] = id; + int blockID = (localBlocks[index] & 0xFF) | (extra ? ((extraBlocks[index] & 0xFF) << 8) : 0); + int meta = localMetadata[index] & 0xFF; + + if ((id = oldToNew.get((short) blockID)) != null) { + blockID = id; } + + schematic.setBlock(x, y, z, BLOCK_REGISTRY.getObjectById(blockID), meta); } } } - List tileEntities = new ArrayList(); NBTTagList tileEntitiesList = tagCompound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tileEntitiesList.tagCount(); i++) { try { TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); if (tileEntity != null) { - tileEntities.add(tileEntity); + schematic.setTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity); } } catch (Exception e) { Reference.logger.error("TileEntity failed to load properly!", e); } } - return new SchematicWorld(icon, blocks, metadata, tileEntities, width, height, length); + return schematic; } @Override - public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { + public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { NBTTagCompound tagCompoundIcon = new NBTTagCompound(); - ItemStack icon = world.getIcon(); + ItemStack icon = schematic.getIcon(); icon.writeToNBT(tagCompoundIcon); tagCompound.setTag(Names.NBT.ICON, tagCompoundIcon); - tagCompound.setShort(Names.NBT.WIDTH, (short) world.getWidth()); - tagCompound.setShort(Names.NBT.LENGTH, (short) world.getLength()); - tagCompound.setShort(Names.NBT.HEIGHT, (short) world.getHeight()); + tagCompound.setShort(Names.NBT.WIDTH, (short) schematic.getWidth()); + tagCompound.setShort(Names.NBT.LENGTH, (short) schematic.getLength()); + tagCompound.setShort(Names.NBT.HEIGHT, (short) schematic.getHeight()); - int size = world.getWidth() * world.getLength() * world.getHeight(); + int size = schematic.getWidth() * schematic.getLength() * schematic.getHeight(); byte localBlocks[] = new byte[size]; byte localMetadata[] = new byte[size]; byte extraBlocks[] = new byte[size]; @@ -110,18 +112,19 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { boolean extra = false; Map mappings = new HashMap(); - for (int x = 0; x < world.getWidth(); x++) { - for (int y = 0; y < world.getHeight(); y++) { - for (int z = 0; z < world.getLength(); z++) { - int index = x + (y * world.getLength() + z) * world.getWidth(); - int blockId = world.getBlockIdRaw(x, y, z); + for (int x = 0; x < schematic.getWidth(); x++) { + for (int y = 0; y < schematic.getHeight(); y++) { + for (int z = 0; z < schematic.getLength(); z++) { + final int index = x + (y * schematic.getLength() + z) * schematic.getWidth(); + final Block block = schematic.getBlock(x, y, z); + final int blockId = BLOCK_REGISTRY.getId(block); localBlocks[index] = (byte) blockId; - localMetadata[index] = (byte) world.getBlockMetadata(x, y, z); + localMetadata[index] = (byte) schematic.getBlockMetadata(x, y, z); if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { extra = true; } - String name = GameData.getBlockRegistry().getNameForObject(world.getBlockRaw(x, y, z)); + String name = BLOCK_REGISTRY.getNameForObject(block); if (!mappings.containsKey(name)) { mappings.put(name, (short) blockId); } @@ -131,18 +134,18 @@ public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { int count = 20; NBTTagList tileEntitiesList = new NBTTagList(); - for (TileEntity tileEntity : world.getTileEntities()) { + for (TileEntity tileEntity : schematic.getTileEntities()) { NBTTagCompound tileEntityTagCompound = new NBTTagCompound(); try { tileEntity.writeToNBT(tileEntityTagCompound); tileEntitiesList.appendTag(tileEntityTagCompound); } catch (Exception e) { - int pos = tileEntity.xCoord + (tileEntity.yCoord * world.getLength() + tileEntity.zCoord) * world.getWidth(); + int pos = tileEntity.xCoord + (tileEntity.yCoord * schematic.getLength() + tileEntity.zCoord) * schematic.getWidth(); if (--count > 0) { - Block block = world.getBlockRaw(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); - Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? GameData.getBlockRegistry().getNameForObject(block) : "?", tileEntity.getClass().getName()), e); + Block block = schematic.getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName()), e); } - localBlocks[pos] = (byte) GameData.getBlockRegistry().getId(Blocks.bedrock); + localBlocks[pos] = (byte) BLOCK_REGISTRY.getId(Blocks.bedrock); localMetadata[pos] = 0; extraBlocks[pos] = 0; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java index 1caef094..0e291445 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java @@ -1,18 +1,18 @@ package com.github.lunatrius.schematica.world.schematic; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.api.ISchematic; import net.minecraft.nbt.NBTTagCompound; import sun.reflect.generics.reflectiveObjects.NotImplementedException; // TODO: http://minecraft.gamepedia.com/Data_values_%28Classic%29 public class SchematicClassic extends SchematicFormat { @Override - public SchematicWorld readFromNBT(NBTTagCompound tagCompound) { + public ISchematic readFromNBT(NBTTagCompound tagCompound) { throw new NotImplementedException(); } @Override - public boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world) { + public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { throw new NotImplementedException(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index b8af6eaf..f30c3069 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -1,9 +1,11 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.api.event.PostSchematicCaptureEvent; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.MinecraftForge; import java.io.DataOutputStream; import java.io.File; @@ -16,11 +18,11 @@ public abstract class SchematicFormat { public static final Map FORMATS = new HashMap(); public static String FORMAT_DEFAULT; - public abstract SchematicWorld readFromNBT(NBTTagCompound tagCompound); + public abstract ISchematic readFromNBT(NBTTagCompound tagCompound); - public abstract boolean writeToNBT(NBTTagCompound tagCompound, SchematicWorld world); + public abstract boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic); - public static SchematicWorld readFromFile(File file) { + public static ISchematic readFromFile(File file) { try { final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); final String format = tagCompound.getString(Names.NBT.MATERIALS); @@ -38,15 +40,18 @@ public static SchematicWorld readFromFile(File file) { return null; } - public static SchematicWorld readFromFile(File directory, String filename) { + public static ISchematic readFromFile(File directory, String filename) { return readFromFile(new File(directory, filename)); } - public static boolean writeToFile(File file, SchematicWorld world) { + public static boolean writeToFile(File file, ISchematic schematic) { try { + final PostSchematicCaptureEvent event = new PostSchematicCaptureEvent(schematic); + MinecraftForge.EVENT_BUS.post(event); + NBTTagCompound tagCompound = new NBTTagCompound(); - FORMATS.get(FORMAT_DEFAULT).writeToNBT(tagCompound, world); + FORMATS.get(FORMAT_DEFAULT).writeToNBT(tagCompound, schematic); DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); @@ -64,8 +69,8 @@ public static boolean writeToFile(File file, SchematicWorld world) { return false; } - public static boolean writeToFile(File directory, String filename, SchematicWorld world) { - return writeToFile(new File(directory, filename), world); + public static boolean writeToFile(File directory, String filename, ISchematic schematic) { + return writeToFile(new File(directory, filename), schematic); } static { From 77b44c9a7de0cc14ee1a4fdc88db8445b371b717 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 13 Jan 2015 22:07:55 +0100 Subject: [PATCH 151/314] Add the apiJar task to the signJars and curse tasks. --- gradle/scripts/curseforge.gradle | 2 +- gradle/scripts/signing.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/scripts/curseforge.gradle b/gradle/scripts/curseforge.gradle index dc7517e0..1fa71fa9 100644 --- a/gradle/scripts/curseforge.gradle +++ b/gradle/scripts/curseforge.gradle @@ -8,6 +8,6 @@ if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curs projectId = project.extra_curseforge_id changelog = '' - additionalArtifact devJar, sourceJar + additionalArtifact devJar, sourceJar, apiJar } } diff --git a/gradle/scripts/signing.gradle b/gradle/scripts/signing.gradle index 6aa4f058..8cbc5b1b 100644 --- a/gradle/scripts/signing.gradle +++ b/gradle/scripts/signing.gradle @@ -7,12 +7,12 @@ if (!project.hasProperty('keystore_alias')) if (!project.hasProperty('keystore_password')) ext.keystore_password = '' -task signJars(dependsOn: ['reobf', 'devJar', 'sourceJar']) { +task signJars(dependsOn: ['reobf', 'devJar', 'sourceJar', 'apiJar']) { inputs.dir jar.destinationDir inputs.file keystore_location inputs.property 'keystore_alias', keystore_alias inputs.property 'keystore_password', keystore_password - outputs.dir devJar.destinationDir + outputs.dir jar.destinationDir onlyIf { return keystore_location != '.' From d19f7449fc1bd954e0c1ba9173b5276101a71e12 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 14 Jan 2015 01:23:27 +0100 Subject: [PATCH 152/314] Make sure to include the API in the main jar as well. --- gradle/scripts/artifacts.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle/scripts/artifacts.gradle b/gradle/scripts/artifacts.gradle index 7a527225..853c8a62 100644 --- a/gradle/scripts/artifacts.gradle +++ b/gradle/scripts/artifacts.gradle @@ -5,6 +5,7 @@ def commonManifest = { } jar { + from sourceSets.api.output classifier = project.hasProperty('extra_classifier') ? project.extra_classifier : 'universal' manifest commonManifest } From f59e8a0d1d9bf20cdc6f9f7690e90a232d29cc04 Mon Sep 17 00:00:00 2001 From: Manuel Gu Date: Wed, 14 Jan 2015 19:36:48 +0100 Subject: [PATCH 153/314] Updated the de_DE language file still some fields I cannot really translate but most of them are now translated --- .../assets/schematica/lang/de_DE.lang | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 563b37fc..1ad1103d 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -28,23 +28,23 @@ schematica.gui.materials=Materialien schematica.gui.materialname=Material schematica.gui.materialamount=Menge schematica.gui.printer=Drucker -# schematica.gui.unknownblock=Unknown Block +# schematica.gui.unknownblock=Unbekannter Block # gui - config - categories # schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. +# schematica.config.category.render.tooltip=Render Einstellungen +# schematica.config.category.printer=Drucker +# schematica.config.category.printer.tooltip=Drucker Einstellungen # schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. +# schematica.config.category.tooltip.tooltip=Tooltip Einstellungen +# schematica.config.category.general=Generell +# schematica.config.category.general.tooltip=Generelle Einstellungen # schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. +# schematica.config.category.server.tooltip=Einstellungen am Server # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. +# schematica.config.alphaEnabled=Alpha eingeschalten +# schematica.config.alphaEnabled.tooltip=Aktiviert transparente Blöcke. # schematica.config.alpha=Alpha # schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). # schematica.config.highlight=Highlight Blocks @@ -59,40 +59,40 @@ schematica.gui.printer=Drucker # schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). +# schematica.config.placeDelay=Abstand zwischen Blockplatzierung +# schematica.config.placeDelay.tooltip=Abstan (in ticks) in der ein Spieler Blöcke setzen kann. # schematica.config.timeout=Timeout # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. +# schematica.config.placeInstantly=Blöcke sofort setzen +# schematica.config.placeInstantly.tooltip=Platziere alle Blöcke innerhalb eines Ticks. +# schematica.config.destroyBlocks=Zerstöre Blöcke +# schematica.config.destroyBlocks.tooltip=Der Drucker wird Blöcke entfernen können (Nur im Kreativmodus verfügbar). +# schematica.config.destroyInstantly=Zerstöre Blöcke sofort +# schematica.config.destroyInstantly.tooltip=Zerstöre alle Blöcke innerhalb eines Ticks. +# schematica.config.placeAdjacent=Angrenzende Blöcke berücksichtigen +# schematica.config.placeAdjacent.tooltip=Platziere Blöcke nur, wenn es angrenzende Blöcke gibt. +# schematica.config.swapSlots=Tausche Slots +# schematica.config.swapSlots.tooltip=Der Drucker wird Items aus deinem Inventar vertauschen, um Effizienter arbeiten zu können. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. +# schematica.config.tooltipEnabled=Tooltip anschalten +# schematica.config.tooltipEnabled.tooltip=Zeigt einen Tooltip an, wenn man mit der Maus über einen Block fährt. # schematica.config.tooltipX=Tooltip X # schematica.config.tooltipX.tooltip=Relative tooltip X. # schematica.config.tooltipY=Tooltip Y # schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. +# schematica.config.schematicDirectory=Schematic Verzeichnis +# schematica.config.schematicDirectory.tooltip=Schematic Verzeichnis # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. +# schematica.config.printerEnabled=Drucken erlauben +# schematica.config.printerEnabled.tooltip=Erlaubt es Spieler, den Drucker zu benutzen. +# schematica.config.saveEnabled=Speichern erlauben +# schematica.config.saveEnabled.tooltip=Erlaubt es Spielern, Schematics zu speichern. +# schematica.config.loadEnabled=Laden erlauben +# schematica.config.loadEnabled.tooltip=Erlaubt es Spielern, Schematics zu laden. # keys # schematica.key.category=Schematica @@ -102,21 +102,21 @@ schematica.key.control=Schematic verändern # commands - save # schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. +# schematica.command.save.playersOnly=Nur Spieler können dieses Kommando ausführen. +# schematica.command.save.started=%d Chunks werden in %s gespeichert. +# schematica.command.save.saveSucceeded=%s wurde erfolgreich gespeichert. +# schematica.command.save.saveFailed=Es gab ein Problem, die Schematic %s zu speichern. +# schematica.command.save.quotaExceeded=Du kannst keine Schematics mehr speichern, da das Limit erreicht wurde. Bitte nutze /schematicaList und /schematicaRemove um alte Schematics zu löschen. +# schematica.command.save.playerSchematicDirUnavailable=Es gab ein Problem, deine Schematic zu speichern. Bitte kontaktiere umgehend einen Server Administrator. # commands - list # schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. +# schematica.command.list.notAvailable=Dir kann keine Liste deiner Schematics angezeigt werden. +# schematica.command.list.remove=Entfernen +# schematica.command.list.download=Herunterladen +# schematica.command.list.header=--- Schematics: Seite %d von %d --- +# schematica.command.list.noSuchPage=Keine Seite +# schematica.command.list.noSchematics=Es sind keine Schematics verfügbar. # commands - remove # schematica.command.remove.usage=/schematicaRemove From affb7f865d4d283c65c2e9013b8311235b98aaa0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 15 Jan 2015 14:09:25 +0100 Subject: [PATCH 154/314] Added unbound keys for next/previous layer. --- .../handler/client/KeyInputHandler.java | 18 +++++++++++++++++- .../lunatrius/schematica/reference/Names.java | 2 ++ .../assets/schematica/lang/en_US.lang | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java index 4d9a2e60..86d6240e 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java @@ -4,6 +4,7 @@ import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; +import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; @@ -16,6 +17,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.ForgeHooks; import org.lwjgl.input.Keyboard; @@ -29,9 +31,11 @@ public class KeyInputHandler { private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(Names.Keys.LOAD, Keyboard.KEY_DIVIDE, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(Names.Keys.SAVE, Keyboard.KEY_MULTIPLY, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(Names.Keys.CONTROL, Keyboard.KEY_SUBTRACT, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_LAYER_INC = new KeyBinding(Names.Keys.LAYER_INC, Keyboard.KEY_NONE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_LAYER_DEC = new KeyBinding(Names.Keys.LAYER_DEC, Keyboard.KEY_NONE, Names.Keys.CATEGORY); public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { - KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL + KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL, KEY_BINDING_LAYER_INC, KEY_BINDING_LAYER_DEC }; private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -50,6 +54,18 @@ public void onKeyInput(KeyInputEvent event) { guiScreen = new GuiSchematicSave(this.minecraft.currentScreen); } else if (keyBinding == KEY_BINDING_CONTROL) { guiScreen = new GuiSchematicControl(this.minecraft.currentScreen); + } else if (keyBinding == KEY_BINDING_LAYER_INC) { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null && schematic.isRenderingLayer) { + schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); + RendererSchematicGlobal.INSTANCE.refresh(); + } + } else if (keyBinding == KEY_BINDING_LAYER_DEC) { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null && schematic.isRenderingLayer) { + schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); + RendererSchematicGlobal.INSTANCE.refresh(); + } } if (guiScreen != null) { diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index b472f13e..d994c6a4 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -130,6 +130,8 @@ public static final class Keys { public static final String LOAD = "schematica.key.load"; public static final String SAVE = "schematica.key.save"; public static final String CONTROL = "schematica.key.control"; + public static final String LAYER_INC = "schematica.key.layerInc"; + public static final String LAYER_DEC = "schematica.key.layerDec"; } public static final class NBT { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 6daf5c49..b795f527 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -101,6 +101,8 @@ schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic +schematica.key.layerInc=Next Layer +schematica.key.layerDec=Previous layer # commands - save schematica.command.save.usage=/schematicaSave From 2d7dae0bf88872b52e156b22000242ef875f0253 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 15 Jan 2015 14:28:34 +0100 Subject: [PATCH 155/314] Renamed the input event handler and simplified keybinding handling. --- ...KeyInputHandler.java => InputHandler.java} | 60 +++++++++---------- .../schematica/proxy/ClientProxy.java | 6 +- 2 files changed, 32 insertions(+), 34 deletions(-) rename src/main/java/com/github/lunatrius/schematica/handler/client/{KeyInputHandler.java => InputHandler.java} (69%) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java similarity index 69% rename from src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java rename to src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 86d6240e..fdd56248 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/KeyInputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -13,7 +13,6 @@ import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -25,8 +24,8 @@ import static cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; import static cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent; -public class KeyInputHandler { - public static final KeyInputHandler INSTANCE = new KeyInputHandler(); +public class InputHandler { + public static final InputHandler INSTANCE = new InputHandler(); private static final KeyBinding KEY_BINDING_LOAD = new KeyBinding(Names.Keys.LOAD, Keyboard.KEY_DIVIDE, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_SAVE = new KeyBinding(Names.Keys.SAVE, Keyboard.KEY_MULTIPLY, Names.Keys.CATEGORY); @@ -40,37 +39,36 @@ public class KeyInputHandler { private final Minecraft minecraft = Minecraft.getMinecraft(); - private KeyInputHandler() {} + private InputHandler() {} @SubscribeEvent public void onKeyInput(KeyInputEvent event) { - for (KeyBinding keyBinding : KEY_BINDINGS) { - if (keyBinding.isPressed()) { - if (this.minecraft.currentScreen == null) { - GuiScreen guiScreen = null; - if (keyBinding == KEY_BINDING_LOAD) { - guiScreen = new GuiSchematicLoad(this.minecraft.currentScreen); - } else if (keyBinding == KEY_BINDING_SAVE) { - guiScreen = new GuiSchematicSave(this.minecraft.currentScreen); - } else if (keyBinding == KEY_BINDING_CONTROL) { - guiScreen = new GuiSchematicControl(this.minecraft.currentScreen); - } else if (keyBinding == KEY_BINDING_LAYER_INC) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (schematic != null && schematic.isRenderingLayer) { - schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); - RendererSchematicGlobal.INSTANCE.refresh(); - } - } else if (keyBinding == KEY_BINDING_LAYER_DEC) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (schematic != null && schematic.isRenderingLayer) { - schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); - RendererSchematicGlobal.INSTANCE.refresh(); - } - } - - if (guiScreen != null) { - this.minecraft.displayGuiScreen(guiScreen); - } + if (this.minecraft.currentScreen == null) { + if (KEY_BINDING_LOAD.isPressed()) { + this.minecraft.displayGuiScreen(new GuiSchematicLoad(this.minecraft.currentScreen)); + } + + if (KEY_BINDING_SAVE.isPressed()) { + this.minecraft.displayGuiScreen(new GuiSchematicSave(this.minecraft.currentScreen)); + } + + if (KEY_BINDING_CONTROL.isPressed()) { + this.minecraft.displayGuiScreen(new GuiSchematicControl(this.minecraft.currentScreen)); + } + + if (KEY_BINDING_LAYER_INC.isPressed()) { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null && schematic.isRenderingLayer) { + schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); + RendererSchematicGlobal.INSTANCE.refresh(); + } + } + + if (KEY_BINDING_LAYER_DEC.isPressed()) { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null && schematic.isRenderingLayer) { + schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); + RendererSchematicGlobal.INSTANCE.refresh(); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index e6e7b066..27cbc055 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -8,7 +8,7 @@ import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; -import com.github.lunatrius.schematica.handler.client.KeyInputHandler; +import com.github.lunatrius.schematica.handler.client.InputHandler; import com.github.lunatrius.schematica.handler.client.RenderTickHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; import com.github.lunatrius.schematica.reference.Reference; @@ -158,7 +158,7 @@ public void preInit(FMLPreInitializationEvent event) { prop.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); } - for (KeyBinding keyBinding : KeyInputHandler.KEY_BINDINGS) { + for (KeyBinding keyBinding : InputHandler.KEY_BINDINGS) { ClientRegistry.registerKeyBinding(keyBinding); } } @@ -167,7 +167,7 @@ public void preInit(FMLPreInitializationEvent event) { public void init(FMLInitializationEvent event) { super.init(event); - FMLCommonHandler.instance().bus().register(KeyInputHandler.INSTANCE); + FMLCommonHandler.instance().bus().register(InputHandler.INSTANCE); FMLCommonHandler.instance().bus().register(TickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(ConfigurationHandler.INSTANCE); From 2f63b109a1e8cf6af1009c86748748eae68ffc6f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 15 Jan 2015 14:41:58 +0100 Subject: [PATCH 156/314] Handle all input events in a single handler. --- .../schematica/handler/client/InputHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index fdd56248..73e9acc1 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -10,6 +10,7 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.InputEvent; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; @@ -21,9 +22,6 @@ import net.minecraftforge.common.ForgeHooks; import org.lwjgl.input.Keyboard; -import static cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; -import static cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent; - public class InputHandler { public static final InputHandler INSTANCE = new InputHandler(); @@ -42,7 +40,7 @@ public class InputHandler { private InputHandler() {} @SubscribeEvent - public void onKeyInput(KeyInputEvent event) { + public void onKeyInput(InputEvent event) { if (this.minecraft.currentScreen == null) { if (KEY_BINDING_LOAD.isPressed()) { this.minecraft.displayGuiScreen(new GuiSchematicLoad(this.minecraft.currentScreen)); @@ -71,11 +69,12 @@ public void onKeyInput(KeyInputEvent event) { RendererSchematicGlobal.INSTANCE.refresh(); } } + + handlePickBlock(); } } - @SubscribeEvent - public void onMouseInput(MouseInputEvent event) { + private void handlePickBlock() { final KeyBinding keyPickBlock = this.minecraft.gameSettings.keyBindPickBlock; if (keyPickBlock.isPressed()) { try { From d4c63936b60d75e80dbe6a41431cd1502d8beb06 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 15 Jan 2015 14:57:52 +0100 Subject: [PATCH 157/314] Uncommented translated strings in de_DE.lang. --- .../assets/schematica/lang/de_DE.lang | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 1ad1103d..200a5d4b 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -28,23 +28,23 @@ schematica.gui.materials=Materialien schematica.gui.materialname=Material schematica.gui.materialamount=Menge schematica.gui.printer=Drucker -# schematica.gui.unknownblock=Unbekannter Block +schematica.gui.unknownblock=Unbekannter Block # gui - config - categories # schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render Einstellungen -# schematica.config.category.printer=Drucker -# schematica.config.category.printer.tooltip=Drucker Einstellungen +schematica.config.category.render.tooltip=Render Einstellungen +schematica.config.category.printer=Drucker +schematica.config.category.printer.tooltip=Drucker Einstellungen # schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip Einstellungen -# schematica.config.category.general=Generell -# schematica.config.category.general.tooltip=Generelle Einstellungen +schematica.config.category.tooltip.tooltip=Tooltip Einstellungen +schematica.config.category.general=Generell +schematica.config.category.general.tooltip=Generelle Einstellungen # schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Einstellungen am Server +schematica.config.category.server.tooltip=Einstellungen am Server # gui - config - render -# schematica.config.alphaEnabled=Alpha eingeschalten -# schematica.config.alphaEnabled.tooltip=Aktiviert transparente Blöcke. +schematica.config.alphaEnabled=Alpha eingeschalten +schematica.config.alphaEnabled.tooltip=Aktiviert transparente Blöcke. # schematica.config.alpha=Alpha # schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). # schematica.config.highlight=Highlight Blocks @@ -59,40 +59,40 @@ schematica.gui.printer=Drucker # schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Abstand zwischen Blockplatzierung -# schematica.config.placeDelay.tooltip=Abstan (in ticks) in der ein Spieler Blöcke setzen kann. +schematica.config.placeDelay=Abstand zwischen Blockplatzierung +schematica.config.placeDelay.tooltip=Abstan (in ticks) in der ein Spieler Blöcke setzen kann. # schematica.config.timeout=Timeout # schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Blöcke sofort setzen -# schematica.config.placeInstantly.tooltip=Platziere alle Blöcke innerhalb eines Ticks. -# schematica.config.destroyBlocks=Zerstöre Blöcke -# schematica.config.destroyBlocks.tooltip=Der Drucker wird Blöcke entfernen können (Nur im Kreativmodus verfügbar). -# schematica.config.destroyInstantly=Zerstöre Blöcke sofort -# schematica.config.destroyInstantly.tooltip=Zerstöre alle Blöcke innerhalb eines Ticks. -# schematica.config.placeAdjacent=Angrenzende Blöcke berücksichtigen -# schematica.config.placeAdjacent.tooltip=Platziere Blöcke nur, wenn es angrenzende Blöcke gibt. -# schematica.config.swapSlots=Tausche Slots -# schematica.config.swapSlots.tooltip=Der Drucker wird Items aus deinem Inventar vertauschen, um Effizienter arbeiten zu können. +schematica.config.placeInstantly=Blöcke sofort setzen +schematica.config.placeInstantly.tooltip=Platziere alle Blöcke innerhalb eines Ticks. +schematica.config.destroyBlocks=Zerstöre Blöcke +schematica.config.destroyBlocks.tooltip=Der Drucker wird Blöcke entfernen können (Nur im Kreativmodus verfügbar). +schematica.config.destroyInstantly=Zerstöre Blöcke sofort +schematica.config.destroyInstantly.tooltip=Zerstöre alle Blöcke innerhalb eines Ticks. +schematica.config.placeAdjacent=Angrenzende Blöcke berücksichtigen +schematica.config.placeAdjacent.tooltip=Platziere Blöcke nur, wenn es angrenzende Blöcke gibt. +schematica.config.swapSlots=Tausche Slots +schematica.config.swapSlots.tooltip=Der Drucker wird Items aus deinem Inventar vertauschen, um Effizienter arbeiten zu können. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip anschalten -# schematica.config.tooltipEnabled.tooltip=Zeigt einen Tooltip an, wenn man mit der Maus über einen Block fährt. +schematica.config.tooltipEnabled=Tooltip anschalten +schematica.config.tooltipEnabled.tooltip=Zeigt einen Tooltip an, wenn man mit der Maus über einen Block fährt. # schematica.config.tooltipX=Tooltip X # schematica.config.tooltipX.tooltip=Relative tooltip X. # schematica.config.tooltipY=Tooltip Y # schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Verzeichnis -# schematica.config.schematicDirectory.tooltip=Schematic Verzeichnis +schematica.config.schematicDirectory=Schematic Verzeichnis +schematica.config.schematicDirectory.tooltip=Schematic Verzeichnis # gui - config - server -# schematica.config.printerEnabled=Drucken erlauben -# schematica.config.printerEnabled.tooltip=Erlaubt es Spieler, den Drucker zu benutzen. -# schematica.config.saveEnabled=Speichern erlauben -# schematica.config.saveEnabled.tooltip=Erlaubt es Spielern, Schematics zu speichern. -# schematica.config.loadEnabled=Laden erlauben -# schematica.config.loadEnabled.tooltip=Erlaubt es Spielern, Schematics zu laden. +schematica.config.printerEnabled=Drucken erlauben +schematica.config.printerEnabled.tooltip=Erlaubt es Spieler, den Drucker zu benutzen. +schematica.config.saveEnabled=Speichern erlauben +schematica.config.saveEnabled.tooltip=Erlaubt es Spielern, Schematics zu speichern. +schematica.config.loadEnabled=Laden erlauben +schematica.config.loadEnabled.tooltip=Erlaubt es Spielern, Schematics zu laden. # keys # schematica.key.category=Schematica @@ -102,21 +102,21 @@ schematica.key.control=Schematic verändern # commands - save # schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=Nur Spieler können dieses Kommando ausführen. -# schematica.command.save.started=%d Chunks werden in %s gespeichert. -# schematica.command.save.saveSucceeded=%s wurde erfolgreich gespeichert. -# schematica.command.save.saveFailed=Es gab ein Problem, die Schematic %s zu speichern. -# schematica.command.save.quotaExceeded=Du kannst keine Schematics mehr speichern, da das Limit erreicht wurde. Bitte nutze /schematicaList und /schematicaRemove um alte Schematics zu löschen. -# schematica.command.save.playerSchematicDirUnavailable=Es gab ein Problem, deine Schematic zu speichern. Bitte kontaktiere umgehend einen Server Administrator. +schematica.command.save.playersOnly=Nur Spieler können dieses Kommando ausführen. +schematica.command.save.started=%d Chunks werden in %s gespeichert. +schematica.command.save.saveSucceeded=%s wurde erfolgreich gespeichert. +schematica.command.save.saveFailed=Es gab ein Problem, die Schematic %s zu speichern. +schematica.command.save.quotaExceeded=Du kannst keine Schematics mehr speichern, da das Limit erreicht wurde. Bitte nutze /schematicaList und /schematicaRemove um alte Schematics zu löschen. +schematica.command.save.playerSchematicDirUnavailable=Es gab ein Problem, deine Schematic zu speichern. Bitte kontaktiere umgehend einen Server Administrator. # commands - list # schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=Dir kann keine Liste deiner Schematics angezeigt werden. -# schematica.command.list.remove=Entfernen -# schematica.command.list.download=Herunterladen -# schematica.command.list.header=--- Schematics: Seite %d von %d --- -# schematica.command.list.noSuchPage=Keine Seite -# schematica.command.list.noSchematics=Es sind keine Schematics verfügbar. +schematica.command.list.notAvailable=Dir kann keine Liste deiner Schematics angezeigt werden. +schematica.command.list.remove=Entfernen +schematica.command.list.download=Herunterladen +schematica.command.list.header=--- Schematics: Seite %d von %d --- +schematica.command.list.noSuchPage=Keine Seite +schematica.command.list.noSchematics=Es sind keine Schematics verfügbar. # commands - remove # schematica.command.remove.usage=/schematicaRemove From a61f261ddc76e908d3b90d422504628e7cbf4f6f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 15 Jan 2015 15:03:54 +0100 Subject: [PATCH 158/314] Removed untranslated strings. It just adds unnecessary noise and clutter. --- .../assets/schematica/lang/ca_ES.lang | 80 -------------- .../assets/schematica/lang/cs_CZ.lang | 78 -------------- .../assets/schematica/lang/da_DK.lang | 79 -------------- .../assets/schematica/lang/de_DE.lang | 34 ------ .../assets/schematica/lang/en_GB.lang | 30 ------ .../assets/schematica/lang/en_PT.lang | 78 -------------- .../assets/schematica/lang/es_ES.lang | 79 -------------- .../assets/schematica/lang/es_MX.lang | 80 -------------- .../assets/schematica/lang/fi_FI.lang | 78 -------------- .../assets/schematica/lang/fr_FR.lang | 78 -------------- .../assets/schematica/lang/hu_HU.lang | 78 -------------- .../assets/schematica/lang/it_IT.lang | 79 -------------- .../assets/schematica/lang/ko_KR.lang | 18 ---- .../assets/schematica/lang/la_LA.lang | 102 ------------------ .../assets/schematica/lang/lt_LT.lang | 79 -------------- .../assets/schematica/lang/nl_NL.lang | 79 -------------- .../assets/schematica/lang/no_NO.lang | 47 -------- .../assets/schematica/lang/pl_PL.lang | 79 -------------- .../assets/schematica/lang/pt_PT.lang | 78 -------------- .../assets/schematica/lang/ru_RU.lang | 77 ------------- .../assets/schematica/lang/sk_SK.lang | 78 -------------- .../assets/schematica/lang/sl_SI.lang | 78 -------------- .../assets/schematica/lang/th_TH.lang | 78 -------------- .../assets/schematica/lang/tr_TR.lang | 78 -------------- .../assets/schematica/lang/uk_UA.lang | 78 -------------- .../assets/schematica/lang/zh_CN.lang | 78 -------------- 26 files changed, 1878 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index a6492e15..41e9daba 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -19,113 +19,33 @@ schematica.gui.operations=Operacions schematica.gui.point.red=Punt Vermell schematica.gui.point.blue=Punt Blau schematica.gui.saveselection=Guardar la selecció com un esquema -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: -# schematica.gui.materials=Materials -# schematica.gui.materialname=Material schematica.gui.materialamount=Quantitat schematica.gui.printer=Imprimir -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Carregar esquema schematica.key.save=Guardar esquema schematica.key.control=Manipular esquema # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index bc507fea..522af053 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Operace schematica.gui.point.red=Rudý bod schematica.gui.point.blue=Modrý bod schematica.gui.saveselection=Uložit výběr jako schéma -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Materiály schematica.gui.materialname=Materiál schematica.gui.materialamount=Množství schematica.gui.printer=Tiskárna -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Načíst schéma schematica.key.save=Uložit schéma schematica.key.control=Manipulovat se schématem # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 0a973635..cc02c432 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -19,113 +19,34 @@ schematica.gui.operations=Operationer schematica.gui.point.red=Rødt punkt schematica.gui.point.blue=Blåt punkt schematica.gui.saveselection=Gem markeringen som en schematic -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Materialer schematica.gui.materialname=Materiale schematica.gui.materialamount=Antal -# schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Åbn schematic schematica.key.save=Gem schematic schematica.key.control=Manipulér schematic # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 200a5d4b..c7bcf715 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Aktionen schematica.gui.point.red=Roter Punkt schematica.gui.point.blue=Blauer Punkt schematica.gui.saveselection=Auswahl als Schematic speichern -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -31,38 +29,21 @@ schematica.gui.printer=Drucker schematica.gui.unknownblock=Unbekannter Block # gui - config - categories -# schematica.config.category.render=Rendering schematica.config.category.render.tooltip=Render Einstellungen schematica.config.category.printer=Drucker schematica.config.category.printer.tooltip=Drucker Einstellungen -# schematica.config.category.tooltip=Tooltip schematica.config.category.tooltip.tooltip=Tooltip Einstellungen schematica.config.category.general=Generell schematica.config.category.general.tooltip=Generelle Einstellungen -# schematica.config.category.server=Server schematica.config.category.server.tooltip=Einstellungen am Server # gui - config - render schematica.config.alphaEnabled=Alpha eingeschalten schematica.config.alphaEnabled.tooltip=Aktiviert transparente Blöcke. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer schematica.config.placeDelay=Abstand zwischen Blockplatzierung schematica.config.placeDelay.tooltip=Abstan (in ticks) in der ein Spieler Blöcke setzen kann. -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. schematica.config.placeInstantly=Blöcke sofort setzen schematica.config.placeInstantly.tooltip=Platziere alle Blöcke innerhalb eines Ticks. schematica.config.destroyBlocks=Zerstöre Blöcke @@ -77,10 +58,6 @@ schematica.config.swapSlots.tooltip=Der Drucker wird Items aus deinem Inventar v # gui - config - tooltip schematica.config.tooltipEnabled=Tooltip anschalten schematica.config.tooltipEnabled.tooltip=Zeigt einen Tooltip an, wenn man mit der Maus über einen Block fährt. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general schematica.config.schematicDirectory=Schematic Verzeichnis @@ -95,13 +72,11 @@ schematica.config.loadEnabled=Laden erlauben schematica.config.loadEnabled.tooltip=Erlaubt es Spielern, Schematics zu laden. # keys -# schematica.key.category=Schematica schematica.key.load=Schematic laden schematica.key.save=Schematic speichern schematica.key.control=Schematic verändern # commands - save -# schematica.command.save.usage=/schematicaSave schematica.command.save.playersOnly=Nur Spieler können dieses Kommando ausführen. schematica.command.save.started=%d Chunks werden in %s gespeichert. schematica.command.save.saveSucceeded=%s wurde erfolgreich gespeichert. @@ -110,7 +85,6 @@ schematica.command.save.quotaExceeded=Du kannst keine Schematics mehr speichern, schematica.command.save.playerSchematicDirUnavailable=Es gab ein Problem, deine Schematic zu speichern. Bitte kontaktiere umgehend einen Server Administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] schematica.command.list.notAvailable=Dir kann keine Liste deiner Schematics angezeigt werden. schematica.command.list.remove=Entfernen schematica.command.list.download=Herunterladen @@ -119,13 +93,5 @@ schematica.command.list.noSuchPage=Keine Seite schematica.command.list.noSchematics=Es sind keine Schematics verfügbar. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 6ed955f8..a61e0d2f 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -39,8 +39,6 @@ schematica.config.category.tooltip=Tooltip schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render schematica.config.alphaEnabled=Alpha Enabled @@ -87,12 +85,6 @@ schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys schematica.key.category=Schematica @@ -101,31 +93,9 @@ schematica.key.save=Save schematic schematica.key.control=Manipulate schematic # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 5d458ae1..aef81c82 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Plans schematica.gui.point.red=Red dot schematica.gui.point.blue=Blue dot schematica.gui.saveselection=Save it as a blueprint -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Stuff schematica.gui.materialname=Stuff schematica.gui.materialamount=Number schematica.gui.printer=Printing thing -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Load yer blueprint schematica.key.save=Keep yer blueprint schematica.key.control=Change yer blueprint # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index ea9082eb..a6832f21 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -19,113 +19,34 @@ schematica.gui.operations=Acciones schematica.gui.point.red=Punto rojo schematica.gui.point.blue=Punto Azul schematica.gui.saveselection=Guardar selección como esquema -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Materiales -# schematica.gui.materialname=Material schematica.gui.materialamount=Cantidad schematica.gui.printer=Impresora -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Cargar esquema schematica.key.save=Guardar esquema schematica.key.control=Editar esquema # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 07296dc6..5de80e0d 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -19,113 +19,33 @@ schematica.gui.operations=Operaciones schematica.gui.point.red=Punto rojo schematica.gui.point.blue=Punto azul schematica.gui.saveselection=Guardar lo seleccionado como un esquema -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Materiales -# schematica.gui.materialname=Material schematica.gui.materialamount=Cantidad -# schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Cargar esquema schematica.key.save=Guardar esquema schematica.key.control=Manipular esquema # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 9676d8d7..ae4c2116 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Toiminnot schematica.gui.point.red=Punainen piste schematica.gui.point.blue=Sininen piste schematica.gui.saveselection=Tallenna valinta kaavana -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Materiaalit schematica.gui.materialname=Materiaali schematica.gui.materialamount=Määrä schematica.gui.printer=Tulostin -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Lataa kaava schematica.key.save=Tallenna kaava schematica.key.control=Käsittele kaavaa # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index ec2b6f76..751a8b4e 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Opérations schematica.gui.point.red=Point rouge schematica.gui.point.blue=Point bleu schematica.gui.saveselection=Sauvegarder la sélection en tant que schematic -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X : schematica.gui.y=Y : schematica.gui.z=Z : @@ -28,104 +26,28 @@ schematica.gui.materials=Matériaux schematica.gui.materialname=Matériau schematica.gui.materialamount=Quantité schematica.gui.printer=Mode imprimante -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Charger un schematic schematica.key.save=Enregistrer le schematic schematica.key.control=Manipuler le schematic # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 1ef9d1fe..366371f2 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Műveletek schematica.gui.point.red=Piros pont schematica.gui.point.blue=Kék pont schematica.gui.saveselection=Kijelölés mentése kliséként -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Anyagfelhasználás schematica.gui.materialname=Anyag schematica.gui.materialamount=Mennyiség schematica.gui.printer=Nyomtató -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Klisé betöltése schematica.key.save=Klisé mentése schematica.key.control=Klisé módosítása # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 54e28ed3..4aacf379 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -19,113 +19,34 @@ schematica.gui.operations=Operazioni schematica.gui.point.red=Punto rosso schematica.gui.point.blue=Punto blu schematica.gui.saveselection=Salva la selezione come schematica -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Materiali schematica.gui.materialname=Materiale schematica.gui.materialamount=Quantità -# schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Carica schematica schematica.key.save=Salva schematica schematica.key.control=Manipola schematica # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index 817bdbe8..f4ad7a7f 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -103,29 +103,11 @@ schematica.key.control=Schematic 조작 # commands - save schematica.command.save.usage=/schematicaSave <이름> schematica.command.save.playersOnly=이 커맨드는 오직 플레이어만 사용할 수 있습니다. -# schematica.command.save.started=Started saving %d chunks into %s. schematica.command.save.saveSucceeded=%s을(를) 성공적으로 저장하였습니다. schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제가 발생하였습니다. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 463d6d7e..fc5f3d85 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -1,131 +1,29 @@ # gui - general -# schematica.gui.openFolder=Open schematic folder schematica.gui.done=Perfectus -# schematica.gui.title=Select schematic file -# schematica.gui.folderInfo=(Place schematic files here) -# schematica.gui.noschematic=-- No schematic -- -# schematica.gui.increase=+ -# schematica.gui.decrease=- -# schematica.gui.hide=Hide schematica.gui.all=OMNES schematica.gui.show=Ostende -# schematica.gui.movehere=Move here -# schematica.gui.flip=Flip -# schematica.gui.rotate=Rotate -# schematica.gui.save=Save -# schematica.gui.moveschematic=Move schematic -# schematica.gui.layers=Layers -# schematica.gui.operations=Operations schematica.gui.point.red=Rubra res schematica.gui.point.blue=Caerulea res -# schematica.gui.saveselection=Save the selection as a schematic -# schematica.gui.on=ON -# schematica.gui.off=OFF -# schematica.gui.x=X: -# schematica.gui.y=Y: -# schematica.gui.z=Z: -# schematica.gui.materials=Materials -# schematica.gui.materialname=Material schematica.gui.materialamount=Numerus -# schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica -# schematica.key.load=Load schematic -# schematica.key.save=Save schematic -# schematica.key.control=Manipulate schematic # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 493a6a71..ac4fba68 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -19,113 +19,34 @@ schematica.gui.operations=Veiksmas schematica.gui.point.red=Raudonasis taðkas schematica.gui.point.blue=Mëlynasis taðkas schematica.gui.saveselection=Iðsaugoti paþymëta plotà kaip schemà? -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Medþiagos schematica.gui.materialname=Medþiaga schematica.gui.materialamount=Kiekis -# schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Atidaryti schemà schematica.key.save=Iðsaugoti schemà schematica.key.control=Manipuliuoti schemà # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index d9064a41..f524510c 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -19,113 +19,34 @@ schematica.gui.operations=Handelingen schematica.gui.point.red=Rood punt schematica.gui.point.blue=Blauw punt schematica.gui.saveselection=Sla de selectie op als schematic -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Materialen schematica.gui.materialname=Materiaal schematica.gui.materialamount=Hoeveelheid -# schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Laad schematic schematica.key.save=Sla schematic op schematica.key.control=Bewerk schematic # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index d33b4fe0..06405ba3 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Operasjoner schematica.gui.point.red=Rødt punkt schematica.gui.point.blue=Blått punkt schematica.gui.saveselection=Lagre utvalget som en tegning -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,19 +26,14 @@ schematica.gui.materials=Materialer schematica.gui.materialname=Materiale schematica.gui.materialamount=Mengde schematica.gui.printer=Printer -# schematica.gui.unknownblock=Unknown Block # gui - config - categories schematica.config.category.render=Gjengivelse schematica.config.category.render.tooltip=Gjengivelsesrelaterte innstillinger. schematica.config.category.printer=Printer schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=Generelt schematica.config.category.general.tooltip=Generelle innstillinger. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render schematica.config.alphaEnabled=Alpha aktivert @@ -65,34 +58,16 @@ schematica.config.timeout=Tidsavbrudd schematica.config.timeout.tooltip=Tidsavbrudd før nytt forsøk på å plassere blokker. schematica.config.placeInstantly=Plasser umiddelbart schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plassert i ett tikk. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Plasser kun tilstøtende schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general schematica.config.schematicDirectory=Tegningskatalog schematica.config.schematicDirectory.tooltip=Tegningskatalog. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys schematica.key.category=Schematica @@ -101,31 +76,9 @@ schematica.key.save=Lagre tegning schematica.key.control=Manipuler tegning # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index eca3fe78..bdb4726d 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -19,113 +19,34 @@ schematica.gui.operations=Operacje schematica.gui.point.red=Czerwony znacznik schematica.gui.point.blue=Niebieski znacznik schematica.gui.saveselection=Zapisz zaznaczenie jako schemat -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: schematica.gui.materials=Materialy -# schematica.gui.materialname=Material schematica.gui.materialamount=Ilosc schematica.gui.printer=Drukarka -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Ladowanie schematu schematica.key.save=Zapisywanie schematu schematica.key.control=Manipulacja schematem # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 8818f95e..83acf6bf 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Operaçőes schematica.gui.point.red=Ponto Vermelho schematica.gui.point.blue=Ponto Azul schematica.gui.saveselection=Guardar selecçăo como uma schematica -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Materiais schematica.gui.materialname=Material schematica.gui.materialamount=Quantidade schematica.gui.printer=Modo de construçăo automática -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Carregar schematica schematica.key.save=Guardar schematica schematica.key.control=Manipular schematica # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 628ad402..359fb97b 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Операции schematica.gui.point.red=Красная точка schematica.gui.point.blue=Синяя точка schematica.gui.saveselection=Сохранить схему выделенной области -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,71 +26,18 @@ schematica.gui.materials=Материалы schematica.gui.materialname=Материал schematica.gui.materialamount=Количество schematica.gui.printer=Принтер -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys schematica.key.category=Schematica @@ -101,31 +46,9 @@ schematica.key.save=Сохранить схему schematica.key.control=Манипулирование схемой # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index c311a9b6..6dbbcb5c 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Operácie schematica.gui.point.red=Červený bod schematica.gui.point.blue=Modrý bod schematica.gui.saveselection=Uložiť výber ako schému -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Materiály schematica.gui.materialname=Materiál schematica.gui.materialamount=Množstvo schematica.gui.printer=Tlačiareň -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Načítať schému schematica.key.save=Uložiť schému schematica.key.control=Manipulovať so schémou # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index f58d1a4b..2b7865d1 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Operacije schematica.gui.point.red=Rdeča točka schematica.gui.point.blue=Modra točka schematica.gui.saveselection=Shrani izbrano območje kot shemo -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Materiali schematica.gui.materialname=Material schematica.gui.materialamount=Količina schematica.gui.printer=Tiskalnik -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Naloži shemo schematica.key.save=Shrani shemo schematica.key.control=Manipuliraj shemo # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index a5af4efc..b770ae87 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -19,8 +19,6 @@ schematica.gui.operations=การดำเนินงาน schematica.gui.point.red=จุดแดง schematica.gui.point.blue=จุดน้ำเงิน schematica.gui.saveselection=บันทึกจุดที่เลือกไปยัง Schematic -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=ส่วนประกอบ schematica.gui.materialname=ส่วนประกอบ schematica.gui.materialamount=จำนวน schematica.gui.printer=การปริ๊น -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=เปิดไฟล์ Schematic schematica.key.save=บันทึกไฟล์ Schematic schematica.key.control=จัดการ Schematic # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 964a7a17..4f71171a 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -19,8 +19,6 @@ schematica.gui.operations=İşlemler schematica.gui.point.red=Kırmızı nokta schematica.gui.point.blue=Mavi nokta schematica.gui.saveselection=Seçimi şematik olarak kaydet -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Malzemeler schematica.gui.materialname=Malzeme schematica.gui.materialamount=Miktar schematica.gui.printer=Yazıcı -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=Şematiki yükle schematica.key.save=Şematiki kaydet schematica.key.control=Şematiki işleyin # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 5c232198..fb7a3c8e 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -19,8 +19,6 @@ schematica.gui.operations=Операції schematica.gui.point.red=Червона мітка schematica.gui.point.blue=Синя мітка schematica.gui.saveselection=Зберегти виділену технологічну схему -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=Х: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=Матеріали schematica.gui.materialname=Матеріал schematica.gui.materialamount=кількість schematica.gui.printer=Принтер -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=завантажити технологічну схему schematica.key.save=Зберегти технологічну схему schematica.key.control=маніпулювати технологічною схемою схемою # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index fb91bdd1..39e0c564 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -19,8 +19,6 @@ schematica.gui.operations=操作 schematica.gui.point.red=红点 schematica.gui.point.blue=蓝点 schematica.gui.saveselection=将选区保存为Schematic文件 -# schematica.gui.on=ON -# schematica.gui.off=OFF schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: @@ -28,104 +26,28 @@ schematica.gui.materials=材料 schematica.gui.materialname=材料 schematica.gui.materialamount=数量 schematica.gui.printer=投影 -# schematica.gui.unknownblock=Unknown Block # gui - config - categories -# schematica.config.category.render=Rendering -# schematica.config.category.render.tooltip=Render related settings. -# schematica.config.category.printer=Printer -# schematica.config.category.printer.tooltip=Printer related settings. -# schematica.config.category.tooltip=Tooltip -# schematica.config.category.tooltip.tooltip=Tooltip related settings. -# schematica.config.category.general=General -# schematica.config.category.general.tooltip=General settings. -# schematica.config.category.server=Server -# schematica.config.category.server.tooltip=Server-side settings. # gui - config - render -# schematica.config.alphaEnabled=Alpha Enabled -# schematica.config.alphaEnabled.tooltip=Enable transparent textures. -# schematica.config.alpha=Alpha -# schematica.config.alpha.tooltip=Alpha value used when rendering the schematic (1.0 = opaque, 0.5 = half transparent, 0.0 = transparent). -# schematica.config.highlight=Highlight Blocks -# schematica.config.highlight.tooltip=Highlight invalid placed blocks and to be placed blocks. -# schematica.config.highlightAir=Highlight Air -# schematica.config.highlightAir.tooltip=Highlight blocks that should be air. -# schematica.config.blockDelta=Block Delta -# schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -# schematica.config.drawQuads=Draw Quads -# schematica.config.drawQuads.tooltip=Draw surface areas. -# schematica.config.drawLines=Draw Lines -# schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer -# schematica.config.placeDelay=Placement Delay -# schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). -# schematica.config.timeout=Timeout -# schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. -# schematica.config.placeInstantly=Place Instantly -# schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. -# schematica.config.destroyBlocks=Destroy Blocks -# schematica.config.destroyBlocks.tooltip=The printer will destroy blocks (creative mode only). -# schematica.config.destroyInstantly=Destroy Instantly -# schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. -# schematica.config.placeAdjacent=Place Only Adjacent -# schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -# schematica.config.swapSlots=Swap Slots -# schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. # gui - config - tooltip -# schematica.config.tooltipEnabled=Tooltip Enabled -# schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -# schematica.config.tooltipX=Tooltip X -# schematica.config.tooltipX.tooltip=Relative tooltip X. -# schematica.config.tooltipY=Tooltip Y -# schematica.config.tooltipY.tooltip=Relative tooltip Y. # gui - config - general -# schematica.config.schematicDirectory=Schematic Directory -# schematica.config.schematicDirectory.tooltip=Schematic directory. # gui - config - server -# schematica.config.printerEnabled=Allow Printer -# schematica.config.printerEnabled.tooltip=Allow players to use the printer. -# schematica.config.saveEnabled=Allow Saving -# schematica.config.saveEnabled.tooltip=Allow players to save schematics. -# schematica.config.loadEnabled=Allow Loading -# schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys -# schematica.key.category=Schematica schematica.key.load=载入Schematic文件 schematica.key.save=保存Schematic文件 schematica.key.control=调整Schematic文件 # commands - save -# schematica.command.save.usage=/schematicaSave -# schematica.command.save.playersOnly=This command can only be used by players. -# schematica.command.save.started=Started saving %d chunks into %s. -# schematica.command.save.saveSucceeded=Successfully saved %s. -# schematica.command.save.saveFailed=There was a problem saving the schematic %s. -# schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. -# schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list -# schematica.command.list.usage=/schematicaList [page] -# schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. -# schematica.command.list.remove=Remove -# schematica.command.list.download=Download -# schematica.command.list.header=--- Showing schematics page %d of %d --- -# schematica.command.list.noSuchPage=No such page -# schematica.command.list.noSchematics=You have no schematics available. # commands - remove -# schematica.command.remove.usage=/schematicaRemove -# schematica.command.remove.schematicRemoved=Schematic "%s" removed. -# schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. -# schematica.command.remove.areYouSure=Are you sure? # commands - download -# schematica.command.download.usage=/schematicaDownload -# schematica.command.download.started=Started downloading %s... -# schematica.command.download.downloadSucceeded=Successfully downloaded %s. -# schematica.command.download.downloadFail=Download failed. From 79f8e5171468a3c0a539bfae7986671384459a27 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 15 Jan 2015 15:25:56 +0100 Subject: [PATCH 159/314] Gradle tweaks. --- gradle/scripts/dependencies.gradle | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle index b8b736b4..2144dc25 100644 --- a/gradle/scripts/dependencies.gradle +++ b/gradle/scripts/dependencies.gradle @@ -9,14 +9,9 @@ dependencies { compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev' } -def addDependency(depFilename, depName, depPath) { - def depfile = new File('libs/' + depFilename) - if (depfile.isFile()) { +def addDependency(depFilter, depName, depPath) { + if (fileTree('libs').include(depFilter).getFiles().size() == 1) { logger.lifecycle "Building with ${depName}..." - - dependencies { - compile files(depfile) - } } else { logger.warn "Building without ${depName}..." From 4e95ac72252433c694bc0823656fcfa677bb0f35 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 19 Jan 2015 16:15:37 +0100 Subject: [PATCH 160/314] Fixed the tooltip ignoring the config value. --- .../schematica/handler/client/RenderTickHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 986a947f..392e9d82 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.handler.client; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.tooltip.TooltipHandler; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -24,7 +25,9 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { ClientProxy.movingObjectPosition = schematic != null ? rayTrace(schematic, 1.0f) : null; - TooltipHandler.INSTANCE.renderTooltip(schematic, ClientProxy.movingObjectPosition); + if (ConfigurationHandler.tooltipEnabled) { + TooltipHandler.INSTANCE.renderTooltip(schematic, ClientProxy.movingObjectPosition); + } } private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { From c90c489735ac698416d578bd38991d0e01587a07 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 23 Jan 2015 00:11:39 +0100 Subject: [PATCH 161/314] Removed debug code... --- .../com/github/lunatrius/schematica/world/SchematicWorld.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 675973e3..bd131f57 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -90,7 +90,6 @@ public TileEntity getTileEntity(int x, int y, int z) { public void setTileEntity(int x, int y, int z, TileEntity tileEntity) { this.schematic.setTileEntity(x, y, z, tileEntity); initializeTileEntity(tileEntity); - System.out.println("BUGGER!"); } @Override From 44672b19ab89825c7205d0b930f70b860a277027 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 1 Feb 2015 01:49:28 +0100 Subject: [PATCH 162/314] Fixed non vanilla air blocks from being added to the material list. --- .../schematica/world/SchematicWorld.java | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index bd131f57..0527bc2c 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -115,14 +115,7 @@ public int getBlockMetadata(int x, int y, int z) { @Override public boolean isBlockNormalCubeDefault(int x, int y, int z, boolean _default) { - Block block = getBlock(x, y, z); - if (block == null) { - return false; - } - if (block.isNormalCube()) { - return true; - } - return _default; + return getBlock(x, y, z).isNormalCube(); } @Override @@ -132,11 +125,7 @@ protected int func_152379_p() { @Override public boolean isAirBlock(int x, int y, int z) { - Block block = getBlock(x, y, z); - if (block == null) { - return true; - } - return block.isAir(this, x, y, z); + return getBlock(x, y, z).isAir(this, x, y, z); } @Override @@ -190,11 +179,7 @@ public boolean isSideSolid(int x, int y, int z, ForgeDirection side) { @Override public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { - Block block = getBlock(x, y, z); - if (block == null) { - return false; - } - return block.isSideSolid(this, x, y, z, side); + return getBlock(x, y, z).isSideSolid(this, x, y, z, side); } public void initializeTileEntity(TileEntity tileEntity) { @@ -242,7 +227,7 @@ public List getBlockList() { item = Item.getItemFromBlock(block); itemDamage = getBlockMetadata(x, y, z); - if (block == null || block == Blocks.air) { + if (block == Blocks.air || block.isAir(this, x, y, z)) { continue; } From 41ca7ac9c0bc64e00e219712a03079c0ff5a8e4d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 1 Feb 2015 01:51:48 +0100 Subject: [PATCH 163/314] Use the world method instead... --- .../com/github/lunatrius/schematica/world/SchematicWorld.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 0527bc2c..07fd4728 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -227,7 +227,7 @@ public List getBlockList() { item = Item.getItemFromBlock(block); itemDamage = getBlockMetadata(x, y, z); - if (block == Blocks.air || block.isAir(this, x, y, z)) { + if (block == Blocks.air || isAirBlock(x, y, z)) { continue; } From 0c6f104006c4200c181feeaf0fee2a6b64e1e250 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 2 Feb 2015 01:03:31 +0100 Subject: [PATCH 164/314] Update to 1.8. A lot of things don't work (yet). --- gradle.properties | 9 +- gradle/scripts/forge.gradle | 3 + .../lunatrius/schematica/api/ISchematic.java | 93 +- .../api/event/PostSchematicCaptureEvent.java | 2 +- .../api/event/PreSchematicSaveEvent.java | 3 +- .../schematica/api/event/package-info.java | 2 +- .../schematica/api/package-info.java | 2 +- .../schematica/SchematicPrinter.java | 113 +-- .../lunatrius/schematica/Schematica.java | 28 +- .../schematica/client/gui/GuiFactory.java | 2 +- .../schematica/client/gui/GuiHelper.java | 19 +- .../schematica/client/gui/GuiModConfig.java | 4 +- .../client/gui/GuiSchematicControl.java | 3 +- .../client/gui/GuiSchematicLoad.java | 6 + .../client/gui/GuiSchematicLoadSlot.java | 6 +- .../client/gui/GuiSchematicMaterials.java | 7 + .../client/gui/GuiSchematicMaterialsSlot.java | 8 +- .../client/gui/GuiSchematicSave.java | 6 +- .../client/renderer/RenderSchematic.java | 821 ++++++++++++++++++ .../renderer/RendererSchematicChunk.java | 83 +- .../RendererSchematicChunkComparator.java | 1 + .../renderer/RendererSchematicGlobal.java | 20 +- .../command/CommandSchematicaDownload.java | 13 +- .../command/CommandSchematicaList.java | 6 +- .../command/CommandSchematicaRemove.java | 6 +- .../command/CommandSchematicaSave.java | 18 +- .../schematica/config/BlockInfo.java | 14 +- .../schematica/config/PlacementData.java | 18 +- .../handler/ConfigurationHandler.java | 6 +- .../schematica/handler/DownloadHandler.java | 4 +- .../schematica/handler/PlayerHandler.java | 4 +- .../schematica/handler/QueueTickHandler.java | 8 +- .../handler/client/ChatEventHandler.java | 2 +- .../handler/client/InputHandler.java | 17 +- .../handler/client/OverlayHandler.java | 27 + .../handler/client/RenderTickHandler.java | 12 +- .../handler/client/TickHandler.java | 12 +- .../lunatrius/schematica/nbt/NBTHelper.java | 6 +- .../schematica/network/PacketHandler.java | 6 +- .../network/message/MessageCapabilities.java | 6 +- .../network/message/MessageDownloadBegin.java | 8 +- .../message/MessageDownloadBeginAck.java | 6 +- .../network/message/MessageDownloadChunk.java | 30 +- .../message/MessageDownloadChunkAck.java | 6 +- .../network/message/MessageDownloadEnd.java | 8 +- .../schematica/proxy/ClientProxy.java | 42 +- .../schematica/proxy/CommonProxy.java | 31 +- .../schematica/proxy/ServerProxy.java | 6 +- .../lunatrius/schematica/reference/Names.java | 1 - .../schematica/tooltip/TooltipHandler.java | 36 +- .../schematica/world/SchematicWorld.java | 200 +++-- .../world/WorldProviderSchematic.java | 15 + .../world/chunk/ChunkProviderSchematic.java | 52 +- .../world/chunk/ChunkSchematic.java | 37 + .../world/schematic/SchematicAlpha.java | 35 +- .../world/schematic/SchematicFormat.java | 2 +- .../world/schematic/SchematicUtil.java | 2 +- .../world/storage/SaveHandlerSchematic.java | 2 +- .../schematica/world/storage/Schematic.java | 73 +- src/main/resources/META-INF/schematica_at.cfg | 1 + 60 files changed, 1502 insertions(+), 517 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java create mode 100644 src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java create mode 100644 src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java diff --git a/gradle.properties b/gradle.properties index 25e7260a..fca62716 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,11 @@ version_major=1 version_minor=7 version_micro=5 -version_minecraft=1.7.10 -version_forge=10.13.2.1230 -version_minforge=10.13.0.1185 -version_lunatriuscore=1.1.2.20 +version_minecraft=1.8 +version_forge=11.14.0.1297 +version_minforge=11.14.0.1237 +version_mappings=snapshot_20150127 +version_lunatriuscore=1.1.2.21 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/gradle/scripts/forge.gradle b/gradle/scripts/forge.gradle index e51f9f76..7964dc4c 100644 --- a/gradle/scripts/forge.gradle +++ b/gradle/scripts/forge.gradle @@ -11,6 +11,9 @@ idea { minecraft { version = "${project.version_minecraft}-${project.version_forge}" + if (project.hasProperty('version_mappings')) + mappings = project.version_mappings + if (!project.hasProperty('run_location')) runDir = 'run' else diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java index 9c6ae298..4e86b863 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -1,124 +1,95 @@ package com.github.lunatrius.schematica.api; -import com.github.lunatrius.core.util.vector.Vector3f; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; +import net.minecraft.util.BlockPos; import java.util.List; public interface ISchematic { /** - * Gets a block at a given location within the schematic. Requesting a block outside of those bounds returns Air. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. + * Gets a block state at a given location within the schematic. Requesting a block state outside of those bounds + * returns the default block state for air. + * + * @param pos the location in world space. * @return the block at the requested location. */ - Block getBlock(int x, int y, int z); - /** - * Sets the block at the given location, metadata will be set to 0. Attempting to set a block outside of the schematic - * boundaries or with an invalid block will result in no change being made and this method will return false. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. - * @param block the Block to set - * @return true if the block was successfully set. - */ - boolean setBlock(int x, int y, int z, Block block); + IBlockState getBlockState(BlockPos pos); /** - * Sets the block and metadata at the given location. Attempting to set a block outside of the schematic - * boundaries or with an invalid block will result in no change being made and this method will return false. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. - * @param block the Block to set - * @param metadata the metadata value to set. - * @return true if the block was successfully set. + * Sets the block state at the given location. Attempting to set a block state outside of the schematic + * boundaries or with an invalid block state will result in no change being made and this method will return false. + * + * @param pos the location in world space. + * @param blockState the block state to set + * @return true if the block state was successfully set. */ - boolean setBlock(int x, int y, int z, Block block, int metadata); + boolean setBlockState(BlockPos pos, IBlockState blockState); /** - * Gets the Tile Entity at the requested location. If no tile entity exists at that location, null will be returned. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. + * Gets the tile entity at the requested location. If no tile entity exists at that location, null will be returned. + * + * @param pos the location in world space. * @return the located tile entity. */ - TileEntity getTileEntity(int x, int y, int z); + TileEntity getTileEntity(BlockPos pos); /** * returns a list of all tile entities in the schematic. + * * @return all tile entities. */ List getTileEntities(); /** * Add or replace a tile entity to a block at the requested location. Does nothing if the location is out of bounds. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. - * @param tileEntity the Tile Entity to set. - */ - void setTileEntity(int x, int y, int z, TileEntity tileEntity); - - /** - * Removes a Tile Entity from the specific location if it exists, otherwise it silently continues. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. - */ - void removeTileEntity(int x, int y, int z); - - /** - * Gets the metadata of the block at the requested location. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. - * @return the Metadata Value + * + * @param pos the location in world space. + * @param tileEntity the tile entity to set. */ - int getBlockMetadata(int x, int y, int z); + void setTileEntity(BlockPos pos, TileEntity tileEntity); /** - * Modify the metadata of the block at the requested location. Attempting to set metadata outside of the schematic - * boundaries will result in no change being made and this method will return false. - * @param x the X coord in world space. - * @param y the Y coord in world space. - * @param z the Z coord in world space. - * @param metadata the Metadata Value - * @return true if the block was successfully set. + * Removes a tile entity from the specific location if it exists, otherwise it silently continues. + * + * @param pos the location in world space. */ - boolean setBlockMetadata(int x, int y, int z, int metadata); + void removeTileEntity(BlockPos pos); /** * Retrieves the icon that will be used to save the schematic. + * * @return the schematic's future icon. */ ItemStack getIcon(); /** * Modifies the icon that will be used when saving the schematic. + * * @param icon an ItemStack of the Item you wish you use as the icon. */ void setIcon(ItemStack icon); /** * The width of the schematic + * * @return the schematic width */ int getWidth(); /** * The length of the schematic + * * @return the schematic length */ int getLength(); /** * The height of the schematic + * * @return the schematic height */ int getHeight(); diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java index 017108da..afcb8a55 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.api.event; import com.github.lunatrius.schematica.api.ISchematic; -import cpw.mods.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.Event; /** * This event is fired after an ISchematic has been created out of a part of the world. diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java index c6d422c9..c31cce88 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java @@ -1,7 +1,8 @@ package com.github.lunatrius.schematica.api.event; -import cpw.mods.fml.common.eventhandler.Event; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fml.common.eventhandler.Event; + import java.util.Map; /** diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java index 284a7877..13ff4d6f 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java @@ -1,4 +1,4 @@ @API(owner = "SchematicaAPI", apiVersion = "1.0", provides = "SchematicaAPI|Events") package com.github.lunatrius.schematica.api.event; -import cpw.mods.fml.common.API; +import net.minecraftforge.fml.common.API; diff --git a/src/api/java/com/github/lunatrius/schematica/api/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/package-info.java index cb0a33be..b0818b08 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/package-info.java +++ b/src/api/java/com/github/lunatrius/schematica/api/package-info.java @@ -1,4 +1,4 @@ @API(owner = "Schematica", apiVersion = "1.0", provides = "SchematicaAPI") package com.github.lunatrius.schematica.api; -import cpw.mods.fml.common.API; +import net.minecraftforge.fml.common.API; diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 7ac58f2f..09cefe17 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.config.PlacementData; @@ -7,11 +8,12 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; @@ -19,12 +21,14 @@ import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.fluids.BlockFluidBase; +import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; import java.util.List; @@ -96,8 +100,8 @@ public void refresh() { } public boolean print() { - final EntityClientPlayerMP player = this.minecraft.thePlayer; - final World world = this.minecraft.theWorld; + final EntityPlayerSP player = this.minecraft.thePlayer; + final WorldClient world = this.minecraft.theWorld; syncSneaking(player, true); @@ -112,17 +116,19 @@ public boolean print() { final int slot = player.inventory.currentItem; final boolean isSneaking = player.isSneaking(); + final MBlockPos pos = new MBlockPos(); + final boolean isRenderingLayer = this.schematic.isRenderingLayer; final int renderingLayer = this.schematic.renderingLayer; - for (int y = minY; y < maxY; y++) { - if (isRenderingLayer && y != renderingLayer) { + for (pos.y = minY; pos.y < maxY; pos.y++) { + if (isRenderingLayer && pos.y != renderingLayer) { continue; } - for (int x = minX; x < maxX; x++) { - for (int z = minZ; z < maxZ; z++) { + for (pos.x = minX; pos.x < maxX; pos.x++) { + for (pos.z = minZ; pos.z < maxZ; pos.z++) { try { - if (placeBlock(world, player, x, y, z)) { + if (placeBlock(world, player, pos)) { player.inventory.currentItem = slot; syncSneaking(player, isSneaking); return true; @@ -142,7 +148,10 @@ public boolean print() { return true; } - private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z) { + private boolean placeBlock(WorldClient world, EntityPlayerSP player, BlockPos pos) { + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); if (this.timeout[x][y][z] > 0) { this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; return false; @@ -151,29 +160,34 @@ private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z final int wx = this.schematic.position.x + x; final int wy = this.schematic.position.y + y; final int wz = this.schematic.position.z + z; + final BlockPos realPos = new BlockPos(wx, wy, wz); + + final IBlockState blockState = this.schematic.getBlockState(pos); + final Block block = blockState.getBlock(); + final int metadata = block.getMetaFromState(blockState); - final Block block = this.schematic.getBlock(x, y, z); - final Block realBlock = world.getBlock(wx, wy, wz); - final int metadata = this.schematic.getBlockMetadata(x, y, z); - final int realMetadata = world.getBlockMetadata(wx, wy, wz); + final IBlockState realBlockState = world.getBlockState(realPos); + final Block realBlock = realBlockState.getBlock(); + final int realMetadata = realBlock.getMetaFromState(realBlockState); + // TODO: compare block states directly? if (block == realBlock && metadata == realMetadata) { return false; } - if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(wx, wy, wz) && this.minecraft.playerController.isInCreativeMode()) { - this.minecraft.playerController.clickBlock(wx, wy, wz, 0); + if (ConfigurationHandler.destroyBlocks && !world.isAirBlock(realPos) && this.minecraft.playerController.isInCreativeMode()) { + this.minecraft.playerController.clickBlock(realPos, EnumFacing.DOWN); this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; return !ConfigurationHandler.destroyInstantly; } - if (this.schematic.isAirBlock(x, y, z)) { + if (this.schematic.isAirBlock(pos)) { return false; } - if (!realBlock.isReplaceable(world, wx, wy, wz)) { + if (!realBlock.isReplaceable(world, realPos)) { return false; } @@ -183,7 +197,7 @@ private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z return false; } - if (placeBlock(this.minecraft, world, player, wx, wy, wz, item, metadata)) { + if (placeBlock(this.minecraft, world, player, realPos, item, metadata)) { this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; if (!ConfigurationHandler.placeInstantly) { @@ -194,18 +208,17 @@ private boolean placeBlock(World world, EntityPlayer player, int x, int y, int z return false; } - private boolean isSolid(World world, int x, int y, int z, ForgeDirection side) { - x += side.offsetX; - y += side.offsetY; - z += side.offsetZ; + private boolean isSolid(World world, BlockPos pos, EnumFacing side) { + final BlockPos offset = new BlockPos(pos).offset(side); - Block block = world.getBlock(x, y, z); + final IBlockState blockState = world.getBlockState(offset); + Block block = blockState.getBlock(); if (block == null) { return false; } - if (block.isAir(world, x, y, z)) { + if (block.isAir(world, offset)) { return false; } @@ -213,46 +226,46 @@ private boolean isSolid(World world, int x, int y, int z, ForgeDirection side) { return false; } - if (block.isReplaceable(world, x, y, z)) { + if (block.isReplaceable(world, offset)) { return false; } return true; } - private ForgeDirection[] getSolidSides(World world, int x, int y, int z) { - List list = new ArrayList(); + private EnumFacing[] getSolidSides(World world, BlockPos pos) { + List list = new ArrayList(); - for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - if (isSolid(world, x, y, z, side)) { + for (EnumFacing side : EnumFacing.values()) { + if (isSolid(world, pos, side)) { list.add(side); } } - ForgeDirection[] sides = new ForgeDirection[list.size()]; + EnumFacing[] sides = new EnumFacing[list.size()]; return list.toArray(sides); } - private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player, int x, int y, int z, Item item, int itemDamage) { + private boolean placeBlock(Minecraft minecraft, WorldClient world, EntityPlayerSP player, BlockPos pos, Item item, int itemDamage) { if (item instanceof ItemBucket || item == Items.sign) { return false; } PlacementData data = BlockInfo.getPlacementDataFromItem(item); - if (!isValidOrientation(player, x, y, z, data, itemDamage)) { + if (!isValidOrientation(player, pos, data, itemDamage)) { return false; } - ForgeDirection[] solidSides = getSolidSides(world, x, y, z); - ForgeDirection direction = ForgeDirection.UNKNOWN; + EnumFacing[] solidSides = getSolidSides(world, pos); + EnumFacing direction = null; float offsetY = 0.0f; if (solidSides.length > 0) { int metadata = WILDCARD_METADATA; if (data != null) { - ForgeDirection[] validDirections = data.getValidDirections(solidSides, itemDamage); + EnumFacing[] validDirections = data.getValidDirections(solidSides, itemDamage); if (validDirections.length > 0) { direction = validDirections[0]; } @@ -271,14 +284,14 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player } } - if (direction != ForgeDirection.UNKNOWN || !ConfigurationHandler.placeAdjacent) { - return placeBlock(minecraft, world, player, x, y, z, direction, 0.0f, offsetY, 0.0f); + if (direction != null || !ConfigurationHandler.placeAdjacent) { + return placeBlock(minecraft, world, player, pos, direction, 0.0f, offsetY, 0.0f); } return false; } - private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, PlacementData data, int metadata) { + private boolean isValidOrientation(EntityPlayer player, BlockPos pos, PlacementData data, int metadata) { if (data != null) { switch (data.type) { case BLOCK: { @@ -296,7 +309,7 @@ private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, Pla case PISTON: { Integer integer = data.mapping.get(ClientProxy.orientation); if (integer != null) { - return BlockPistonBase.determineOrientation(null, x, y, z, player) == BlockPistonBase.getPistonOrientation(metadata); + return BlockPistonBase.getFacingFromEntity(null, pos, player) == BlockPistonBase.getFacing(metadata); } break; } @@ -307,21 +320,19 @@ private boolean isValidOrientation(EntityPlayer player, int x, int y, int z, Pla return true; } - private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player, int x, int y, int z, ForgeDirection direction, float offsetX, float offsetY, float offsetZ) { + private boolean placeBlock(Minecraft minecraft, WorldClient world, EntityPlayerSP player, BlockPos pos, EnumFacing direction, float offsetX, float offsetY, float offsetZ) { ItemStack itemStack = player.getCurrentEquippedItem(); boolean success = false; - x += direction.offsetX; - y += direction.offsetY; - z += direction.offsetZ; + final BlockPos offset = new BlockPos(pos).offset(direction); - int side = direction.getOpposite().ordinal(); + EnumFacing side = direction.getOpposite(); - /* copypasted from n.m.client.Minecraft to sooth finicky servers */ - success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, x, y, z, side, world).isCanceled(); + // copypasted from n.m.client.Minecraft to sooth finicky servers + success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); if (success) { // still not assured! - success = minecraft.playerController.onPlayerRightClick(player, world, itemStack, x, y, z, side, Vec3.createVectorHelper(x + offsetX, y + offsetY, z + offsetZ)); + success = minecraft.playerController.onPlayerRightClick(player, world, itemStack, offset, side, new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ)); if (success) { // yes, some servers actually care about this. minecraft.thePlayer.swingItem(); @@ -335,9 +346,9 @@ private boolean placeBlock(Minecraft minecraft, World world, EntityPlayer player return success; } - private void syncSneaking(EntityClientPlayerMP player, boolean isSneaking) { + private void syncSneaking(EntityPlayerSP player, boolean isSneaking) { player.setSneaking(isSneaking); - player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? 1 : 2)); + player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? C0BPacketEntityAction.Action.START_SNEAKING : C0BPacketEntityAction.Action.STOP_SNEAKING)); } private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) { diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 1dc10e65..9f341690 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -2,22 +2,20 @@ import com.github.lunatrius.schematica.proxy.CommonProxy; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.network.NetworkCheckHandler; -import cpw.mods.fml.relauncher.Side; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.network.NetworkCheckHandler; +import net.minecraftforge.fml.relauncher.Side; import java.util.Map; @Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, guiFactory = Reference.GUI_FACTORY) public class Schematica { - @Instance(Reference.MODID) + @Mod.Instance(Reference.MODID) public static Schematica instance; @SidedProxy(serverSide = Reference.PROXY_SERVER, clientSide = Reference.PROXY_CLIENT) @@ -28,22 +26,22 @@ public boolean checkModList(Map versions, Side side) { return true; } - @EventHandler + @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); } - @EventHandler + @Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } - @EventHandler + @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); } - @EventHandler + @Mod.EventHandler public void serverStarting(FMLServerStartingEvent event) { proxy.serverStarting(event); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java index 000423a2..2b896870 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java @@ -1,8 +1,8 @@ package com.github.lunatrius.schematica.client.gui; -import cpw.mods.fml.client.IModGuiFactory; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.fml.client.IModGuiFactory; import java.util.Set; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java index 3a228f60..75118e4d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java @@ -1,9 +1,11 @@ package com.github.lunatrius.schematica.client.gui; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; @@ -11,7 +13,7 @@ import org.lwjgl.opengl.GL12; public class GuiHelper { - private static final RenderItem renderItem = new RenderItem(); + private static final RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); public static void drawItemStack(TextureManager textureManager, FontRenderer fontRenderer, int x, int y, ItemStack itemStack) { drawItemStackSlot(textureManager, x, y); @@ -19,7 +21,7 @@ public static void drawItemStack(TextureManager textureManager, FontRenderer fon if (itemStack != null && itemStack.getItem() != null) { GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); - renderItem.renderItemIntoGUI(fontRenderer, textureManager, itemStack, x + 2, y + 2); + renderItem.renderItemIntoGUI(itemStack, x + 2, y + 2); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } @@ -28,12 +30,13 @@ public static void drawItemStack(TextureManager textureManager, FontRenderer fon public static void drawItemStackSlot(TextureManager textureManager, int x, int y) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); textureManager.bindTexture(Gui.statIcons); - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125f, 18 * 0.0078125f); - tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125f, 18 * 0.0078125f); - tessellator.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125f, 0 * 0.0078125f); - tessellator.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125f, 0 * 0.0078125f); + Tessellator tessellator = Tessellator.getInstance(); + final WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + worldRenderer.startDrawingQuads(); + worldRenderer.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125f, 18 * 0.0078125f); + worldRenderer.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125f, 18 * 0.0078125f); + worldRenderer.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125f, 0 * 0.0078125f); + worldRenderer.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125f, 0 * 0.0078125f); tessellator.draw(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java index a1e2f568..0adb221c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java @@ -3,10 +3,10 @@ import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.client.config.GuiConfig; -import cpw.mods.fml.client.config.IConfigElement; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; +import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraftforge.fml.client.config.IConfigElement; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 622089dc..c52cfd1b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -106,9 +106,10 @@ public void initGui() { this.btnHide.enabled = this.schematic != null; this.btnMove.enabled = this.schematic != null; - // this.btnFlip.enabled = this.settings.schematic != null; + this.btnFlip.enabled = this.schematic != null; this.btnFlip.enabled = false; this.btnRotate.enabled = this.schematic != null; + this.btnRotate.enabled = false; this.btnMaterials.enabled = this.schematic != null; this.btnPrint.enabled = this.schematic != null && this.printer.isEnabled(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 5cf4895b..ca19cd0b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -56,6 +56,12 @@ public void initGui() { reloadSchematics(); } + @Override + public void handleMouseInput() throws IOException { + super.handleMouseInput(); + this.guiSchematicLoadSlot.handleMouseInput(); + } + @Override protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java index b5e78817..9f71be33 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java @@ -46,7 +46,7 @@ protected void drawContainerBackground(Tessellator tessellator) { } @Override - protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellator, int par6, int par7) { + protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouseY) { if (index < 0 || index >= this.guiSchematicLoad.schematicFiles.size()) { return; } @@ -60,8 +60,8 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); } - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, schematic.getItemStack()); + GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRendererObj, x, y, schematic.getItemStack()); - this.guiSchematicLoad.drawString(this.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); + this.guiSchematicLoad.drawString(this.minecraft.fontRendererObj, schematicName, x + 24, y + 6, 0x00FFFFFF); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java index 6ad40105..0f6a6dde 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java @@ -8,6 +8,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -41,6 +42,12 @@ public void initGui() { this.guiSchematicMaterialsSlot = new GuiSchematicMaterialsSlot(this); } + @Override + public void handleMouseInput() throws IOException { + super.handleMouseInput(); + this.guiSchematicMaterialsSlot.handleMouseInput(); + } + @Override protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index 20211bfb..0d3e42fa 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -45,7 +45,7 @@ protected void drawContainerBackground(Tessellator tessellator) { } @Override - protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellator, int par6, int par7) { + protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouseY) { ItemStack itemStack = this.guiSchematicMaterials.blockList.get(index); String itemName; @@ -57,9 +57,9 @@ protected void drawSlot(int index, int x, int y, int par4, Tessellator tessellat itemName = this.strUnknownBlock; } - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRenderer, x, y, itemStack); + GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRendererObj, x, y, itemStack); - this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 0xFFFFFF); - this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 6, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, itemName, x + 24, y + 6, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amount, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amount), y + 6, 0xFFFFFF); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index 6be20b66..e1888405 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -12,6 +12,8 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; +import java.io.IOException; + public class GuiSchematicSave extends GuiScreenBase { private int centerX = 0; private int centerY = 0; @@ -81,7 +83,7 @@ public void initGui() { this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, ClientProxy.isRenderingGuide ? this.strOn : this.strOff); this.buttonList.add(this.btnEnable); - this.tfFilename = new GuiTextField(this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); + this.tfFilename = new GuiTextField(id++, this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); this.textFields.add(this.tfFilename); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format("schematica.gui.save")); @@ -157,7 +159,7 @@ protected void actionPerformed(GuiButton guiButton) { } @Override - protected void keyTyped(char character, int code) { + protected void keyTyped(char character, int code) throws IOException { super.keyTyped(character, code); this.filename = this.tfFilename.getText(); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java new file mode 100644 index 00000000..1c3213a5 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -0,0 +1,821 @@ +package com.github.lunatrius.schematica.client.renderer; + +import com.github.lunatrius.core.util.vector.Vector3d; +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.world.SchematicWorld; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.ChunkRenderContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.RenderList; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VboRenderList; +import net.minecraft.client.renderer.ViewFrustum; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.IRenderChunkFactory; +import net.minecraft.client.renderer.chunk.ListChunkFactory; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.chunk.VboChunkFactory; +import net.minecraft.client.renderer.chunk.VisGraph; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.profiler.Profiler; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.IWorldAccess; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; + +import javax.vecmath.Vector3f; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +@SideOnly(Side.CLIENT) +public class RenderSchematic extends RenderGlobal implements IWorldAccess, IResourceManagerReloadListener { + public static final RenderSchematic INSTANCE = new RenderSchematic(Minecraft.getMinecraft()); + + public static final int RENDER_DISTANCE = 32; + public static final int CHUNKS_XZ = (RENDER_DISTANCE + 1) * 2; + public static final int CHUNKS_Y = 16; + public static final int CHUNKS = CHUNKS_XZ * CHUNKS_XZ * CHUNKS_Y; + public static final int PASS = 2; + + private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); + private static final Vector3d PLAYER_POSITION_OFFSET = new Vector3d(); + private final Minecraft mc; + private final Profiler profiler; + private final RenderManager renderManager; + private SchematicWorld world; + private Set chunksToUpdate = Sets.newLinkedHashSet(); + private List renderInfos = Lists.newArrayListWithCapacity(CHUNKS); + private ViewFrustum viewFrustum; + private double frustumUpdatePosX = Double.MIN_VALUE; + private double frustumUpdatePosY = Double.MIN_VALUE; + private double frustumUpdatePosZ = Double.MIN_VALUE; + private int frustumUpdatePosChunkX = Integer.MIN_VALUE; + private int frustumUpdatePosChunkY = Integer.MIN_VALUE; + private int frustumUpdatePosChunkZ = Integer.MIN_VALUE; + private double lastViewEntityX = Double.MIN_VALUE; + private double lastViewEntityY = Double.MIN_VALUE; + private double lastViewEntityZ = Double.MIN_VALUE; + private double lastViewEntityPitch = Double.MIN_VALUE; + private double lastViewEntityYaw = Double.MIN_VALUE; + private final ChunkRenderDispatcher renderDispatcher = new ChunkRenderDispatcher(); + private ChunkRenderContainer renderContainer; + private int renderDistanceChunks = -1; + private int countEntitiesTotal; + private int countEntitiesRendered; + private int countTileEntitiesTotal; + private int countTileEntitiesRendered; + private boolean vboEnabled = false; + private IRenderChunkFactory renderChunkFactory; + private double prevRenderSortX; + private double prevRenderSortY; + private double prevRenderSortZ; + private boolean displayListEntitiesDirty = true; + private int frameCount = 0; + + public RenderSchematic(final Minecraft minecraft) { + super(minecraft); + this.mc = minecraft; + this.profiler = minecraft.mcProfiler; + this.renderManager = minecraft.getRenderManager(); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GlStateManager.bindTexture(0); + this.vboEnabled = OpenGlHelper.useVbo(); + + if (this.vboEnabled) { + this.renderContainer = new VboRenderList(); + this.renderChunkFactory = new VboChunkFactory(); + } else { + this.renderContainer = new RenderList(); + this.renderChunkFactory = new ListChunkFactory(); + } + } + + @Override + public void onResourceManagerReload(final IResourceManager resourceManager) {} + + @Override + public void makeEntityOutlineShader() {} + + @Override + public void renderEntityOutlineFramebuffer() {} + + @Override + protected boolean isRenderEntityOutlines() { + return false; + } + + @Override + public void setWorldAndLoadRenderers(final WorldClient worldClient) { + if (worldClient instanceof SchematicWorld) { + setWorldAndLoadRenderers((SchematicWorld) worldClient); + } else { + setWorldAndLoadRenderers(null); + } + } + + public void setWorldAndLoadRenderers(final SchematicWorld world) { + if (this.world != null) { + this.world.removeWorldAccess(this); + } + + this.frustumUpdatePosX = Double.MIN_VALUE; + this.frustumUpdatePosY = Double.MIN_VALUE; + this.frustumUpdatePosZ = Double.MIN_VALUE; + this.frustumUpdatePosChunkX = Integer.MIN_VALUE; + this.frustumUpdatePosChunkY = Integer.MIN_VALUE; + this.frustumUpdatePosChunkZ = Integer.MIN_VALUE; + this.renderManager.set(world); + this.world = world; + + if (world != null) { + world.addWorldAccess(this); + loadRenderers(); + } + } + + @SubscribeEvent + public void onRenderWorldLast(RenderWorldLastEvent event) { + EntityPlayerSP player = this.mc.thePlayer; + if (player != null) { + ClientProxy.setPlayerData(player, event.partialTicks); + + this.profiler.startSection("schematica"); + SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + + if (schematic != null && schematic.isRendering) { + Vector3d playerPosition = ClientProxy.playerPosition.clone(); + Vector3d extra = new Vector3d(); + extra.add(schematic.position.toVector3d()); + playerPosition.sub(extra); + + playerPosition.set(schematic.position.toVector3d()).negate().add(1, 1, 1); + + GL11.glPushMatrix(); + renderSchematic(schematic, event.partialTicks); + GL11.glPopMatrix(); + } + + this.profiler.endSection(); + } + } + + private void renderSchematic(final SchematicWorld schematic, final float partialTicks) { + if (this.world != schematic) { + this.world = schematic; + + loadRenderers(); + } + + PLAYER_POSITION_OFFSET.set(ClientProxy.playerPosition).sub(this.world.position.toVector3d()); + + if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { + GL20.glUseProgram(SHADER_ALPHA.getProgram()); + GL20.glUniform1f(GL20.glGetUniformLocation(SHADER_ALPHA.getProgram(), "alpha_multiplier"), ConfigurationHandler.alpha); + } + + final int fps = Math.max(Minecraft.getDebugFPS(), 30); + renderWorld(partialTicks, System.nanoTime() + 1000000000 / fps); + + if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { + GL20.glUseProgram(0); + } + } + + private void renderWorld(final float partialTicks, final long finishTimeNano) { + GlStateManager.enableCull(); + this.profiler.endStartSection("culling"); + final Frustum frustum = new Frustum(); + final Entity entity = this.mc.getRenderViewEntity(); + + final double x = PLAYER_POSITION_OFFSET.x; + final double y = PLAYER_POSITION_OFFSET.y; + final double z = PLAYER_POSITION_OFFSET.z; + frustum.setPosition(x, y, z); + + GlStateManager.shadeModel(GL11.GL_SMOOTH); + + this.profiler.endStartSection("prepareterrain"); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + RenderHelper.disableStandardItemLighting(); + + this.profiler.endStartSection("terrain_setup"); + setupTerrain(entity, partialTicks, frustum, this.frameCount++, false); + + this.profiler.endStartSection("updatechunks"); + updateChunks(finishTimeNano); + + this.profiler.endStartSection("terrain"); + GlStateManager.matrixMode(GL11.GL_MODELVIEW); + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + renderBlockLayer(EnumWorldBlockLayer.SOLID, partialTicks, PASS, entity); + renderBlockLayer(EnumWorldBlockLayer.CUTOUT_MIPPED, partialTicks, PASS, entity); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + renderBlockLayer(EnumWorldBlockLayer.CUTOUT, partialTicks, PASS, entity); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + GlStateManager.disableBlend(); + GlStateManager.shadeModel(GL11.GL_FLAT); + GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f); + GlStateManager.matrixMode(GL11.GL_MODELVIEW); + GlStateManager.popMatrix(); + + GlStateManager.pushMatrix(); + this.profiler.endStartSection("entities"); + RenderHelper.enableStandardItemLighting(); + renderEntities(entity, frustum, partialTicks); + RenderHelper.disableStandardItemLighting(); + disableLightmap(); + GlStateManager.matrixMode(GL11.GL_MODELVIEW); + GlStateManager.popMatrix(); + + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f); + GlStateManager.enableBlend(); + GlStateManager.depthMask(false); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + GlStateManager.shadeModel(GL11.GL_SMOOTH); + + this.profiler.endStartSection("translucent"); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, partialTicks, PASS, entity); + GlStateManager.disableBlend(); + + GlStateManager.shadeModel(GL11.GL_FLAT); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.disableFog(); + } + + private void disableLightmap() { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + @Override + public void loadRenderers() { + if (this.world != null) { + this.displayListEntitiesDirty = true; + this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; + final boolean vbo = this.vboEnabled; + this.vboEnabled = OpenGlHelper.useVbo(); + + if (vbo && !this.vboEnabled) { + this.renderContainer = new RenderList(); + this.renderChunkFactory = new ListChunkFactory(); + } else if (!vbo && this.vboEnabled) { + this.renderContainer = new VboRenderList(); + this.renderChunkFactory = new VboChunkFactory(); + } + + if (this.viewFrustum != null) { + this.viewFrustum.deleteGlResources(); + } + + stopChunkUpdates(); + this.viewFrustum = new ViewFrustum(this.world, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory); + + final double posX = PLAYER_POSITION_OFFSET.x; + final double posZ = PLAYER_POSITION_OFFSET.z; + this.viewFrustum.updateChunkPositions(posX, posZ); + } + } + + @Override + protected void stopChunkUpdates() { + this.chunksToUpdate.clear(); + this.renderDispatcher.stopChunkUpdates(); + } + + @Override + public void createBindEntityOutlineFbs(final int p_72720_1_, final int p_72720_2_) {} + + @Override + public void renderEntities(final Entity renderViewEntity, final ICamera camera, final float partialTicks) { + final int entityPass = 0; + + this.profiler.startSection("prepare"); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); + this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); + + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + + this.countTileEntitiesTotal = 0; + this.countTileEntitiesRendered = 0; + + final double x = PLAYER_POSITION_OFFSET.x; + final double y = PLAYER_POSITION_OFFSET.y; + final double z = PLAYER_POSITION_OFFSET.z; + + TileEntityRendererDispatcher.staticPlayerX = x; + TileEntityRendererDispatcher.staticPlayerY = y; + TileEntityRendererDispatcher.staticPlayerZ = z; + + this.renderManager.setRenderPosition(x, y, z); + this.mc.entityRenderer.enableLightmap(); + + this.profiler.endStartSection("blockentities"); + RenderHelper.enableStandardItemLighting(); + + for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { + for (final TileEntity tileEntity : (List) renderInfo.renderChunk.getCompiledChunk().getTileEntities()) { + final AxisAlignedBB renderBB = tileEntity.getRenderBoundingBox(); + + this.countTileEntitiesTotal++; + if (!tileEntity.shouldRenderInPass(entityPass) || !camera.isBoundingBoxInFrustum(renderBB)) { + continue; + } + + TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks, -1); + this.countTileEntitiesRendered++; + } + } + + this.mc.entityRenderer.disableLightmap(); + this.profiler.endSection(); + } + + @Override + public String getDebugInfoRenders() { + final int total = this.viewFrustum.renderChunks.length; + int rendered = 0; + + for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { + final CompiledChunk compiledChunk = renderInfo.renderChunk.compiledChunk; + + if (compiledChunk != CompiledChunk.DUMMY && !compiledChunk.isEmpty()) { + rendered++; + } + } + + return String.format("C: %d/%d %sD: %d, %s", rendered, total, this.mc.renderChunksMany ? "(s) " : "", this.renderDistanceChunks, this.renderDispatcher.getDebugInfo()); + } + + @Override + public String getDebugInfoEntities() { + return String.format("E: %d/%d", this.countEntitiesRendered, this.countEntitiesTotal); + } + + public String getDebugInfoTileEntities() { + return String.format("TE: %d/%d", this.countTileEntitiesRendered, this.countTileEntitiesTotal); + } + + @Override + public void setupTerrain(final Entity viewEntity, final double partialTicks, final ICamera camera, final int frameCount, final boolean playerSpectator) { + if (this.mc.gameSettings.renderDistanceChunks != this.renderDistanceChunks) { + loadRenderers(); + } + + this.profiler.startSection("camera"); + final double posX = PLAYER_POSITION_OFFSET.x; + final double posY = PLAYER_POSITION_OFFSET.y; + final double posZ = PLAYER_POSITION_OFFSET.z; + + final double deltaX = posX - this.frustumUpdatePosX; + final double deltaY = posY - this.frustumUpdatePosY; + final double deltaZ = posZ - this.frustumUpdatePosZ; + + final int chunkCoordX = MathHelper.floor_double(posX) >> 4; + final int chunkCoordY = MathHelper.floor_double(posY) >> 4; + final int chunkCoordZ = MathHelper.floor_double(posZ) >> 4; + + if (this.frustumUpdatePosChunkX != chunkCoordX || this.frustumUpdatePosChunkY != chunkCoordY || this.frustumUpdatePosChunkZ != chunkCoordZ || deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 16.0) { + this.frustumUpdatePosX = posX; + this.frustumUpdatePosY = posY; + this.frustumUpdatePosZ = posZ; + this.frustumUpdatePosChunkX = chunkCoordX; + this.frustumUpdatePosChunkY = chunkCoordY; + this.frustumUpdatePosChunkZ = chunkCoordZ; + this.viewFrustum.updateChunkPositions(posX, posZ); + } + + this.profiler.endStartSection("renderlistcamera"); + final double x = PLAYER_POSITION_OFFSET.x; + final double y = PLAYER_POSITION_OFFSET.y; + final double z = PLAYER_POSITION_OFFSET.z; + this.renderContainer.initialize(x, y, z); + + this.profiler.endStartSection("culling"); + final BlockPos posEye = new BlockPos(x, y + viewEntity.getEyeHeight(), z); + final RenderChunk renderchunk = this.viewFrustum.getRenderChunk(posEye); + final BlockPos blockpos = new BlockPos(MathHelper.floor_double(x) & ~0xF, MathHelper.floor_double(y) & ~0xF, MathHelper.floor_double(z) & ~0xF); + + this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || posX != this.lastViewEntityX || posY != this.lastViewEntityY || posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw; + this.lastViewEntityX = posX; + this.lastViewEntityY = posY; + this.lastViewEntityZ = posZ; + this.lastViewEntityPitch = viewEntity.rotationPitch; + this.lastViewEntityYaw = viewEntity.rotationYaw; + + if (this.displayListEntitiesDirty) { + this.displayListEntitiesDirty = false; + this.renderInfos = Lists.newArrayListWithCapacity(CHUNKS); + + final LinkedList renderInfoList = Lists.newLinkedList(); + final boolean renderChunksMany = this.mc.renderChunksMany; + + if (renderchunk == null) { + final int chunkY = posEye.getY() > 0 ? 248 : 8; + + for (int chunkX = -this.renderDistanceChunks; chunkX <= this.renderDistanceChunks; chunkX++) { + for (int chunkZ = -this.renderDistanceChunks; chunkZ <= this.renderDistanceChunks; chunkZ++) { + final RenderChunk renderChunk = this.viewFrustum.getRenderChunk(new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8)); + + if (renderChunk != null && camera.isBoundingBoxInFrustum(renderChunk.boundingBox)) { + renderChunk.setFrameIndex(frameCount); + renderInfoList.add(new ContainerLocalRenderInformation(renderChunk, null, 0, null)); + } + } + } + } else { + boolean add = false; + final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, null, 0, null); + final Set visibleSides = getVisibleSides(posEye); + + if (!visibleSides.isEmpty() && visibleSides.size() == 1) { + final Vector3f viewVector = getViewVector(viewEntity, partialTicks); + final EnumFacing facing = EnumFacing.getFacingFromVector(viewVector.x, viewVector.y, viewVector.z).getOpposite(); + visibleSides.remove(facing); + } + + if (visibleSides.isEmpty()) { + add = true; + } + + if (add) { + this.renderInfos.add(renderInfo); + } else { + renderchunk.setFrameIndex(frameCount); + renderInfoList.add(renderInfo); + } + } + + while (!renderInfoList.isEmpty()) { + final ContainerLocalRenderInformation renderInfo = renderInfoList.poll(); + final RenderChunk renderChunk = renderInfo.renderChunk; + final EnumFacing facing = renderInfo.facing; + final BlockPos posChunk = renderChunk.getPosition(); + this.renderInfos.add(renderInfo); + + for (final EnumFacing side : EnumFacing.values()) { + final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, posChunk, side); + + if ((!renderChunksMany || !renderInfo.setFacing.contains(side.getOpposite())) && (!renderChunksMany || facing == null || renderChunk.getCompiledChunk().isVisible(facing.getOpposite(), side)) && neighborRenderChunk != null && neighborRenderChunk.setFrameIndex(frameCount) && camera.isBoundingBoxInFrustum(neighborRenderChunk.boundingBox)) { + final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation(neighborRenderChunk, side, renderInfo.counter + 1, null); + renderInfoNext.setFacing.addAll(renderInfo.setFacing); + renderInfoNext.setFacing.add(side); + renderInfoList.add(renderInfoNext); + } + } + } + } + + this.renderDispatcher.clearChunkUpdates(); + final Set set = this.chunksToUpdate; + this.chunksToUpdate = Sets.newLinkedHashSet(); + + for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { + final RenderChunk renderChunk = renderInfo.renderChunk; + + if (renderChunk.isNeedsUpdate() || renderChunk.isCompileTaskPending() || set.contains(renderChunk)) { + this.displayListEntitiesDirty = true; + + // TODO: remove? + if (false && isPositionInRenderChunk(blockpos, renderInfo.renderChunk)) { + this.profiler.startSection("build near"); + this.renderDispatcher.updateChunkNow(renderChunk); + renderChunk.setNeedsUpdate(false); + this.profiler.endSection(); + } else { + this.chunksToUpdate.add(renderChunk); + } + } + } + + this.chunksToUpdate.addAll(set); + this.profiler.endSection(); + } + + private boolean isPositionInRenderChunk(final BlockPos pos, final RenderChunk renderChunk) { + final BlockPos blockPos = renderChunk.getPosition(); + if (MathHelper.abs_int(pos.getX() - blockPos.getX()) > 16) { + return false; + } + + if (MathHelper.abs_int(pos.getY() - blockPos.getY()) > 16) { + return false; + } + + if (MathHelper.abs_int(pos.getZ() - blockPos.getZ()) > 16) { + return false; + } + + return true; + } + + private Set getVisibleSides(final BlockPos pos) { + final VisGraph visgraph = new VisGraph(); + final BlockPos posChunk = new BlockPos(pos.getX() & ~0xF, pos.getY() & ~0xF, pos.getZ() & ~0xF); + + for (final BlockPos.MutableBlockPos mutableBlockPos : (Iterable) BlockPos.getAllInBoxMutable(posChunk, posChunk.add(15, 15, 15))) { + if (this.world.getBlockState(mutableBlockPos).getBlock().isOpaqueCube()) { + visgraph.func_178606_a(mutableBlockPos); + } + } + + return visgraph.func_178609_b(pos); + } + + private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final BlockPos posChunk, final EnumFacing side) { + final BlockPos offset = posChunk.offset(side, 16); + if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { + return null; + } + + if (offset.getY() < 0 || offset.getY() >= 256) { + return null; + } + + if (MathHelper.abs_int(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) { + return null; + } + + return this.viewFrustum.getRenderChunk(offset); + } + + @Override + protected Vector3f getViewVector(final Entity entity, final double partialTicks) { + float rotationPitch = (float) (entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks); + final float rotationYaw = (float) (entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks); + + if (this.mc.gameSettings.thirdPersonView == 2) { + rotationPitch += 180.0f; + } + + final float f1 = (float) (1 / (360 / (Math.PI * 2))); + final float f2 = MathHelper.cos(-rotationYaw * f1 - (float) Math.PI); + final float f3 = MathHelper.sin(-rotationYaw * f1 - (float) Math.PI); + final float f4 = -MathHelper.cos(-rotationPitch * f1); + final float f5 = MathHelper.sin(-rotationPitch * f1); + return new Vector3f(f3 * f4, f5, f2 * f4); + } + + @Override + public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partialTicks, final int pass, final Entity entity) { + RenderHelper.disableStandardItemLighting(); + + if (layer == EnumWorldBlockLayer.TRANSLUCENT) { + this.profiler.startSection("translucent_sort"); + final double posX = PLAYER_POSITION_OFFSET.x; + final double posY = PLAYER_POSITION_OFFSET.y; + final double posZ = PLAYER_POSITION_OFFSET.z; + + final double deltaX = posX - this.prevRenderSortX; + final double deltaY = posY - this.prevRenderSortY; + final double deltaZ = posZ - this.prevRenderSortZ; + + if (deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 1.0) { + this.prevRenderSortX = posX; + this.prevRenderSortY = posY; + this.prevRenderSortZ = posZ; + int count = 0; + + for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { + if (renderInfo.renderChunk.compiledChunk.isLayerStarted(layer) && count++ < 15) { + this.renderDispatcher.updateTransparencyLater(renderInfo.renderChunk); + } + } + } + + this.profiler.endSection(); + } + + this.profiler.startSection("filterempty"); + int count = 0; + final boolean isTranslucent = layer == EnumWorldBlockLayer.TRANSLUCENT; + final int start = isTranslucent ? this.renderInfos.size() - 1 : 0; + final int end = isTranslucent ? -1 : this.renderInfos.size(); + final int step = isTranslucent ? -1 : 1; + + for (int index = start; index != end; index += step) { + final RenderChunk renderchunk = this.renderInfos.get(index).renderChunk; + + if (!renderchunk.getCompiledChunk().isLayerEmpty(layer)) { + count++; + this.renderContainer.addRenderChunk(renderchunk, layer); + } + } + + this.profiler.endStartSection("render_" + layer); + renderBlockLayer(layer); + this.profiler.endSection(); + + return count; + } + + private void renderBlockLayer(final EnumWorldBlockLayer layer) { + this.mc.entityRenderer.enableLightmap(); + + if (OpenGlHelper.useVbo()) { + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + } + + this.renderContainer.renderChunkLayer(layer); + + if (OpenGlHelper.useVbo()) { + final List elements = DefaultVertexFormats.BLOCK.getElements(); + + for (final VertexFormatElement element : elements) { + final VertexFormatElement.EnumUsage usage = element.getUsage(); + final int index = element.getIndex(); + + switch (usage) { + case POSITION: + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + break; + + case UV: + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + index); + GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + break; + + case COLOR: + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GlStateManager.resetColor(); + break; + } + } + } + + this.mc.entityRenderer.disableLightmap(); + } + + @Override + public void updateClouds() { + } + + @Override + public void renderSky(final float partialTicks, final int pass) { + } + + @Override + public void renderClouds(final float partialTicks, final int pass) { + } + + @Override + public boolean hasCloudFog(final double x, final double y, final double z, final float partialTicks) { + return false; + } + + @Override + public void updateChunks(final long finishTimeNano) { + this.displayListEntitiesDirty |= this.renderDispatcher.runChunkUploads(finishTimeNano); + + final Iterator iterator = this.chunksToUpdate.iterator(); + while (iterator.hasNext()) { + final RenderChunk renderChunk = iterator.next(); + if (!this.renderDispatcher.updateChunkLater(renderChunk)) { + break; + } + + renderChunk.setNeedsUpdate(false); + iterator.remove(); + } + } + + @Override + public void renderWorldBorder(final Entity entity, final float partialTicks) {} + + @Override + public void drawBlockDamageTexture(final Tessellator tessellator, final WorldRenderer worldRenderer, final Entity entity, final float partialTicks) {} + + @Override + public void drawSelectionBox(final EntityPlayer player, final MovingObjectPosition movingObjectPosition, final int p_72731_3_, final float partialTicks) {} + + @Override + public void markBlockForUpdate(final BlockPos pos) { + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); + markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + } + + @Override + public void notifyLightSet(final BlockPos pos) { + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); + markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + } + + @Override + public void markBlockRangeForRenderUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1); + } + + private void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + this.viewFrustum.markBlocksForUpdate(x1, y1, z1, x2, y2, z2); + } + + @Override + public void playRecord(final String name, final BlockPos pos) {} + + @Override + public void playSound(final String name, final double x, final double y, final double z, final float volume, final float pitch) {} + + @Override + public void playSoundToNearExcept(final EntityPlayer player, final String name, final double x, final double y, final double z, final float volume, final float pitch) {} + + @Override + public void spawnParticle(final int p_180442_1_, final boolean p_180442_2_, final double p_180442_3_, final double p_180442_5_, final double p_180442_7_, final double p_180442_9_, final double p_180442_11_, final double p_180442_13_, final int... p_180442_15_) {} + + @Override + public void onEntityAdded(final Entity entityIn) {} + + @Override + public void onEntityRemoved(final Entity entityIn) {} + + @Override + public void deleteAllDisplayLists() {} + + @Override + public void broadcastSound(final int p_180440_1_, final BlockPos pos, final int p_180440_3_) {} + + @Override + public void playAusSFX(final EntityPlayer player, final int p_180439_2_, final BlockPos pos, final int p_180439_4_) {} + + @Override + public void sendBlockBreakProgress(final int breakerId, final BlockPos pos, final int progress) {} + + @Override + public void setDisplayListEntitiesDirty() { + this.displayListEntitiesDirty = true; + } + + @SideOnly(Side.CLIENT) + class ContainerLocalRenderInformation { + final RenderChunk renderChunk; + final EnumFacing facing; + final Set setFacing; + final int counter; + + private ContainerLocalRenderInformation(final RenderChunk renderChunk, final EnumFacing facing, final int counter) { + this.setFacing = EnumSet.noneOf(EnumFacing.class); + this.renderChunk = renderChunk; + this.facing = facing; + this.counter = counter; + } + + ContainerLocalRenderInformation(final RenderChunk p_i46249_2_, final EnumFacing p_i46249_3_, final int p_i46249_4_, final Object p_i46249_5_) { + this(p_i46249_2_, p_i46249_3_, p_i46249_4_); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java index 7158859b..b4d12e00 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; @@ -9,10 +10,12 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -20,6 +23,8 @@ import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL20; @@ -27,6 +32,7 @@ import java.util.ArrayList; import java.util.List; +@Deprecated public class RendererSchematicChunk { private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); @@ -42,7 +48,7 @@ public class RendererSchematicChunk { private final List tileEntities = new ArrayList(); private final Vector3d distance = new Vector3d(); - private final AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); + private final AxisAlignedBB boundingBox; private boolean needsUpdate = true; private int glList = -1; @@ -51,7 +57,8 @@ public class RendererSchematicChunk { public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int baseY, int baseZ) { this.schematic = schematicWorld; - this.boundingBox.setBounds(baseX * Constants.SchematicChunk.WIDTH, baseY * Constants.SchematicChunk.HEIGHT, baseZ * Constants.SchematicChunk.LENGTH, (baseX + 1) * Constants.SchematicChunk.WIDTH, (baseY + 1) * Constants.SchematicChunk.HEIGHT, (baseZ + 1) * Constants.SchematicChunk.LENGTH); + // this.boundingBox.setBounds(baseX * Constants.SchematicChunk.WIDTH, baseY * Constants.SchematicChunk.HEIGHT, baseZ * Constants.SchematicChunk.LENGTH, (baseX + 1) * Constants.SchematicChunk.WIDTH, (baseY + 1) * Constants.SchematicChunk.HEIGHT, (baseZ + 1) * Constants.SchematicChunk.LENGTH); + this.boundingBox = new AxisAlignedBB(baseX * Constants.SchematicChunk.WIDTH, baseY * Constants.SchematicChunk.HEIGHT, baseZ * Constants.SchematicChunk.LENGTH, (baseX + 1) * Constants.SchematicChunk.WIDTH, (baseY + 1) * Constants.SchematicChunk.HEIGHT, (baseZ + 1) * Constants.SchematicChunk.LENGTH); this.centerPosition.x = (int) ((baseX + 0.5) * Constants.SchematicChunk.WIDTH); this.centerPosition.y = (int) ((baseY + 0.5) * Constants.SchematicChunk.HEIGHT); @@ -59,9 +66,10 @@ public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int base int x, y, z; for (TileEntity tileEntity : this.schematic.getTileEntities()) { - x = tileEntity.xCoord; - y = tileEntity.yCoord; - z = tileEntity.zCoord; + final BlockPos pos = tileEntity.getPos(); + x = pos.getX(); + y = pos.getY(); + z = pos.getZ(); if (x < this.boundingBox.minX || x >= this.boundingBox.maxX) { continue; @@ -222,10 +230,14 @@ public void render(int renderPass) { public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { IBlockAccess mcWorld = this.minecraft.theWorld; - RenderBlocks renderBlocks = RendererSchematicGlobal.INSTANCE.renderBlocks; + BlockRendererDispatcher renderBlocks = RendererSchematicGlobal.INSTANCE.renderBlocks; - int x, y, z, wx, wy, wz; + final MBlockPos pos = new MBlockPos(); + final MBlockPos mcPos = new MBlockPos(); + final MBlockPos tmp = new MBlockPos(); + int x, y, z; int sides; + IBlockState blockState, mcBlockState; Block block, mcBlock; Vector3f zero = new Vector3f(); Vector3f size = new Vector3f(); @@ -233,48 +245,50 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int ambientOcclusion = this.minecraft.gameSettings.ambientOcclusion; this.minecraft.gameSettings.ambientOcclusion = 0; - Tessellator.instance.startDrawingQuads(); + final Tessellator tessellator = Tessellator.getInstance(); + final WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + worldRenderer.startDrawingQuads(); for (y = minY; y < maxY; y++) { for (z = minZ; z < maxZ; z++) { for (x = minX; x < maxX; x++) { try { - block = this.schematic.getBlock(x, y, z); - - wx = this.schematic.position.x + x; - wy = this.schematic.position.y + y; - wz = this.schematic.position.z + z; + pos.set(x, y, z); + blockState = this.schematic.getBlockState(pos); + block = blockState.getBlock(); - mcBlock = mcWorld.getBlock(wx, wy, wz); + mcPos.set(this.schematic.position.x + x, this.schematic.position.y + y, this.schematic.position.z + z); + mcBlockState = mcWorld.getBlockState(mcPos); + mcBlock = mcBlockState.getBlock(); sides = 0; if (block != null) { - if (block.shouldSideBeRendered(this.schematic, x, y - 1, z, 0)) { + if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.DOWN), EnumFacing.DOWN)) { sides |= RenderHelper.QUAD_DOWN; } - if (block.shouldSideBeRendered(this.schematic, x, y + 1, z, 1)) { + if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.UP), EnumFacing.UP)) { sides |= RenderHelper.QUAD_UP; } - if (block.shouldSideBeRendered(this.schematic, x, y, z - 1, 2)) { + if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.NORTH), EnumFacing.NORTH)) { sides |= RenderHelper.QUAD_NORTH; } - if (block.shouldSideBeRendered(this.schematic, x, y, z + 1, 3)) { + if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { sides |= RenderHelper.QUAD_SOUTH; } - if (block.shouldSideBeRendered(this.schematic, x - 1, y, z, 4)) { + if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.WEST), EnumFacing.WEST)) { sides |= RenderHelper.QUAD_WEST; } - if (block.shouldSideBeRendered(this.schematic, x + 1, y, z, 5)) { + if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.EAST), EnumFacing.EAST)) { sides |= RenderHelper.QUAD_EAST; } } - boolean isAirBlock = mcWorld.isAirBlock(wx, wy, wz) || ConfigurationHandler.isExtraAirBlock(mcBlock); + boolean isAirBlock = mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock); if (!isAirBlock) { if (ConfigurationHandler.highlight && renderPass == 2) { @@ -296,7 +310,7 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, if (ConfigurationHandler.drawLines) { RenderHelper.drawCuboidOutline(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); } - } else if (this.schematic.getBlockMetadata(x, y, z) != mcWorld.getBlockMetadata(wx, wy, wz)) { + } else if (block.getMetaFromState(blockState) != mcBlock.getMetaFromState(mcBlockState)) { zero.set(x, y, z); size.set(x + 1, y + 1, z + 1); if (ConfigurationHandler.drawQuads) { @@ -319,8 +333,8 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, } } - if (block != null && block.canRenderInPass(renderPass)) { - renderBlocks.renderBlockByRenderType(block, x, y, z); + if (block != null) { + // renderBlocks.renderBlockByRenderType(block, x, y, z); } } } catch (Exception e) { @@ -330,7 +344,7 @@ public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, } } - Tessellator.instance.draw(); + tessellator.draw(); this.minecraft.gameSettings.ambientOcclusion = ambientOcclusion; } @@ -342,6 +356,7 @@ public void renderTileEntities(int renderPass) { IBlockAccess mcWorld = this.minecraft.theWorld; + final MBlockPos pos = new MBlockPos(); int x, y, z; Block mcBlock; @@ -349,21 +364,25 @@ public void renderTileEntities(int renderPass) { try { for (TileEntity tileEntity : this.tileEntities) { - x = tileEntity.xCoord; - y = tileEntity.yCoord; - z = tileEntity.zCoord; + pos.set(tileEntity.getPos()); + final BlockPos pos1 = tileEntity.getPos(); + x = pos1.getX(); + y = pos1.getY(); + z = pos1.getZ(); if (this.schematic.isRenderingLayer && this.schematic.renderingLayer != y) { continue; } - mcBlock = mcWorld.getBlock(x + this.schematic.position.x, y + this.schematic.position.y, z + this.schematic.position.z); + final BlockPos mcPos = pos.add(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z); + final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); + mcBlock = mcBlockState.getBlock(); - if (mcBlock == Blocks.air) { + if (mcBlock.isAir(mcWorld, mcPos)) { TileEntitySpecialRenderer tileEntitySpecialRenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntity); if (tileEntitySpecialRenderer != null) { try { - tileEntitySpecialRenderer.renderTileEntityAt(tileEntity, x, y, z, 0); + tileEntitySpecialRenderer.renderTileEntityAt(tileEntity, x, y, z, 0, -1); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java index 2bd90687..e04cdd48 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java @@ -6,6 +6,7 @@ import java.util.Comparator; +@Deprecated public class RendererSchematicChunkComparator implements Comparator { private final Vector3d position = new Vector3d(); private final Vector3d schematicPosition = new Vector3d(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java index bbb8d2d7..6e5ee72b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java @@ -5,27 +5,28 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.culling.Frustrum; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.profiler.Profiler; import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.opengl.GL11; import java.util.ArrayList; import java.util.Collections; import java.util.List; +@Deprecated public class RendererSchematicGlobal { public static final RendererSchematicGlobal INSTANCE = new RendererSchematicGlobal(); private final Minecraft minecraft = Minecraft.getMinecraft(); private final Profiler profiler = this.minecraft.mcProfiler; - private final Frustrum frustrum = new Frustrum(); - public RenderBlocks renderBlocks = null; + private final Frustum frustum = new Frustum(); + public BlockRendererDispatcher renderBlocks = null; public final List sortedRendererSchematicChunk = new ArrayList(); private final RendererSchematicChunkComparator rendererSchematicChunkComparator = new RendererSchematicChunkComparator(); @@ -39,6 +40,7 @@ public void onRender(RenderWorldLastEvent event) { this.profiler.startSection("schematica"); SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if ((schematic != null && schematic.isRendering) || ClientProxy.isRenderingGuide) { render(schematic); } @@ -150,9 +152,9 @@ public void render(SchematicWorld schematic) { } private void updateFrustrum(SchematicWorld schematic) { - this.frustrum.setPosition(ClientProxy.playerPosition.x - schematic.position.x, ClientProxy.playerPosition.y - schematic.position.y, ClientProxy.playerPosition.z - schematic.position.z); + this.frustum.setPosition(ClientProxy.playerPosition.x - schematic.position.x, ClientProxy.playerPosition.y - schematic.position.y, ClientProxy.playerPosition.z - schematic.position.z); for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { - rendererSchematicChunk.isInFrustrum = this.frustrum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); + rendererSchematicChunk.isInFrustrum = this.frustum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); } } @@ -175,7 +177,7 @@ public void createRendererSchematicChunks(SchematicWorld schematic) { destroyRendererSchematicChunks(); - this.renderBlocks = new RenderBlocks(schematic); + this.renderBlocks = this.minecraft.getBlockRendererDispatcher(); for (int y = 0; y < height; y++) { for (int z = 0; z < length; z++) { for (int x = 0; x < width; x++) { @@ -196,5 +198,7 @@ public void refresh() { for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { renderer.setDirty(); } + + RenderSchematic.INSTANCE.loadRenderers(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 285aea9f..e512bd52 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -14,6 +14,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentTranslation; import org.apache.commons.io.FilenameUtils; @@ -30,14 +31,14 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getUsage(ICommandSender sender) { return Names.Command.Download.Message.USAGE; } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) { + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { if (!(sender instanceof EntityPlayer)) { - throw new CommandException(Names.Command.Download.Message.PLAYERS_ONLY); + return null; } final File directory = Schematica.proxy.getPlayerSchematicDirectory((EntityPlayer) sender, true); @@ -50,16 +51,16 @@ public List addTabCompletionOptions(ICommandSender sender, String[] args) { filenames.add(FilenameUtils.removeExtension(file.getName())); } - return getListOfStringsFromIterableMatchingLastWord(args, filenames); + return getListOfStringsMatchingLastWord(args, filenames); } return null; } @Override - public void processCommand(ICommandSender sender, String[] args) { + public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length < 1) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } if (!(sender instanceof EntityPlayerMP)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 1c765aec..f2404ecc 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -28,12 +28,12 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getUsage(ICommandSender sender) { return Names.Command.List.Message.USAGE; } @Override - public void processCommand(ICommandSender sender, String[] arguments) { + public void processCommand(ICommandSender sender, String[] arguments) throws CommandException { if (!(sender instanceof EntityPlayer)) { throw new CommandException(Names.Command.Save.Message.PLAYERS_ONLY); } @@ -47,7 +47,7 @@ public void processCommand(ICommandSender sender, String[] arguments) { } } } catch (NumberFormatException e) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } final EntityPlayer player = (EntityPlayer) sender; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index abadaa41..9e89ec29 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -28,14 +28,14 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getUsage(ICommandSender sender) { return Names.Command.Remove.Message.USAGE; } @Override - public void processCommand(ICommandSender sender, String[] arguments) { + public void processCommand(ICommandSender sender, String[] arguments) throws CommandException{ if (arguments.length < 1) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } if (!(sender instanceof EntityPlayer)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index fabe5ddf..9694c933 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -2,10 +2,12 @@ import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.command.NumberInvalidException; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentTranslation; @@ -19,14 +21,14 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender p_71518_1_) { + public String getUsage(ICommandSender sender) { return Names.Command.Save.Message.USAGE; } @Override - public void processCommand(ICommandSender sender, String[] arguments) { + public void processCommand(ICommandSender sender, String[] arguments) throws CommandException { if (arguments.length < 7) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } if (!(sender instanceof EntityPlayer)) { @@ -45,13 +47,13 @@ public void processCommand(ICommandSender sender, String[] arguments) { String name; try { - from.set(Integer.parseInt(arguments[0]), Integer.parseInt(arguments[1]), Integer.parseInt(arguments[2])); - to.set(Integer.parseInt(arguments[3]), Integer.parseInt(arguments[4]), Integer.parseInt(arguments[5])); + from.set(parseCoord(arguments[0]), parseCoord(arguments[1]), parseCoord(arguments[2])); + to.set(parseCoord(arguments[3]), parseCoord(arguments[4]), parseCoord(arguments[5])); name = arguments[6]; filename = String.format("%s.schematic", name); } catch (NumberFormatException exception) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } Reference.logger.info(String.format("Saving schematic from %s to %s to %s", from, to, filename)); @@ -76,4 +78,8 @@ public void processCommand(ICommandSender sender, String[] arguments) { throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); } } + + private int parseCoord(String argument) throws NumberInvalidException { + return parseInt(argument, Constants.World.MINIMUM_COORD, Constants.World.MAXIMUM_COORD); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java index 8b1d3ce3..564f5fad 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java @@ -1,8 +1,6 @@ package com.github.lunatrius.schematica.config; import com.github.lunatrius.schematica.reference.Names; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; import net.minecraft.block.BlockButton; import net.minecraft.block.BlockChest; @@ -18,6 +16,8 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; import java.util.HashMap; @@ -92,7 +92,7 @@ public static void populateIgnoredBlockMetadata() { addIgnoredBlockMetadata(Blocks.furnace); addIgnoredBlockMetadata(Blocks.lit_furnace); addIgnoredBlockMetadata(Blocks.standing_sign); - addIgnoredBlockMetadata(Blocks.wooden_door); + // TODO: addIgnoredBlockMetadata(Blocks.wooden_door); addIgnoredBlockMetadata(Blocks.ladder); addIgnoredBlockMetadata(Blocks.rail); addIgnoredBlockMetadata(Blocks.stone_stairs); @@ -114,7 +114,7 @@ public static void populateIgnoredBlockMetadata() { addIgnoredBlockMetadata(Blocks.powered_repeater); addIgnoredBlockMetadata(Blocks.trapdoor); addIgnoredBlockMetadata(Blocks.vine); - addIgnoredBlockMetadata(Blocks.fence_gate); + // TODO: addIgnoredBlockMetadata(Blocks.fence_gate); addIgnoredBlockMetadata(Blocks.brick_stairs); addIgnoredBlockMetadata(Blocks.stone_brick_stairs); addIgnoredBlockMetadata(Blocks.waterlily); @@ -173,7 +173,7 @@ public static void populateBlockItemMap() { addBlockItemMapping(Blocks.wheat, Items.wheat_seeds); addBlockItemMapping(Blocks.lit_furnace, Blocks.furnace); addBlockItemMapping(Blocks.standing_sign, Items.sign); - addBlockItemMapping(Blocks.wooden_door, Items.wooden_door); + // TODO: addBlockItemMapping(Blocks.wooden_door, Items.wooden_door); addBlockItemMapping(Blocks.iron_door, Items.iron_door); addBlockItemMapping(Blocks.wall_sign, Items.sign); addBlockItemMapping(Blocks.unlit_redstone_torch, Blocks.redstone_torch); @@ -281,14 +281,14 @@ public static void populatePlacementMaps() { addPlacementMapping(Blocks.stonebrick, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.tripwire_hook, new PlacementData(PlacementType.BLOCK, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); addPlacementMapping(Blocks.quartz_block, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.fence_gate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3)); + // TODO: addPlacementMapping(Blocks.fence_gate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3)); addPlacementMapping(Blocks.double_wooden_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.wooden_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); addPlacementMapping(Blocks.anvil, new PlacementData(PlacementType.PLAYER, -1, -1, 1, 3, 0, 2).setMaskMeta(0x3).setMaskMetaInHand(0xC).setBitShiftMetaInHand(2)); addPlacementMapping(Blocks.stained_hardened_clay, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.carpet, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); addPlacementMapping(Blocks.stained_glass_pane, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Items.wooden_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); + // TODO: addPlacementMapping(Items.wooden_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); addPlacementMapping(Items.iron_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); addPlacementMapping(Items.repeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); addPlacementMapping(Items.comparator, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); diff --git a/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java index bec81f82..c0e1ef0a 100644 --- a/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java +++ b/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.config; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraft.util.EnumFacing; import java.util.ArrayList; import java.util.HashMap; @@ -12,7 +12,7 @@ public static enum PlacementType { BLOCK, PLAYER, PISTON } - public static final ForgeDirection[] VALID_DIRECTIONS = ForgeDirection.VALID_DIRECTIONS; + public static final EnumFacing[] VALID_DIRECTIONS = EnumFacing.values(); public final PlacementType type; public int maskOffset = 0x0; @@ -21,7 +21,7 @@ public static enum PlacementType { public int maskMetaInHand = -1; public int bitShiftMetaInHand = 0; public int maskMeta = 0xF; - public final Map mapping = new HashMap(); + public final Map mapping = new HashMap(); public PlacementData(PlacementType type, int... metadata) { this.type = type; @@ -73,17 +73,17 @@ public int getMetaInHand(int metadata) { return metadata; } - public ForgeDirection[] getValidDirections(ForgeDirection[] solidSides, int metadata) { - List list = new ArrayList(); + public EnumFacing[] getValidDirections(EnumFacing[] solidSides, int metadata) { + List list = new ArrayList(); - for (ForgeDirection direction : solidSides) { + for (EnumFacing direction : solidSides) { if (this.maskOffset != 0) { if ((metadata & this.maskOffset) == 0) { - if (this.offsetLowY < 0.5f && direction == ForgeDirection.UP) { + if (this.offsetLowY < 0.5f && direction == EnumFacing.UP) { continue; } } else { - if (this.offsetLowY < 0.5f && direction == ForgeDirection.DOWN) { + if (this.offsetLowY < 0.5f && direction == EnumFacing.DOWN) { continue; } } @@ -99,7 +99,7 @@ public ForgeDirection[] getValidDirections(ForgeDirection[] solidSides, int meta list.add(direction); } - ForgeDirection[] directions = new ForgeDirection[list.size()]; + EnumFacing[] directions = new EnumFacing[list.size()]; return list.toArray(directions); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index a23f52cb..b68bf9a6 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -4,13 +4,13 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.google.common.primitives.Ints; -import cpw.mods.fml.client.event.ConfigChangedEvent; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; +import net.minecraftforge.fml.client.event.ConfigChangedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.GameData; import java.io.File; import java.io.IOException; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java index cc83f763..40f7381f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -8,9 +8,9 @@ import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.LinkedHashMap; import java.util.Map; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java index 555352d5..997d2797 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java @@ -3,9 +3,9 @@ import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.network.message.MessageCapabilities; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.PlayerEvent; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.PlayerEvent; public class PlayerHandler { public static final PlayerHandler INSTANCE = new PlayerHandler(); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 8fb5a762..12f56e8f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -4,11 +4,11 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.SchematicContainer; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.util.ChatComponentTranslation; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.ArrayDeque; import java.util.Queue; @@ -28,7 +28,7 @@ public void onClientTick(TickEvent.ClientTickEvent event) { // TODO: find a better way... maybe? try { - final EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; + final EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (player != null && player.sendQueue != null && !player.sendQueue.getNetworkManager().isLocalChannel()) { processQueue(); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 61ad831b..25915f43 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -4,8 +4,8 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ChatEventHandler { public static final ChatEventHandler INSTANCE = new ChatEventHandler(); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 73e9acc1..e723db2a 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -9,17 +9,14 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.InputEvent; -import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityClientPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.InputEvent; import org.lwjgl.input.Keyboard; public class InputHandler { @@ -99,7 +96,7 @@ private boolean pickBlock(final SchematicWorld schematic, final MovingObjectPosi // Minecraft.func_147112_ai if (objectMouseOver != null) { - final EntityClientPlayerMP player = this.minecraft.thePlayer; + final EntityPlayerSP player = this.minecraft.thePlayer; if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { revert = true; @@ -110,12 +107,6 @@ private boolean pickBlock(final SchematicWorld schematic, final MovingObjectPosi } if (player.capabilities.isCreativeMode) { - final Block block = schematic.getBlock(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); - final int metadata = schematic.getBlockMetadata(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); - if (block == Blocks.double_stone_slab || block == Blocks.double_wooden_slab || block == Blocks.snow_layer) { - player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(block, 1, metadata & 0xF)); - } - final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java new file mode 100644 index 00000000..d5142adc --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -0,0 +1,27 @@ +package com.github.lunatrius.schematica.handler.client; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.client.Minecraft; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class OverlayHandler { + private final Minecraft minecraft = Minecraft.getMinecraft(); + + @SubscribeEvent + public void onText(RenderGameOverlayEvent.Text event) { + if (this.minecraft.gameSettings.showDebugInfo) { + event.left.add(""); + + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + if (schematic != null) { + event.left.add("[§6Schematica§r] D: " + schematic.getWidth() + "," + schematic.getHeight() + "," + schematic.getLength()); + event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); + event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); + event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); + } + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 392e9d82..5a28d3ab 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -5,12 +5,12 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.tooltip.TooltipHandler; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; import net.minecraft.client.Minecraft; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; public class RenderTickHandler { public static final RenderTickHandler INSTANCE = new RenderTickHandler(); @@ -31,7 +31,7 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { } private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { - final EntityLivingBase renderViewEntity = this.minecraft.renderViewEntity; + final Entity renderViewEntity = this.minecraft.getRenderViewEntity(); if (renderViewEntity == null) { return null; } @@ -46,7 +46,7 @@ private MovingObjectPosition rayTrace(final SchematicWorld schematic, final floa renderViewEntity.posY -= schematic.position.y; renderViewEntity.posZ -= schematic.position.z; - final Vec3 vecPosition = renderViewEntity.getPosition(partialTicks); + final Vec3 vecPosition = renderViewEntity.getPositionEyes(partialTicks); final Vec3 vecLook = renderViewEntity.getLook(partialTicks); final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); @@ -54,6 +54,6 @@ private MovingObjectPosition rayTrace(final SchematicWorld schematic, final floa renderViewEntity.posY = posY; renderViewEntity.posZ = posZ; - return schematic.func_147447_a(vecPosition, vecExtendedLook, false, false, true); + return schematic.rayTraceBlocks(vecPosition, vecExtendedLook, false, false, true); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 290dc1cb..4ec46af6 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -3,17 +3,14 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; -import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.TickEvent; -import cpw.mods.fml.common.network.FMLNetworkEvent; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.common.network.FMLNetworkEvent; public class TickHandler { public static final TickHandler INSTANCE = new TickHandler(); @@ -69,6 +66,8 @@ public void onClientTick(TickEvent.ClientTickEvent event) { } private void checkDirty(SchematicWorld schematic) { + // TODO + /* WorldRenderer[] renderers = this.minecraft.renderGlobal.sortedWorldRenderers; if (renderers != null) { int count = 0; @@ -83,5 +82,6 @@ private void checkDirty(SchematicWorld schematic) { } } } + */ } } diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index 5c8f8789..e77a8475 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -6,6 +6,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; @@ -99,9 +100,8 @@ public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, in tileEntity.writeToNBT(tileEntityCompound); tileEntity = TileEntity.createAndLoadEntity(tileEntityCompound); - tileEntity.xCoord -= offsetX; - tileEntity.yCoord -= offsetY; - tileEntity.zCoord -= offsetZ; + final BlockPos pos = tileEntity.getPos(); + tileEntity.setPos(pos.add(-offsetX, -offsetY, -offsetZ)); } catch (Exception e) { throw new TileEntityException(tileEntity, e); } diff --git a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java index e7ad299e..674aba8e 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java @@ -7,9 +7,9 @@ import com.github.lunatrius.schematica.network.message.MessageDownloadChunkAck; import com.github.lunatrius.schematica.network.message.MessageDownloadEnd; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import cpw.mods.fml.relauncher.Side; +import net.minecraftforge.fml.common.network.NetworkRegistry; +import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import net.minecraftforge.fml.relauncher.Side; public class PacketHandler { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID.toLowerCase()); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java index 7f328580..1e89987a 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java @@ -3,10 +3,10 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Reference; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessageCapabilities implements IMessage, IMessageHandler { public boolean isPrinterEnabled; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java index 792a70d7..c2a495b3 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java @@ -3,12 +3,12 @@ import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.world.storage.Schematic; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.network.ByteBufUtils; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessageDownloadBegin implements IMessage, IMessageHandler { public ItemStack icon; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java index 5f36e755..dab2dd60 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java @@ -2,11 +2,11 @@ import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessageDownloadBeginAck implements IMessage, IMessageHandler { @Override diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java index 1e30e497..3d9fb26c 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java @@ -1,20 +1,22 @@ package com.github.lunatrius.schematica.network.message; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.reference.Constants; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; -import cpw.mods.fml.common.registry.GameData; import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.fml.common.network.ByteBufUtils; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; import java.util.List; @@ -44,14 +46,17 @@ public MessageDownloadChunk(ISchematic schematic, int baseX, int baseY, int base this.tileEntities = new ArrayList(); this.entities = new ArrayList(); + final MBlockPos pos = new MBlockPos(); for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { - final Block block = schematic.getBlock(baseX + x, baseY + y, baseZ + z); + pos.set(baseX + x, baseY + y, baseZ + z); + final IBlockState blockState = schematic.getBlockState(pos); + final Block block = blockState.getBlock(); final int id = BLOCK_REGISTRY.getId(block); this.blocks[x][y][z] = (short) id; - this.metadata[x][y][z] = (byte) schematic.getBlockMetadata(baseX + x, baseY + y, baseZ + z); - final TileEntity tileEntity = schematic.getTileEntity(baseX + x, baseY + y, baseZ + z); + this.metadata[x][y][z] = (byte) block.getMetaFromState(blockState); + final TileEntity tileEntity = schematic.getTileEntity(pos); if (tileEntity != null) { this.tileEntities.add(tileEntity); } @@ -61,6 +66,7 @@ public MessageDownloadChunk(ISchematic schematic, int baseX, int baseY, int base } private void copyToSchematic(final ISchematic schematic) { + final MBlockPos pos = new MBlockPos(); for (int x = 0; x < Constants.SchematicChunk.WIDTH; x++) { for (int y = 0; y < Constants.SchematicChunk.HEIGHT; y++) { for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { @@ -68,13 +74,15 @@ private void copyToSchematic(final ISchematic schematic) { byte meta = this.metadata[x][y][z]; Block block = BLOCK_REGISTRY.getObjectById(id); - schematic.setBlock(this.baseX + x, this.baseY + y, this.baseZ + z, block, meta); + pos.set(this.baseX + x, this.baseY + y, this.baseZ + z); + + schematic.setBlockState(pos, block.getStateFromMeta(meta)); } } } for (TileEntity tileEntity : this.tileEntities) { - schematic.setTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity); + schematic.setTileEntity(tileEntity.getPos(), tileEntity); } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java index 3d0a01cf..59468e8c 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java @@ -2,11 +2,11 @@ import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; public class MessageDownloadChunkAck implements IMessage, IMessageHandler { private int baseX; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index 72eedf8d..aea767c2 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -4,13 +4,13 @@ import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; -import cpw.mods.fml.common.network.ByteBufUtils; -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentTranslation; +import net.minecraftforge.fml.common.network.ByteBufUtils; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import java.io.File; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 27cbc055..288c749a 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -5,28 +5,30 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.InputHandler; +import com.github.lunatrius.schematica.handler.client.OverlayHandler; import com.github.lunatrius.schematica.handler.client.RenderTickHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; -import cpw.mods.fml.client.config.GuiConfigEntries; -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Property; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fml.client.config.GuiConfigEntries; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import java.io.File; import java.io.IOException; @@ -36,7 +38,7 @@ public class ClientProxy extends CommonProxy { public static boolean isPendingReset = false; public static final Vector3d playerPosition = new Vector3d(); - public static ForgeDirection orientation = ForgeDirection.UNKNOWN; + public static EnumFacing orientation = null; public static int rotationRender = 0; public static final Vector3i pointA = new Vector3i(); @@ -58,25 +60,25 @@ public static void setPlayerData(EntityPlayer player, float partialTicks) { rotationRender = MathHelper.floor_double(player.rotationYaw / 90) & 3; } - private static ForgeDirection getOrientation(EntityPlayer player) { + private static EnumFacing getOrientation(EntityPlayer player) { if (player.rotationPitch > 45) { - return ForgeDirection.DOWN; + return EnumFacing.DOWN; } else if (player.rotationPitch < -45) { - return ForgeDirection.UP; + return EnumFacing.UP; } else { switch (MathHelper.floor_double(player.rotationYaw / 90.0 + 0.5) & 3) { case 0: - return ForgeDirection.SOUTH; + return EnumFacing.SOUTH; case 1: - return ForgeDirection.WEST; + return EnumFacing.WEST; case 2: - return ForgeDirection.NORTH; + return EnumFacing.NORTH; case 3: - return ForgeDirection.EAST; + return EnumFacing.EAST; } } - return ForgeDirection.UNKNOWN; + return null; } public static void updatePoints() { @@ -91,7 +93,7 @@ public static void updatePoints() { public static void movePointToPlayer(Vector3i point) { point.x = (int) Math.floor(playerPosition.x); - point.y = (int) Math.floor(playerPosition.y - 1); + point.y = (int) Math.floor(playerPosition.y); point.z = (int) Math.floor(playerPosition.z); switch (rotationRender) { @@ -118,7 +120,7 @@ public static void moveSchematicToPlayer(SchematicWorld schematic) { if (schematic != null) { Vector3i position = schematic.position; position.x = (int) Math.floor(playerPosition.x); - position.y = (int) Math.floor(playerPosition.y) - 1; + position.y = (int) Math.floor(playerPosition.y); position.z = (int) Math.floor(playerPosition.z); switch (rotationRender) { @@ -172,8 +174,10 @@ public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(ConfigurationHandler.INSTANCE); - MinecraftForge.EVENT_BUS.register(RendererSchematicGlobal.INSTANCE); + // TODO: MinecraftForge.EVENT_BUS.register(RendererSchematicGlobal.INSTANCE); + MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(new OverlayHandler()); } @Override @@ -201,7 +205,7 @@ public void resetSettings() { setActiveSchematic(null); playerPosition.set(0, 0, 0); - orientation = ForgeDirection.UNKNOWN; + orientation = null; rotationRender = 0; pointA.set(0, 0, 0); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index e3432853..f8328af8 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.core.version.VersionChecker; import com.github.lunatrius.schematica.api.ISchematic; @@ -17,16 +18,17 @@ import com.github.lunatrius.schematica.world.chunk.SchematicContainer; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import com.github.lunatrius.schematica.world.storage.Schematic; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import java.io.File; @@ -73,6 +75,8 @@ public void resetSettings() { } public void copyChunkToSchematic(final ISchematic schematic, final World world, final int chunkX, final int chunkZ, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { + final MBlockPos pos = new MBlockPos(); + final MBlockPos localPos = new MBlockPos(); final int localMinX = minX < (chunkX << 4) ? 0 : (minX & 15); final int localMaxX = maxX > ((chunkX << 4) + 15) ? 15 : (maxX & 15); final int localMinZ = minZ < (chunkZ << 4) ? 0 : (minZ & 15); @@ -88,20 +92,23 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, final int localY = y - minY; final int localZ = z - minZ; + pos.set(x, y, z); + localPos.set(localX, localY, localZ); + try { - final Block block = world.getBlock(x, y, z); - final int metadata = world.getBlockMetadata(x, y, z); - final boolean success = schematic.setBlock(localX, localY, localZ, block, metadata); + final IBlockState blockState = world.getBlockState(pos); + final Block block = blockState.getBlock(); + final boolean success = schematic.setBlockState(localPos, blockState); - if (success && block.hasTileEntity(metadata)) { - final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (success && block.hasTileEntity(blockState)) { + final TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity != null) { try { final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); - schematic.setTileEntity(localX, localY, localZ, reloadedTileEntity); + schematic.setTileEntity(localPos, reloadedTileEntity); } catch (TileEntityException tee) { Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), tee); - schematic.setBlock(localX, localY, localZ, Blocks.bedrock); + schematic.setBlockState(localPos, Blocks.bedrock.getDefaultState()); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index ef4b93b3..f410b44f 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -5,11 +5,11 @@ import com.github.lunatrius.schematica.handler.PlayerHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import java.io.File; import java.io.IOException; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index d994c6a4..80054b7f 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -149,7 +149,6 @@ public static final class NBT { public static final String WIDTH = "Width"; public static final String LENGTH = "Length"; public static final String HEIGHT = "Height"; - public static final String MAPPING = "..."; // TODO: use this once MCEdit adds support for it public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; public static final String TILE_ENTITIES = "TileEntities"; public static final String ENTITIES = "Entities"; diff --git a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java b/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java index 1617119b..a1888b7f 100644 --- a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java @@ -3,9 +3,8 @@ import com.github.lunatrius.core.client.gui.FontRendererHelper; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiChat; @@ -13,8 +12,12 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -42,14 +45,14 @@ public boolean renderTooltip(final SchematicWorld schematic, final MovingObjectP return false; } - final List lines = getText(schematic, objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ); + final List lines = getText(schematic, objectMouseOver.getBlockPos()); if (!lines.isEmpty()) { final ScaledResolution scaledResolution = new ScaledResolution(this.minecraft, this.minecraft.displayWidth, this.minecraft.displayHeight); this.width = scaledResolution.getScaledWidth(); this.height = scaledResolution.getScaledHeight(); - drawHoveringText(lines, ConfigurationHandler.tooltipX, ConfigurationHandler.tooltipY, this.minecraft.fontRenderer); + drawHoveringText(lines, ConfigurationHandler.tooltipX, ConfigurationHandler.tooltipY, this.minecraft.fontRendererObj); } GL11.glDisable(GL11.GL_LIGHTING); @@ -58,11 +61,12 @@ public boolean renderTooltip(final SchematicWorld schematic, final MovingObjectP return false; } - private List getText(final SchematicWorld schematic, final int x, final int y, final int z) { + private List getText(final SchematicWorld schematic, final BlockPos pos) { final List list = new ArrayList(); - final Block block = schematic.getBlock(x, y, z); - final int blockMetadata = schematic.getBlockMetadata(x, y, z); + final IBlockState blockState = schematic.getBlockState(pos); + final Block block = blockState.getBlock(); + final int blockMetadata = block.getMetaFromState(blockState); list.add(block.getLocalizedName()); list.add("\u00a77" + BLOCK_REGISTRY.getNameForObject(block) + "\u00a7r : " + blockMetadata); @@ -70,7 +74,6 @@ private List getText(final SchematicWorld schematic, final int x, final return list; } - private void drawHoveringText(final List lines, final float x, final float y, final FontRenderer fontRenderer) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); @@ -133,14 +136,15 @@ private void drawGradientRect(final int x0, final int y0, final int x1, final in GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.setColorRGBA_F(redA, greenA, blueA, alphaA); - tessellator.addVertex(x1, y0, 300); - tessellator.addVertex(x0, y0, 300); - tessellator.setColorRGBA_F(redB, greenB, blueB, alphaB); - tessellator.addVertex(x0, y1, 300); - tessellator.addVertex(x1, y1, 300); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + worldRenderer.startDrawingQuads(); + worldRenderer.setColorRGBA_F(redA, greenA, blueA, alphaA); + worldRenderer.addVertex(x1, y0, 300); + worldRenderer.addVertex(x0, y0, 300); + worldRenderer.setColorRGBA_F(redB, greenB, blueB, alphaB); + worldRenderer.addVertex(x0, y1, 300); + worldRenderer.addVertex(x1, y1, 300); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 07fd4728..d55c9094 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -1,20 +1,20 @@ package com.github.lunatrius.schematica.world; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3f; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; -import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; -import com.github.lunatrius.schematica.world.storage.Schematic; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockSlab; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -23,20 +23,23 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.World; import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; -import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -public class SchematicWorld extends World { +public class SchematicWorld extends WorldClient { private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); private static final Comparator BLOCK_COMPARATOR = new Comparator() { @Override @@ -55,7 +58,7 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { public int renderingLayer; public SchematicWorld(ISchematic schematic) { - super(new SaveHandlerSchematic(), "Schematica", WORLD_SETTINGS, null, null); + super(null, WORLD_SETTINGS, 0, EnumDifficulty.PEACEFUL, Minecraft.getMinecraft().mcProfiler); this.schematic = schematic; for (TileEntity tileEntity : schematic.getTileEntities()) { @@ -68,68 +71,76 @@ public SchematicWorld(ISchematic schematic) { } @Override - public Block getBlock(int x, int y, int z) { - if (this.isRenderingLayer && this.renderingLayer != y) { - return Blocks.air; + public IBlockState getBlockState(BlockPos pos) { + if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { + return Blocks.air.getDefaultState(); } - return this.schematic.getBlock(x, y, z); + return this.schematic.getBlockState(pos); } @Override - public boolean setBlock(int x, int y, int z, Block block, int metadata, int flags) { - return this.schematic.setBlock(x, y, z, block, metadata); + public boolean setBlockState(BlockPos pos, IBlockState state, int flags) { + return this.schematic.setBlockState(pos, state); } @Override - public TileEntity getTileEntity(int x, int y, int z) { - return this.schematic.getTileEntity(x, y, z); + public TileEntity getTileEntity(BlockPos pos) { + if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { + return null; + } + + return this.schematic.getTileEntity(pos); } @Override - public void setTileEntity(int x, int y, int z, TileEntity tileEntity) { - this.schematic.setTileEntity(x, y, z, tileEntity); + public void setTileEntity(BlockPos pos, TileEntity tileEntity) { + this.schematic.setTileEntity(pos, tileEntity); initializeTileEntity(tileEntity); } @Override - public void removeTileEntity(int x, int y, int z) { - this.schematic.removeTileEntity(x, y, z); + public void removeTileEntity(BlockPos pos) { + this.schematic.removeTileEntity(pos); } @SideOnly(Side.CLIENT) @Override - public int getSkyBlockTypeBrightness(EnumSkyBlock skyBlock, int x, int y, int z) { + public int getLightFromNeighborsFor(EnumSkyBlock type, BlockPos pos) { return 15; } @Override - public float getLightBrightness(int x, int y, int z) { + public float getLightBrightness(BlockPos pos) { return 1.0f; } @Override - public int getBlockMetadata(int x, int y, int z) { - return this.schematic.getBlockMetadata(x, y, z); + public boolean isBlockNormalCube(BlockPos pos, boolean _default) { + return getBlockState(pos).getBlock().isNormalCube(this, pos); } @Override - public boolean isBlockNormalCubeDefault(int x, int y, int z, boolean _default) { - return getBlock(x, y, z).isNormalCube(); - } + public void calculateInitialSkylight() {} + + @Override + protected void calculateInitialWeather() {} + + @Override + public void setSpawnPoint(BlockPos pos) {} @Override - protected int func_152379_p() { + protected int getRenderDistanceChunks() { return 0; } @Override - public boolean isAirBlock(int x, int y, int z) { - return getBlock(x, y, z).isAir(this, x, y, z); + public boolean isAirBlock(BlockPos pos) { + return getBlockState(pos).getBlock().isAir(this, pos); } @Override - public BiomeGenBase getBiomeGenForCoords(int x, int z) { + public BiomeGenBase getBiomeGenForCoords(BlockPos pos) { return BiomeGenBase.jungle; } @@ -163,23 +174,13 @@ public Entity getEntityByID(int id) { } @Override - public boolean blockExists(int x, int y, int z) { - return false; + public boolean isSideSolid(BlockPos pos, EnumFacing side) { + return isSideSolid(pos, side, false); } @Override - public boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag) { - return this.schematic.setBlockMetadata(x, y, z, metadata); - } - - @Override - public boolean isSideSolid(int x, int y, int z, ForgeDirection side) { - return isSideSolid(x, y, z, side, false); - } - - @Override - public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { - return getBlock(x, y, z).isSideSolid(this, x, y, z, side); + public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { + return getBlockState(pos).getBlock().isSideSolid(this, pos, side); } public void initializeTileEntity(TileEntity tileEntity) { @@ -206,8 +207,10 @@ public List getTileEntities() { public List getBlockList() { final List blockList = new ArrayList(); + final MBlockPos pos = new MBlockPos(); - int x, y, z, itemDamage; + int itemDamage; + IBlockState blockState; Block block; Item item; ItemStack itemStack; @@ -216,18 +219,19 @@ public List getBlockList() { final int height = this.schematic.getHeight(); final int length = this.schematic.getLength(); - for (y = 0; y < height; y++) { - if (this.isRenderingLayer && y != this.renderingLayer) { + for (pos.y = 0; pos.y < height; pos.y++) { + if (this.isRenderingLayer && pos.y != this.renderingLayer) { continue; } - for (z = 0; z < length; z++) { - for (x = 0; x < width; x++) { - block = getBlock(x, y, z); + for (pos.z = 0; pos.z < length; pos.z++) { + for (pos.x = 0; pos.x < width; pos.x++) { + blockState = getBlockState(pos); + block = blockState.getBlock(); item = Item.getItemFromBlock(block); - itemDamage = getBlockMetadata(x, y, z); + itemDamage = block.getMetaFromState(blockState); - if (block == Blocks.air || isAirBlock(x, y, z)) { + if (block == Blocks.air || isAirBlock(pos)) { continue; } @@ -269,9 +273,9 @@ public List getBlockList() { } if (item == Items.skull) { - TileEntity tileEntity = getTileEntity(x, y, z); + TileEntity tileEntity = getTileEntity(pos); if (tileEntity instanceof TileEntitySkull) { - itemDamage = ((TileEntitySkull) tileEntity).func_145904_a(); + itemDamage = ((TileEntitySkull) tileEntity).getSkullType(); } } @@ -315,51 +319,54 @@ public void refreshChests() { } public void flip() { + // TODO /* - int tmp; - for (int x = 0; x < this.width; x++) { - for (int y = 0; y < this.height; y++) { - for (int z = 0; z < (this.length + 1) / 2; z++) { - tmp = this.blocks[x][y][z]; - this.blocks[x][y][z] = this.blocks[x][y][this.length - 1 - z]; - this.blocks[x][y][this.length - 1 - z] = tmp; - - if (z == this.length - 1 - z) { - this.metadata[x][y][z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][z], this.metadata[x][y][z]); - } else { - tmp = this.metadata[x][y][z]; - this.metadata[x][y][z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][z], this.metadata[x][y][this.length - 1 - z]); - this.metadata[x][y][this.length - 1 - z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][this.length - 1 - z], tmp); - } - } - } - } - - TileEntity tileEntity; - for (int i = 0; i < this.tileEntities.size(); i++) { - tileEntity = this.tileEntities.get(i); - tileEntity.zCoord = this.length - 1 - tileEntity.zCoord; - tileEntity.blockMetadata = this.metadata[tileEntity.xCoord][tileEntity.yCoord][tileEntity.zCoord]; - - if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { - TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; - int angle = skullTileEntity.func_82119_b(); - int base = 0; - if (angle <= 7) { - base = 4; - } else { - base = 12; - } - - skullTileEntity.setSkullRotation((2 * base - angle) & 15); - } - } - - refreshChests(); - */ + int tmp; + for (int x = 0; x < this.width; x++) { + for (int y = 0; y < this.height; y++) { + for (int z = 0; z < (this.length + 1) / 2; z++) { + tmp = this.blocks[x][y][z]; + this.blocks[x][y][z] = this.blocks[x][y][this.length - 1 - z]; + this.blocks[x][y][this.length - 1 - z] = tmp; + + if (z == this.length - 1 - z) { + this.metadata[x][y][z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][z], this.metadata[x][y][z]); + } else { + tmp = this.metadata[x][y][z]; + this.metadata[x][y][z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][z], this.metadata[x][y][this.length - 1 - z]); + this.metadata[x][y][this.length - 1 - z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][this.length - 1 - z], tmp); + } + } + } + } + + TileEntity tileEntity; + for (int i = 0; i < this.tileEntities.size(); i++) { + tileEntity = this.tileEntities.get(i); + tileEntity.zCoord = this.length - 1 - tileEntity.zCoord; + tileEntity.blockMetadata = this.metadata[tileEntity.xCoord][tileEntity.yCoord][tileEntity.zCoord]; + + if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { + TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; + int angle = skullTileEntity.func_82119_b(); + int base = 0; + if (angle <= 7) { + base = 4; + } else { + base = 12; + } + + skullTileEntity.setSkullRotation((2 * base - angle) & 15); + } + } + + refreshChests(); + */ } public void rotate() { + // TODO + /* final ItemStack icon = this.schematic.getIcon(); final int width = this.schematic.getWidth(); final int height = this.schematic.getHeight(); @@ -400,6 +407,7 @@ public void rotate() { this.schematic = schematicRotated; refreshChests(); + */ } public Vector3f dimensions() { diff --git a/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java new file mode 100644 index 00000000..d3f14536 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java @@ -0,0 +1,15 @@ +package com.github.lunatrius.schematica.world; + +import net.minecraft.world.WorldProvider; + +public class WorldProviderSchematic extends WorldProvider { + @Override + public String getDimensionName() { + return "Schematic"; + } + + @Override + public String getInternalNameSuffix() { + return "_schematic"; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java index 1eb6e8b2..1dab7186 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java @@ -1,39 +1,65 @@ package com.github.lunatrius.schematica.world.chunk; +import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; -import net.minecraft.world.ChunkPosition; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.IChunkProvider; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class ChunkProviderSchematic implements IChunkProvider { - private Chunk emptyChunk; + private final SchematicWorld world; + private final Chunk emptyChunk; + // private final ChunkSchematic chunks[][]; + private final Map chunks = new HashMap(); - public ChunkProviderSchematic(World world) { + public ChunkProviderSchematic(SchematicWorld world) { + this.world = world; this.emptyChunk = new EmptyChunk(world, 0, 0); + // this.chunks = new ChunkSchematic[this.width][this.length]; } @Override - public boolean chunkExists(int x, int y) { - return true; + public boolean chunkExists(int x, int z) { + return x >= 0 && z >= 0 && x < this.world.getWidth() && z < this.world.getLength(); } @Override - public Chunk provideChunk(int x, int y) { + public Chunk provideChunk(int x, int z) { + if (chunkExists(x, z)) { + final long key = ChunkCoordIntPair.chunkXZ2Int(x, z); + + ChunkSchematic chunk = this.chunks.get(key); + if (chunk == null) { + chunk = new ChunkSchematic(this.world, x, z); + this.chunks.put(key, chunk); + } + + return chunk; + } + return this.emptyChunk; } @Override - public Chunk loadChunk(int x, int y) { - return this.emptyChunk; + public Chunk provideChunk(BlockPos pos) { + return provideChunk(pos.getX() >> 4, pos.getZ() >> 4); } @Override - public void populate(IChunkProvider provider, int x, int y) {} + public void populate(IChunkProvider provider, int x, int z) {} + + @Override + public boolean func_177460_a(IChunkProvider chunkProvider, Chunk chunk, int x, int z) { + return false; + } @Override public boolean saveChunks(boolean saveExtra, IProgressUpdate progressUpdate) { @@ -56,22 +82,22 @@ public String makeString() { } @Override - public List getPossibleCreatures(EnumCreatureType creatureType, int x, int y, int z) { + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { return null; } @Override - public ChunkPosition func_147416_a(World world, String name, int x, int y, int z) { + public BlockPos getStrongholdGen(World world, String name, BlockPos pos) { return null; } @Override public int getLoadedChunkCount() { - return 0; + return this.world.getWidth() * this.world.getLength(); } @Override - public void recreateStructures(int x, int y) {} + public void recreateStructures(Chunk chunk, int x, int z) { } @Override public void saveExtraData() {} diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java new file mode 100644 index 00000000..53cfe4e2 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java @@ -0,0 +1,37 @@ +package com.github.lunatrius.schematica.world.chunk; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class ChunkSchematic extends Chunk { + private final World world; + private final int x; + private final int z; + + public ChunkSchematic(World world, int x, int z) { + super(world, x, z); + this.world = world; + this.x = x; + this.z = z; + } + + @Override + protected void generateHeightMap() { + } + + @Override + public void generateSkylightMap() { + } + + @Override + public IBlockState getBlockState(BlockPos pos) { + return this.world.getBlockState(pos); + } + + @Override + public boolean getAreLevelsEmpty(int startY, int endY) { + return false; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index e915be47..57569ce9 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -1,20 +1,23 @@ package com.github.lunatrius.schematica.world.schematic; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.api.event.PreSchematicSaveEvent; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.storage.Schematic; -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; import java.util.HashMap; import java.util.Map; @@ -54,12 +57,13 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { Map oldToNew = new HashMap(); if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); - Set names = mapping.func_150296_c(); + Set names = mapping.getKeySet(); for (String name : names) { oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(name)); } } + final MBlockPos pos = new MBlockPos(); ISchematic schematic = new Schematic(icon, width, height, length); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { @@ -72,7 +76,8 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { blockID = id; } - schematic.setBlock(x, y, z, BLOCK_REGISTRY.getObjectById(blockID), meta); + final Block block = BLOCK_REGISTRY.getObjectById(blockID); + schematic.setBlockState(pos.set(x, y, z), block.getStateFromMeta(meta)); } } } @@ -83,7 +88,7 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { try { TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); if (tileEntity != null) { - schematic.setTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity); + schematic.setTileEntity(tileEntity.getPos(), tileEntity); } } catch (Exception e) { Reference.logger.error("TileEntity failed to load properly!", e); @@ -111,20 +116,22 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { byte extraBlocksNibble[] = new byte[(int) Math.ceil(size / 2.0)]; boolean extra = false; + final MBlockPos pos = new MBlockPos(); Map mappings = new HashMap(); for (int x = 0; x < schematic.getWidth(); x++) { for (int y = 0; y < schematic.getHeight(); y++) { for (int z = 0; z < schematic.getLength(); z++) { final int index = x + (y * schematic.getLength() + z) * schematic.getWidth(); - final Block block = schematic.getBlock(x, y, z); + final IBlockState blockState = schematic.getBlockState(pos.set(x, y, z)); + final Block block = blockState.getBlock(); final int blockId = BLOCK_REGISTRY.getId(block); localBlocks[index] = (byte) blockId; - localMetadata[index] = (byte) schematic.getBlockMetadata(x, y, z); + localMetadata[index] = (byte) block.getMetaFromState(blockState); if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { extra = true; } - String name = BLOCK_REGISTRY.getNameForObject(block); + String name = String.valueOf(BLOCK_REGISTRY.getNameForObject(block)); if (!mappings.containsKey(name)) { mappings.put(name, (short) blockId); } @@ -140,14 +147,16 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { tileEntity.writeToNBT(tileEntityTagCompound); tileEntitiesList.appendTag(tileEntityTagCompound); } catch (Exception e) { - int pos = tileEntity.xCoord + (tileEntity.yCoord * schematic.getLength() + tileEntity.zCoord) * schematic.getWidth(); + final BlockPos tePos = tileEntity.getPos(); + final int index = tePos.getX() + (tePos.getY() * schematic.getLength() + tePos.getZ()) * schematic.getWidth(); if (--count > 0) { - Block block = schematic.getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); + final IBlockState blockState = schematic.getBlockState(tePos); + Block block = blockState.getBlock(); Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName()), e); } - localBlocks[pos] = (byte) BLOCK_REGISTRY.getId(Blocks.bedrock); - localMetadata[pos] = 0; - extraBlocks[pos] = 0; + localBlocks[index] = (byte) BLOCK_REGISTRY.getId(Blocks.bedrock); + localMetadata[index] = 0; + extraBlocks[index] = 0; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index f30c3069..ac572458 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -56,7 +56,7 @@ public static boolean writeToFile(File file, ISchematic schematic) { DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); try { - NBTTagCompound.func_150298_a(Names.NBT.ROOT, tagCompound, dataOutputStream); + NBTTagCompound.writeEntry(Names.NBT.ROOT, tagCompound, dataOutputStream); } finally { dataOutputStream.close(); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index 541569b0..b35e142c 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -3,10 +3,10 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fml.common.registry.GameData; import java.io.File; import java.io.FileInputStream; diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java index 9fe812b7..2dfc30ce 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java @@ -31,7 +31,7 @@ public void saveWorldInfoWithPlayer(WorldInfo info, NBTTagCompound compound) {} public void saveWorldInfo(WorldInfo info) {} @Override - public IPlayerFileData getSaveHandler() { + public IPlayerFileData getPlayerNBTManager() { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index 2c3cd892..057d9c5f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -1,12 +1,14 @@ package com.github.lunatrius.schematica.world.storage; import com.github.lunatrius.schematica.api.ISchematic; -import cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry; -import cpw.mods.fml.common.registry.GameData; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; import java.util.Iterator; @@ -35,39 +37,45 @@ public Schematic(final ItemStack icon, final int width, final int height, final } @Override - public Block getBlock(final int x, final int y, final int z) { - if (!isValid(x, y, z)) { - return Blocks.air; + public IBlockState getBlockState(final BlockPos pos) { + if (!isValid(pos)) { + return Blocks.air.getDefaultState(); } - return BLOCK_REGISTRY.getObjectById(this.blocks[x][y][z]); - } + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); + final Block block = BLOCK_REGISTRY.getObjectById(this.blocks[x][y][z]); - @Override - public boolean setBlock(final int x, final int y, final int z, final Block block) { - return setBlock(x, y, z, block, 0); + return block.getStateFromMeta(this.metadata[x][y][z]); } @Override - public boolean setBlock(final int x, final int y, final int z, final Block block, final int metadata) { - if (!isValid(x, y, z)) { + public boolean setBlockState(final BlockPos pos, final IBlockState blockState) { + if (!isValid(pos)) { return false; } + final Block block = blockState.getBlock(); final int id = BLOCK_REGISTRY.getId(block); if (id == -1) { return false; } + final int meta = block.getMetaFromState(blockState); + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); + this.blocks[x][y][z] = (short) id; - setBlockMetadata(x, y, z, metadata); + this.metadata[x][y][z] = (byte) meta; return true; } @Override - public TileEntity getTileEntity(final int x, final int y, final int z) { + public TileEntity getTileEntity(final BlockPos pos) { for (final TileEntity tileEntity : this.tileEntities) { - if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { + if (tileEntity.getPos().equals(pos)) { return tileEntity; } } @@ -81,47 +89,28 @@ public List getTileEntities() { } @Override - public void setTileEntity(final int x, final int y, final int z, final TileEntity tileEntity) { - if (!isValid(x, y, z)) { + public void setTileEntity(final BlockPos pos, final TileEntity tileEntity) { + if (!isValid(pos)) { return; } - this.removeTileEntity(x, y, z); + removeTileEntity(pos); this.tileEntities.add(tileEntity); } @Override - public void removeTileEntity(final int x, final int y, final int z) { + public void removeTileEntity(final BlockPos pos) { final Iterator iterator = this.tileEntities.iterator(); while (iterator.hasNext()) { final TileEntity tileEntity = iterator.next(); - if (tileEntity.xCoord == x && tileEntity.yCoord == y && tileEntity.zCoord == z) { + if (tileEntity.getPos().equals(pos)) { iterator.remove(); } } } - @Override - public int getBlockMetadata(final int x, final int y, final int z) { - if (!isValid(x, y, z)) { - return 0; - } - - return this.metadata[x][y][z]; - } - - @Override - public boolean setBlockMetadata(final int x, final int y, final int z, final int metadata) { - if (!isValid(x, y, z)) { - return false; - } - - this.metadata[x][y][z] = (byte) (metadata & 0x0F); - return true; - } - @Override public ItemStack getIcon() { return this.icon; @@ -151,7 +140,11 @@ public int getHeight() { return this.height; } - private boolean isValid(final int x, final int y, final int z) { + private boolean isValid(final BlockPos pos) { + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); + return !(x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length); } } diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index f5a96e70..ec22942c 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -1,3 +1,4 @@ # Schematica public net.minecraft.client.renderer.RenderGlobal field_72768_k # sortedWorldRenderers +public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag From 9253bb586996bd06254db1c186426eced52f2594 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 2 Feb 2015 20:55:25 +0100 Subject: [PATCH 165/314] Fixed tile entities not rendering. --- .../com/github/lunatrius/schematica/api/ISchematic.java | 1 - .../schematica/client/renderer/RenderSchematic.java | 3 +++ .../lunatrius/schematica/world/chunk/ChunkSchematic.java | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java index 4e86b863..129c400b 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -1,6 +1,5 @@ package com.github.lunatrius.schematica.api; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 1c3213a5..eca6626a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -259,7 +259,10 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.pushMatrix(); this.profiler.endStartSection("entities"); RenderHelper.enableStandardItemLighting(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); renderEntities(entity, frustum, partialTicks); + GlStateManager.disableBlend(); RenderHelper.disableStandardItemLighting(); disableLightmap(); GlStateManager.matrixMode(GL11.GL_MODELVIEW); diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java index 53cfe4e2..87d5584f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.world.chunk; import net.minecraft.block.state.IBlockState; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -34,4 +35,9 @@ public IBlockState getBlockState(BlockPos pos) { public boolean getAreLevelsEmpty(int startY, int endY) { return false; } + + @Override + public TileEntity getTileEntity(BlockPos pos, EnumCreateEntityType createEntityType) { + return this.world.getTileEntity(pos); + } } From 3985bc37b5861125cb7e9e0306378018b49d7787 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 4 Feb 2015 00:31:25 +0100 Subject: [PATCH 166/314] Made swap slots easier to configure. --- .../schematica/client/gui/GuiModConfig.java | 6 ++++- .../handler/ConfigurationHandler.java | 25 ++++++++++++------- .../lunatrius/schematica/reference/Names.java | 5 ++-- .../assets/schematica/lang/en_US.lang | 24 ++++++++++++++++-- 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java index 0adb221c..aff74cde 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java @@ -4,6 +4,7 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.fml.client.config.GuiConfig; import net.minecraftforge.fml.client.config.IConfigElement; @@ -19,7 +20,10 @@ public GuiModConfig(GuiScreen guiScreen) { private static List getConfigElements() { List elements = new ArrayList(); for (String name : ConfigurationHandler.configuration.getCategoryNames()) { - elements.add(new ConfigElement(ConfigurationHandler.configuration.getCategory(name).setLanguageKey(Names.Config.LANG_PREFIX + ".category." + name))); + final ConfigCategory category = ConfigurationHandler.configuration.getCategory(name).setLanguageKey(Names.Config.LANG_PREFIX + ".category." + name); + if (category.parent == null) { + elements.add(new ConfigElement(category)); + } } return elements; } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index b68bf9a6..4e267987 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -3,7 +3,6 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.google.common.primitives.Ints; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; @@ -39,7 +38,9 @@ public class ConfigurationHandler { public static final boolean DESTROY_BLOCKS_DEFAULT = false; public static final boolean DESTROY_INSTANTLY_DEFAULT = false; public static final boolean PLACE_ADJACENT_DEFAULT = true; - public static final int[] SWAP_SLOTS_DEFAULT = new int[] { }; + public static final boolean[] SWAP_SLOTS_DEFAULT = new boolean[] { + false, false, false, false, false, true, true, true, true + }; public static final boolean TOOLTIP_ENABLED_DEFAULT = true; public static final double TOOLTIP_X_DEFAULT = 100; public static final double TOOLTIP_Y_DEFAULT = 0; @@ -64,8 +65,8 @@ public class ConfigurationHandler { public static boolean destroyBlocks = DESTROY_BLOCKS_DEFAULT; public static boolean destroyInstantly = DESTROY_INSTANTLY_DEFAULT; public static boolean placeAdjacent = PLACE_ADJACENT_DEFAULT; - public static int[] swapSlots = SWAP_SLOTS_DEFAULT; - public static Queue swapSlotsQueue = new ArrayDeque(); + public static boolean[] swapSlots = SWAP_SLOTS_DEFAULT; + public static final Queue swapSlotsQueue = new ArrayDeque(); public static boolean tooltipEnabled = TOOLTIP_ENABLED_DEFAULT; public static float tooltipX = (float) TOOLTIP_X_DEFAULT; public static float tooltipY = (float) TOOLTIP_Y_DEFAULT; @@ -89,7 +90,7 @@ public class ConfigurationHandler { public static Property propDestroyBlocks = null; public static Property propDestroyInstantly = null; public static Property propPlaceAdjacent = null; - public static Property propSwapSlots = null; + public static Property[] propSwapSlots = new Property[SWAP_SLOTS_DEFAULT.length]; public static Property propTooltipEnabled = null; public static Property propTooltipX = null; public static Property propTooltipY = null; @@ -162,10 +163,16 @@ private static void loadConfiguration() { propPlaceAdjacent.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_ADJACENT); placeAdjacent = propPlaceAdjacent.getBoolean(PLACE_ADJACENT_DEFAULT); - propSwapSlots = configuration.get(Names.Config.Category.PRINTER, Names.Config.SWAP_SLOTS, SWAP_SLOTS_DEFAULT, Names.Config.SWAP_SLOTS_DESC, 0, 8); - propSwapSlots.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SWAP_SLOTS); - swapSlots = propSwapSlots.getIntList(); - swapSlotsQueue = new ArrayDeque(Ints.asList(swapSlots)); + swapSlotsQueue.clear(); + for (int i = 0; i < SWAP_SLOTS_DEFAULT.length; i++) { + propSwapSlots[i] = configuration.get(Names.Config.Category.PRINTER_SWAPSLOTS, Names.Config.SWAP_SLOT + i, SWAP_SLOTS_DEFAULT[i], Names.Config.SWAP_SLOT_DESC); + propSwapSlots[i].setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SWAP_SLOT + i); + swapSlots[i] = propSwapSlots[i].getBoolean(SWAP_SLOTS_DEFAULT[i]); + + if (swapSlots[i]) { + swapSlotsQueue.offer(i); + } + } propTooltipEnabled = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_ENABLED, TOOLTIP_ENABLED_DEFAULT, Names.Config.TOOLTIP_ENABLED_DESC); propTooltipEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_ENABLED); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 80054b7f..346c6885 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -6,6 +6,7 @@ public static final class Config { public static final class Category { public static final String RENDER = "render"; public static final String PRINTER = "printer"; + public static final String PRINTER_SWAPSLOTS = "printer.swapslots"; public static final String TOOLTIP = "tooltip"; public static final String GENERAL = "general"; public static final String SERVER = "server"; @@ -38,8 +39,8 @@ public static final class Category { public static final String DESTROY_INSTANTLY_DESC = "Destroy all blocks that can be destroyed in one tick."; public static final String PLACE_ADJACENT = "placeAdjacent"; public static final String PLACE_ADJACENT_DESC = "Place blocks only if there is an adjacent block next to them."; - public static final String SWAP_SLOTS = "swapSlots"; - public static final String SWAP_SLOTS_DESC = "The printer will use these slots to swap out items in the inventory."; + public static final String SWAP_SLOT = "swapSlot"; + public static final String SWAP_SLOT_DESC = "Allow the printer to use this hotbar slot."; public static final String TOOLTIP_ENABLED = "tooltipEnabled"; public static final String TOOLTIP_ENABLED_DESC = "Display a tooltip when hovering over blocks in a schematic."; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index b795f527..76b7196c 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -35,6 +35,8 @@ schematica.config.category.render=Rendering schematica.config.category.render.tooltip=Render related settings. schematica.config.category.printer=Printer schematica.config.category.printer.tooltip=Printer related settings. +schematica.config.category.printer.swapslots=Hotbar Slots +schematica.config.category.printer.swapslots.tooltip=Allow the printer to use non empty hotbar slots. schematica.config.category.tooltip=Tooltip schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General @@ -71,8 +73,26 @@ schematica.config.destroyInstantly=Destroy Instantly schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Place Only Adjacent schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -schematica.config.swapSlots=Swap Slots -schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. + +# gui - config - printer - swap slots +schematica.config.swapSlot0=Allow Slot 1 +schematica.config.swapSlot0.tooltip=Allow the printer to use the hotbar slot 1. +schematica.config.swapSlot1=Allow Slot 2 +schematica.config.swapSlot1.tooltip=Allow the printer to use the hotbar slot 2. +schematica.config.swapSlot2=Allow Slot 3 +schematica.config.swapSlot2.tooltip=Allow the printer to use the hotbar slot 3. +schematica.config.swapSlot3=Allow Slot 4 +schematica.config.swapSlot3.tooltip=Allow the printer to use the hotbar slot 4. +schematica.config.swapSlot4=Allow Slot 5 +schematica.config.swapSlot4.tooltip=Allow the printer to use the hotbar slot 5. +schematica.config.swapSlot5=Allow Slot 6 +schematica.config.swapSlot5.tooltip=Allow the printer to use the hotbar slot 6. +schematica.config.swapSlot6=Allow Slot 7 +schematica.config.swapSlot6.tooltip=Allow the printer to use the hotbar slot 7. +schematica.config.swapSlot7=Allow Slot 8 +schematica.config.swapSlot7.tooltip=Allow the printer to use the hotbar slot 8. +schematica.config.swapSlot8=Allow Slot 9 +schematica.config.swapSlot8.tooltip=Allow the printer to use the hotbar slot 9. # gui - config - tooltip schematica.config.tooltipEnabled=Tooltip Enabled From 649ac9ee9d0e848bd4da59a996e8a04b9f650ffa Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 5 Feb 2015 03:26:13 +0100 Subject: [PATCH 167/314] Removed the entity count as it's always 0/0. --- .../lunatrius/schematica/handler/client/OverlayHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index d5142adc..f22540c8 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -18,7 +18,7 @@ public void onText(RenderGameOverlayEvent.Text event) { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null) { event.left.add("[§6Schematica§r] D: " + schematic.getWidth() + "," + schematic.getHeight() + "," + schematic.getLength()); - event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); + // event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); } From 5cbef2f5b2887ec2601f4eb6464ccab39f48387b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 5 Feb 2015 04:33:49 +0100 Subject: [PATCH 168/314] Added blue/red point rendering. Replaced most vector instances with (M)BlockPos. Removed old rendering classes. --- .../client/gui/GuiSchematicControl.java | 26 +- .../client/gui/GuiSchematicSave.java | 10 +- .../client/renderer/RenderHelper.java | 475 ------------------ .../client/renderer/RenderSchematic.java | 56 ++- .../renderer/RendererSchematicChunk.java | 401 --------------- .../RendererSchematicChunkComparator.java | 30 -- .../renderer/RendererSchematicGlobal.java | 204 -------- .../client/renderer/TessellatorShape.java | 199 ++++++++ .../client/renderer/vertex/VertexFormats.java | 13 + .../command/CommandSchematicaSave.java | 6 +- .../handler/ConfigurationHandler.java | 4 +- .../handler/client/InputHandler.java | 6 +- .../handler/client/TickHandler.java | 27 - .../schematica/proxy/ClientProxy.java | 23 +- .../schematica/proxy/CommonProxy.java | 16 +- .../schematica/world/SchematicWorld.java | 8 +- src/main/resources/META-INF/schematica_at.cfg | 2 +- 17 files changed, 303 insertions(+), 1203 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index c52cfd1b..ca1da510 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -2,16 +2,16 @@ import com.github.lunatrius.core.client.gui.GuiNumericField; import com.github.lunatrius.core.client.gui.GuiScreenBase; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; +import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; +import net.minecraft.util.BlockPos; public class GuiSchematicControl extends GuiScreenBase { private final SchematicWorld schematic; @@ -133,10 +133,10 @@ private void setMinMax(GuiNumericField numericField) { numericField.setMaximum(Constants.World.MAXIMUM_COORD); } - private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, Vector3i point) { - numX.setValue(point.x); - numY.setValue(point.y); - numZ.setValue(point.z); + private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, BlockPos point) { + numX.setValue(point.getX()); + numY.setValue(point.getY()); + numZ.setValue(point.getZ()); } @Override @@ -148,34 +148,32 @@ protected void actionPerformed(GuiButton guiButton) { if (guiButton.id == this.numericX.id) { this.schematic.position.x = this.numericX.getValue(); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } else if (guiButton.id == this.numericY.id) { this.schematic.position.y = this.numericY.getValue(); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } else if (guiButton.id == this.numericZ.id) { this.schematic.position.z = this.numericZ.getValue(); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } else if (guiButton.id == this.btnLayerMode.id) { this.schematic.isRenderingLayer = !this.schematic.isRenderingLayer; this.btnLayerMode.displayString = this.schematic.isRenderingLayer ? this.strLayers : this.strAll; this.nfLayer.setEnabled(this.schematic.isRenderingLayer); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } else if (guiButton.id == this.nfLayer.id) { this.schematic.renderingLayer = this.nfLayer.getValue(); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } else if (guiButton.id == this.btnHide.id) { this.btnHide.displayString = this.schematic.toggleRendering() ? this.strHide : this.strShow; } else if (guiButton.id == this.btnMove.id) { ClientProxy.moveSchematicToPlayer(this.schematic); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); } else if (guiButton.id == this.btnFlip.id) { this.schematic.flip(); - RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); SchematicPrinter.INSTANCE.refresh(); } else if (guiButton.id == this.btnRotate.id) { this.schematic.rotate(); - RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(this.schematic); SchematicPrinter.INSTANCE.refresh(); } else if (guiButton.id == this.btnMaterials.id) { this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java index e1888405..1bb1856e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java @@ -2,7 +2,6 @@ import com.github.lunatrius.core.client.gui.GuiNumericField; import com.github.lunatrius.core.client.gui.GuiScreenBase; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; @@ -11,6 +10,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; +import net.minecraft.util.BlockPos; import java.io.IOException; @@ -109,10 +109,10 @@ private void setMinMax(GuiNumericField numericField) { numericField.setMaximum(Constants.World.MAXIMUM_COORD); } - private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, Vector3i point) { - numX.setValue(point.x); - numY.setValue(point.y); - numZ.setValue(point.z); + private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, BlockPos point) { + numX.setValue(point.getX()); + numY.setValue(point.getY()); + numZ.setValue(point.getZ()); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java deleted file mode 100644 index 0bb3657e..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderHelper.java +++ /dev/null @@ -1,475 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer; - -import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import org.lwjgl.BufferUtils; - -import java.nio.FloatBuffer; - -public class RenderHelper { - public static final int QUAD_DOWN = 0x01; - public static final int QUAD_UP = 0x02; - public static final int QUAD_NORTH = 0x04; - public static final int QUAD_SOUTH = 0x08; - public static final int QUAD_WEST = 0x10; - public static final int QUAD_EAST = 0x20; - public static final int QUAD_ALL = QUAD_DOWN | QUAD_UP | QUAD_NORTH | QUAD_SOUTH | QUAD_WEST | QUAD_EAST; - - public static final int LINE_DOWN_WEST = 0x11; - public static final int LINE_UP_WEST = 0x12; - public static final int LINE_DOWN_EAST = 0x21; - public static final int LINE_UP_EAST = 0x22; - public static final int LINE_DOWN_NORTH = 0x05; - public static final int LINE_UP_NORTH = 0x06; - public static final int LINE_DOWN_SOUTH = 0x09; - public static final int LINE_UP_SOUTH = 0x0A; - public static final int LINE_NORTH_WEST = 0x14; - public static final int LINE_NORTH_EAST = 0x24; - public static final int LINE_SOUTH_WEST = 0x18; - public static final int LINE_SOUTH_EAST = 0x28; - public static final int LINE_ALL = LINE_DOWN_WEST | LINE_UP_WEST | LINE_DOWN_EAST | LINE_UP_EAST | LINE_DOWN_NORTH | LINE_UP_NORTH | LINE_DOWN_SOUTH | LINE_UP_SOUTH | LINE_NORTH_WEST | LINE_NORTH_EAST | LINE_SOUTH_WEST | LINE_SOUTH_EAST; - - public static final Vector3f VEC_ZERO = new Vector3f(0, 0, 0); - - private static int quadSize = 0; - private static float[] quadVertexBuffer = null; - private static float[] quadColorBuffer = null; - private static int quadVertexIndex = 0; - private static int quadColorIndex = 0; - private static int quadCount = 0; - - private static int lineSize = 0; - private static float[] lineVertexBuffer = null; - private static float[] lineColorBuffer = null; - private static int lineVertexIndex = 0; - private static int lineColorIndex = 0; - private static int lineCount = 0; - - private static final Vector3f vecZero = new Vector3f(); - private static final Vector3f vecSize = new Vector3f(); - - public static void createBuffers() { - quadSize = 240; - quadVertexBuffer = new float[quadSize * 3]; - quadColorBuffer = new float[quadSize * 4]; - - lineSize = 240; - lineVertexBuffer = new float[lineSize * 3]; - lineColorBuffer = new float[lineSize * 4]; - - initBuffers(); - } - - public static void initBuffers() { - quadVertexIndex = 0; - quadColorIndex = 0; - quadCount = 0; - - lineVertexIndex = 0; - lineColorIndex = 0; - lineCount = 0; - } - - public static void destroyBuffers() { - quadSize = 0; - quadVertexBuffer = null; - quadColorBuffer = null; - - lineSize = 0; - lineVertexBuffer = null; - lineColorBuffer = null; - } - - public static FloatBuffer getQuadVertexBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(quadVertexBuffer.length).put(quadVertexBuffer); - buffer.flip(); - return buffer; - } - - public static FloatBuffer getQuadColorBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(quadColorBuffer.length).put(quadColorBuffer); - buffer.flip(); - return buffer; - } - - public static int getQuadCount() { - return quadCount; - } - - public static FloatBuffer getLineVertexBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(lineVertexBuffer.length).put(lineVertexBuffer); - buffer.flip(); - return buffer; - } - - public static FloatBuffer getLineColorBuffer() { - FloatBuffer buffer = BufferUtils.createFloatBuffer(lineColorBuffer.length).put(lineColorBuffer); - buffer.flip(); - return buffer; - } - - public static int getLineCount() { - return lineCount; - } - - private static float[] createAndCopyBuffer(int newSize, float[] oldBuffer) { - float[] tempBuffer = new float[newSize]; - System.arraycopy(oldBuffer, 0, tempBuffer, 0, oldBuffer.length); - return tempBuffer; - } - - public static void drawCuboidSurface(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { - vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); - vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); - - if (quadCount + 24 >= quadSize) { - quadSize *= 2; - - quadVertexBuffer = createAndCopyBuffer(quadSize * 3, quadVertexBuffer); - quadColorBuffer = createAndCopyBuffer(quadSize * 4, quadColorBuffer); - } - - int total = 0; - - if ((sides & QUAD_DOWN) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_UP) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_NORTH) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_SOUTH) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_WEST) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecZero.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - total += 4; - } - - if ((sides & QUAD_EAST) != 0) { - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecZero.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecZero.z; - quadCount++; - - quadVertexBuffer[quadVertexIndex++] = vecSize.x; - quadVertexBuffer[quadVertexIndex++] = vecSize.y; - quadVertexBuffer[quadVertexIndex++] = vecSize.z; - quadCount++; - - total += 4; - } - - for (int i = 0; i < total; i++) { - quadColorBuffer[quadColorIndex++] = red; - quadColorBuffer[quadColorIndex++] = green; - quadColorBuffer[quadColorIndex++] = blue; - quadColorBuffer[quadColorIndex++] = alpha; - } - } - - public static void drawCuboidOutline(Vector3f zero, Vector3f size, int sides, float red, float green, float blue, float alpha) { - vecZero.set(zero.x - ConfigurationHandler.blockDelta, zero.y - ConfigurationHandler.blockDelta, zero.z - ConfigurationHandler.blockDelta); - vecSize.set(size.x + ConfigurationHandler.blockDelta, size.y + ConfigurationHandler.blockDelta, size.z + ConfigurationHandler.blockDelta); - - if (lineCount + 24 >= lineSize) { - lineSize *= 2; - - lineVertexBuffer = createAndCopyBuffer(lineSize * 3, lineVertexBuffer); - lineColorBuffer = createAndCopyBuffer(lineSize * 4, lineColorBuffer); - } - - int total = 0; - - if ((sides & LINE_DOWN_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_DOWN_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - - if ((sides & LINE_DOWN_NORTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_NORTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_DOWN_SOUTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_UP_SOUTH) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_NORTH_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_NORTH_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecZero.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_SOUTH_WEST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecZero.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - if ((sides & LINE_SOUTH_EAST) != 0) { - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecZero.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - lineVertexBuffer[lineVertexIndex++] = vecSize.x; - lineVertexBuffer[lineVertexIndex++] = vecSize.y; - lineVertexBuffer[lineVertexIndex++] = vecSize.z; - lineCount++; - - total += 2; - } - - for (int i = 0; i < total; i++) { - lineColorBuffer[lineColorIndex++] = red; - lineColorBuffer[lineColorIndex++] = green; - lineColorBuffer[lineColorIndex++] = blue; - lineColorBuffer[lineColorIndex++] = alpha; - } - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index eca6626a..c13fadf5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; @@ -77,6 +78,8 @@ public class RenderSchematic extends RenderGlobal implements IWorldAccess, IReso private final Minecraft mc; private final Profiler profiler; private final RenderManager renderManager; + private final TessellatorShape tessellator = new TessellatorShape(0x200000); + private final MBlockPos tmp = new MBlockPos(); private SchematicWorld world; private Set chunksToUpdate = Sets.newLinkedHashSet(); private List renderInfos = Lists.newArrayListWithCapacity(CHUNKS); @@ -176,22 +179,50 @@ public void onRenderWorldLast(RenderWorldLastEvent event) { ClientProxy.setPlayerData(player, event.partialTicks); this.profiler.startSection("schematica"); + this.profiler.startSection("schematic"); SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null && schematic.isRendering) { - Vector3d playerPosition = ClientProxy.playerPosition.clone(); - Vector3d extra = new Vector3d(); - extra.add(schematic.position.toVector3d()); - playerPosition.sub(extra); + GlStateManager.pushMatrix(); + renderSchematic(schematic, event.partialTicks); + GlStateManager.popMatrix(); + } - playerPosition.set(schematic.position.toVector3d()).negate().add(1, 1, 1); + this.profiler.endStartSection("guide"); + if (ClientProxy.isRenderingGuide || schematic != null && schematic.isRendering) { + GlStateManager.pushMatrix(); + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GL11.glPushMatrix(); - renderSchematic(schematic, event.partialTicks); - GL11.glPopMatrix(); + this.tessellator.setTranslation(-ClientProxy.playerPosition.x, -ClientProxy.playerPosition.y, -ClientProxy.playerPosition.z); + + if (ClientProxy.isRenderingGuide) { + this.tessellator.startQuads(); + this.tessellator.drawCuboid(ClientProxy.pointA, TessellatorShape.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); + this.tessellator.drawCuboid(ClientProxy.pointB, TessellatorShape.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); + this.tessellator.draw(); + } + + this.tessellator.startLines(); + if (ClientProxy.isRenderingGuide) { + this.tessellator.drawCuboid(ClientProxy.pointA, TessellatorShape.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); + this.tessellator.drawCuboid(ClientProxy.pointB, TessellatorShape.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); + this.tessellator.drawCuboid(ClientProxy.pointMin, ClientProxy.pointMax, TessellatorShape.QUAD_ALL, 0.0f, 0.75f, 0.0f, 0.5f); + } + if (schematic != null && schematic.isRendering) { + this.tmp.set(schematic.position).add(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1); + this.tessellator.drawCuboid(schematic.position, this.tmp, TessellatorShape.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.5f); + } + this.tessellator.draw(); + + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.popMatrix(); } this.profiler.endSection(); + this.profiler.endSection(); } } @@ -202,7 +233,7 @@ private void renderSchematic(final SchematicWorld schematic, final float partial loadRenderers(); } - PLAYER_POSITION_OFFSET.set(ClientProxy.playerPosition).sub(this.world.position.toVector3d()); + PLAYER_POSITION_OFFSET.set(ClientProxy.playerPosition).sub(this.world.position.x, this.world.position.y, this.world.position.z); if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { GL20.glUseProgram(SHADER_ALPHA.getProgram()); @@ -295,6 +326,10 @@ private void disableLightmap() { GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); } + public void refresh() { + loadRenderers(); + } + @Override public void loadRenderers() { if (this.world != null) { @@ -764,7 +799,8 @@ public void markBlockRangeForRenderUpdate(final int x1, final int y1, final int markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1); } - private void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + @Override + public void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { this.viewFrustum.markBlocksForUpdate(x1, y1, z1, x2, y2, z2); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java deleted file mode 100644 index b4d12e00..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunk.java +++ /dev/null @@ -1,401 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer; - -import com.github.lunatrius.core.util.MBlockPos; -import com.github.lunatrius.core.util.vector.Vector3d; -import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.reference.Constants; -import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.init.Blocks; -import net.minecraft.profiler.Profiler; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.IBlockAccess; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL20; - -import java.util.ArrayList; -import java.util.List; - -@Deprecated -public class RendererSchematicChunk { - private static final ShaderProgram SHADER_ALPHA = new ShaderProgram("schematica", null, "shaders/alpha.frag"); - - private static boolean canUpdate = false; - - public boolean isInFrustrum = false; - - public final Vector3d centerPosition = new Vector3d(); - - private final Minecraft minecraft = Minecraft.getMinecraft(); - private final Profiler profiler = this.minecraft.mcProfiler; - private final SchematicWorld schematic; - private final List tileEntities = new ArrayList(); - private final Vector3d distance = new Vector3d(); - - private final AxisAlignedBB boundingBox; - - private boolean needsUpdate = true; - private int glList = -1; - // TODO: move this away from GL lists - private int glListHighlight = -1; - - public RendererSchematicChunk(SchematicWorld schematicWorld, int baseX, int baseY, int baseZ) { - this.schematic = schematicWorld; - // this.boundingBox.setBounds(baseX * Constants.SchematicChunk.WIDTH, baseY * Constants.SchematicChunk.HEIGHT, baseZ * Constants.SchematicChunk.LENGTH, (baseX + 1) * Constants.SchematicChunk.WIDTH, (baseY + 1) * Constants.SchematicChunk.HEIGHT, (baseZ + 1) * Constants.SchematicChunk.LENGTH); - this.boundingBox = new AxisAlignedBB(baseX * Constants.SchematicChunk.WIDTH, baseY * Constants.SchematicChunk.HEIGHT, baseZ * Constants.SchematicChunk.LENGTH, (baseX + 1) * Constants.SchematicChunk.WIDTH, (baseY + 1) * Constants.SchematicChunk.HEIGHT, (baseZ + 1) * Constants.SchematicChunk.LENGTH); - - this.centerPosition.x = (int) ((baseX + 0.5) * Constants.SchematicChunk.WIDTH); - this.centerPosition.y = (int) ((baseY + 0.5) * Constants.SchematicChunk.HEIGHT); - this.centerPosition.z = (int) ((baseZ + 0.5) * Constants.SchematicChunk.LENGTH); - - int x, y, z; - for (TileEntity tileEntity : this.schematic.getTileEntities()) { - final BlockPos pos = tileEntity.getPos(); - x = pos.getX(); - y = pos.getY(); - z = pos.getZ(); - - if (x < this.boundingBox.minX || x >= this.boundingBox.maxX) { - continue; - } else if (z < this.boundingBox.minZ || z >= this.boundingBox.maxZ) { - continue; - } else if (y < this.boundingBox.minY || y >= this.boundingBox.maxY) { - continue; - } - - this.tileEntities.add(tileEntity); - } - - this.glList = GL11.glGenLists(3); - this.glListHighlight = GL11.glGenLists(3); - } - - public void delete() { - if (this.glList != -1) { - GL11.glDeleteLists(this.glList, 3); - } - if (this.glListHighlight != -1) { - GL11.glDeleteLists(this.glListHighlight, 3); - } - } - - public AxisAlignedBB getBoundingBox() { - return this.boundingBox; - } - - public static void setCanUpdate(boolean parCanUpdate) { - canUpdate = parCanUpdate; - } - - public static boolean getCanUpdate() { - return canUpdate; - } - - public void setDirty() { - this.needsUpdate = true; - } - - public boolean getDirty() { - return this.needsUpdate; - } - - public void updateRenderer() { - if (this.needsUpdate) { - this.needsUpdate = false; - setCanUpdate(false); - - RenderHelper.createBuffers(); - - for (int pass = 0; pass < 3; pass++) { - RenderHelper.initBuffers(); - - int minX, maxX, minY, maxY, minZ, maxZ; - - minX = (int) this.boundingBox.minX; - maxX = Math.min((int) this.boundingBox.maxX, this.schematic.getWidth()); - minY = (int) this.boundingBox.minY; - maxY = Math.min((int) this.boundingBox.maxY, this.schematic.getHeight()); - minZ = (int) this.boundingBox.minZ; - maxZ = Math.min((int) this.boundingBox.maxZ, this.schematic.getLength()); - - int renderingLayer = this.schematic.renderingLayer; - if (this.schematic.isRenderingLayer) { - if (renderingLayer >= minY && renderingLayer < maxY) { - minY = renderingLayer; - maxY = renderingLayer + 1; - } else { - minY = maxY = 0; - } - } - - GL11.glNewList(this.glList + pass, GL11.GL_COMPILE); - renderBlocks(pass, minX, minY, minZ, maxX, maxY, maxZ); - GL11.glEndList(); - - GL11.glNewList(this.glListHighlight + pass, GL11.GL_COMPILE); - int quadCount = RenderHelper.getQuadCount(); - int lineCount = RenderHelper.getLineCount(); - - if (quadCount > 0 || lineCount > 0) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - - GL11.glLineWidth(1.5f); - - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - - if (quadCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getQuadVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getQuadColorBuffer()); - GL11.glDrawArrays(GL11.GL_QUADS, 0, quadCount); - } - - if (lineCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getLineVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getLineColorBuffer()); - GL11.glDrawArrays(GL11.GL_LINES, 0, lineCount); - } - - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - GL11.glEndList(); - } - - RenderHelper.destroyBuffers(); - } - } - - public void render(int renderPass) { - if (!this.isInFrustrum) { - return; - } - - if (this.distance.set(ClientProxy.playerPosition).sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).sub(this.centerPosition).lengthSquared() > 25600) { - return; - } - - // some mods enable this, beats me why - it's supposed to be disabled! - GL11.glDisable(GL11.GL_LIGHTING); - - this.profiler.startSection("blocks"); - this.minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture); - - if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { - GL20.glUseProgram(SHADER_ALPHA.getProgram()); - GL20.glUniform1f(GL20.glGetUniformLocation(SHADER_ALPHA.getProgram(), "alpha_multiplier"), ConfigurationHandler.alpha); - } - - GL11.glCallList(this.glList + renderPass); - - if (OpenGlHelper.shadersSupported && ConfigurationHandler.enableAlpha) { - GL20.glUseProgram(0); - } - - this.profiler.endStartSection("highlight"); - GL11.glCallList(this.glListHighlight + renderPass); - - this.profiler.endStartSection("tileEntities"); - renderTileEntities(renderPass); - - // re-enable blending... spawners disable it, somewhere... - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - // re-set alpha func... beacons set it to (GL_GREATER, 0.5f) - // EntityRenderer sets it to (GL_GREATER, 0.1f) before dispatching the event - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - - this.profiler.endSection(); - } - - public void renderBlocks(int renderPass, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { - IBlockAccess mcWorld = this.minecraft.theWorld; - BlockRendererDispatcher renderBlocks = RendererSchematicGlobal.INSTANCE.renderBlocks; - - final MBlockPos pos = new MBlockPos(); - final MBlockPos mcPos = new MBlockPos(); - final MBlockPos tmp = new MBlockPos(); - int x, y, z; - int sides; - IBlockState blockState, mcBlockState; - Block block, mcBlock; - Vector3f zero = new Vector3f(); - Vector3f size = new Vector3f(); - - int ambientOcclusion = this.minecraft.gameSettings.ambientOcclusion; - this.minecraft.gameSettings.ambientOcclusion = 0; - - final Tessellator tessellator = Tessellator.getInstance(); - final WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - worldRenderer.startDrawingQuads(); - - for (y = minY; y < maxY; y++) { - for (z = minZ; z < maxZ; z++) { - for (x = minX; x < maxX; x++) { - try { - pos.set(x, y, z); - blockState = this.schematic.getBlockState(pos); - block = blockState.getBlock(); - - mcPos.set(this.schematic.position.x + x, this.schematic.position.y + y, this.schematic.position.z + z); - mcBlockState = mcWorld.getBlockState(mcPos); - mcBlock = mcBlockState.getBlock(); - - sides = 0; - if (block != null) { - if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.DOWN), EnumFacing.DOWN)) { - sides |= RenderHelper.QUAD_DOWN; - } - - if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.UP), EnumFacing.UP)) { - sides |= RenderHelper.QUAD_UP; - } - - if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.NORTH), EnumFacing.NORTH)) { - sides |= RenderHelper.QUAD_NORTH; - } - - if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { - sides |= RenderHelper.QUAD_SOUTH; - } - - if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.WEST), EnumFacing.WEST)) { - sides |= RenderHelper.QUAD_WEST; - } - - if (block.shouldSideBeRendered(this.schematic, tmp.set(pos).offset(EnumFacing.EAST), EnumFacing.EAST)) { - sides |= RenderHelper.QUAD_EAST; - } - } - - boolean isAirBlock = mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock); - - if (!isAirBlock) { - if (ConfigurationHandler.highlight && renderPass == 2) { - if (block == Blocks.air && ConfigurationHandler.highlightAir) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.75f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); - } - } else if (block != mcBlock) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, sides, 1.0f, 0.0f, 0.0f, 0.25f); - } - } else if (block.getMetaFromState(blockState) != mcBlock.getMetaFromState(mcBlockState)) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, sides, 0.75f, 0.35f, 0.0f, 0.25f); - } - } - } - } else if (block != Blocks.air) { - if (ConfigurationHandler.highlight && renderPass == 2) { - zero.set(x, y, z); - size.set(x + 1, y + 1, z + 1); - if (ConfigurationHandler.drawQuads) { - RenderHelper.drawCuboidSurface(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); - } - if (ConfigurationHandler.drawLines) { - RenderHelper.drawCuboidOutline(zero, size, sides, 0.0f, 0.75f, 1.0f, 0.25f); - } - } - - if (block != null) { - // renderBlocks.renderBlockByRenderType(block, x, y, z); - } - } - } catch (Exception e) { - Reference.logger.error("Failed to render block!", e); - } - } - } - } - - tessellator.draw(); - - this.minecraft.gameSettings.ambientOcclusion = ambientOcclusion; - } - - public void renderTileEntities(int renderPass) { - if (renderPass != 0) { - return; - } - - IBlockAccess mcWorld = this.minecraft.theWorld; - - final MBlockPos pos = new MBlockPos(); - int x, y, z; - Block mcBlock; - - GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); - - try { - for (TileEntity tileEntity : this.tileEntities) { - pos.set(tileEntity.getPos()); - final BlockPos pos1 = tileEntity.getPos(); - x = pos1.getX(); - y = pos1.getY(); - z = pos1.getZ(); - - if (this.schematic.isRenderingLayer && this.schematic.renderingLayer != y) { - continue; - } - - final BlockPos mcPos = pos.add(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z); - final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); - mcBlock = mcBlockState.getBlock(); - - if (mcBlock.isAir(mcWorld, mcPos)) { - TileEntitySpecialRenderer tileEntitySpecialRenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntity); - if (tileEntitySpecialRenderer != null) { - try { - tileEntitySpecialRenderer.renderTileEntityAt(tileEntity, x, y, z, 0, -1); - - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } catch (Exception e) { - Reference.logger.error("Failed to render a tile entity!", e); - } - GL11.glColor4f(1.0f, 1.0f, 1.0f, ConfigurationHandler.alpha); - } - } - } - } catch (Exception ex) { - Reference.logger.error("Failed to render tile entities!", ex); - } - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java deleted file mode 100644 index e04cdd48..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicChunkComparator.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer; - -import com.github.lunatrius.core.util.vector.Vector3d; -import com.github.lunatrius.core.util.vector.Vector3i; -import com.github.lunatrius.schematica.proxy.ClientProxy; - -import java.util.Comparator; - -@Deprecated -public class RendererSchematicChunkComparator implements Comparator { - private final Vector3d position = new Vector3d(); - private final Vector3d schematicPosition = new Vector3d(); - - @Override - public int compare(RendererSchematicChunk rendererSchematicChunk1, RendererSchematicChunk rendererSchematicChunk2) { - if (rendererSchematicChunk1.isInFrustrum && !rendererSchematicChunk2.isInFrustrum) { - return -1; - } else if (!rendererSchematicChunk1.isInFrustrum && rendererSchematicChunk2.isInFrustrum) { - return 1; - } else { - final double dist1 = this.position.lengthSquaredTo(rendererSchematicChunk1.centerPosition); - final double dist2 = this.position.lengthSquaredTo(rendererSchematicChunk2.centerPosition); - return dist1 > dist2 ? 1 : (dist1 < dist2 ? -1 : 0); - } - } - - public void setPosition(Vector3i position) { - this.position.set(ClientProxy.playerPosition).sub(position.toVector3d(this.schematicPosition)); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java deleted file mode 100644 index 6e5ee72b..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RendererSchematicGlobal.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer; - -import com.github.lunatrius.core.util.vector.Vector3d; -import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.reference.Constants; -import com.github.lunatrius.schematica.world.SchematicWorld; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.culling.Frustum; -import net.minecraft.profiler.Profiler; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.opengl.GL11; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -@Deprecated -public class RendererSchematicGlobal { - public static final RendererSchematicGlobal INSTANCE = new RendererSchematicGlobal(); - - private final Minecraft minecraft = Minecraft.getMinecraft(); - private final Profiler profiler = this.minecraft.mcProfiler; - - private final Frustum frustum = new Frustum(); - public BlockRendererDispatcher renderBlocks = null; - public final List sortedRendererSchematicChunk = new ArrayList(); - private final RendererSchematicChunkComparator rendererSchematicChunkComparator = new RendererSchematicChunkComparator(); - - private RendererSchematicGlobal() {} - - @SubscribeEvent - public void onRender(RenderWorldLastEvent event) { - EntityPlayerSP player = this.minecraft.thePlayer; - if (player != null) { - ClientProxy.setPlayerData(player, event.partialTicks); - - this.profiler.startSection("schematica"); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - - if ((schematic != null && schematic.isRendering) || ClientProxy.isRenderingGuide) { - render(schematic); - } - - this.profiler.endSection(); - } - } - - public void render(SchematicWorld schematic) { - GL11.glPushMatrix(); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_BLEND); - - Vector3d playerPosition = ClientProxy.playerPosition.clone(); - Vector3d extra = new Vector3d(); - if (schematic != null) { - extra.add(schematic.position.toVector3d()); - playerPosition.sub(extra); - } - - GL11.glTranslated(-playerPosition.x, -playerPosition.y, -playerPosition.z); - - this.profiler.startSection("schematic"); - if (schematic != null && schematic.isRendering) { - this.profiler.startSection("updateFrustrum"); - updateFrustrum(schematic); - - this.profiler.endStartSection("sortAndUpdate"); - if (RendererSchematicChunk.getCanUpdate()) { - sortAndUpdate(schematic); - } - - this.profiler.endStartSection("render"); - int pass; - for (pass = 0; pass < 3; pass++) { - for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { - renderer.render(pass); - } - } - this.profiler.endSection(); - } - - this.profiler.endStartSection("guide"); - - RenderHelper.createBuffers(); - - this.profiler.startSection("dataPrep"); - if (schematic != null && schematic.isRendering) { - RenderHelper.drawCuboidOutline(RenderHelper.VEC_ZERO, schematic.dimensions(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.25f); - } - - if (ClientProxy.isRenderingGuide) { - Vector3d start = new Vector3d(); - Vector3d end = new Vector3d(); - - ClientProxy.pointMin.toVector3d(start).sub(extra); - ClientProxy.pointMax.toVector3d(end).sub(extra).add(1, 1, 1); - RenderHelper.drawCuboidOutline(start.toVector3f(), end.toVector3f(), RenderHelper.LINE_ALL, 0.0f, 0.75f, 0.0f, 0.25f); - - ClientProxy.pointA.toVector3d(start).sub(extra); - end.set(start).add(1, 1, 1); - RenderHelper.drawCuboidOutline(start.toVector3f(), end.toVector3f(), RenderHelper.LINE_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - RenderHelper.drawCuboidSurface(start.toVector3f(), end.toVector3f(), RenderHelper.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - - ClientProxy.pointB.toVector3d(start).sub(extra); - end.set(start).add(1, 1, 1); - RenderHelper.drawCuboidOutline(start.toVector3f(), end.toVector3f(), RenderHelper.LINE_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - RenderHelper.drawCuboidSurface(start.toVector3f(), end.toVector3f(), RenderHelper.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - } - - int quadCount = RenderHelper.getQuadCount(); - int lineCount = RenderHelper.getLineCount(); - - if (quadCount > 0 || lineCount > 0) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - - GL11.glLineWidth(1.5f); - - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - - this.profiler.endStartSection("quad"); - if (quadCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getQuadVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getQuadColorBuffer()); - GL11.glDrawArrays(GL11.GL_QUADS, 0, quadCount); - } - - this.profiler.endStartSection("line"); - if (lineCount > 0) { - GL11.glVertexPointer(3, 0, RenderHelper.getLineVertexBuffer()); - GL11.glColorPointer(4, 0, RenderHelper.getLineColorBuffer()); - GL11.glDrawArrays(GL11.GL_LINES, 0, lineCount); - } - - this.profiler.endSection(); - - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - - this.profiler.endSection(); - - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL11.glPopMatrix(); - } - - private void updateFrustrum(SchematicWorld schematic) { - this.frustum.setPosition(ClientProxy.playerPosition.x - schematic.position.x, ClientProxy.playerPosition.y - schematic.position.y, ClientProxy.playerPosition.z - schematic.position.z); - for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { - rendererSchematicChunk.isInFrustrum = this.frustum.isBoundingBoxInFrustum(rendererSchematicChunk.getBoundingBox()); - } - } - - private void sortAndUpdate(SchematicWorld schematic) { - this.rendererSchematicChunkComparator.setPosition(schematic.position); - Collections.sort(this.sortedRendererSchematicChunk, this.rendererSchematicChunkComparator); - - for (RendererSchematicChunk rendererSchematicChunk : this.sortedRendererSchematicChunk) { - if (rendererSchematicChunk.getDirty()) { - rendererSchematicChunk.updateRenderer(); - break; - } - } - } - - public void createRendererSchematicChunks(SchematicWorld schematic) { - int width = (schematic.getWidth() - 1) / Constants.SchematicChunk.WIDTH + 1; - int height = (schematic.getHeight() - 1) / Constants.SchematicChunk.HEIGHT + 1; - int length = (schematic.getLength() - 1) / Constants.SchematicChunk.LENGTH + 1; - - destroyRendererSchematicChunks(); - - this.renderBlocks = this.minecraft.getBlockRendererDispatcher(); - for (int y = 0; y < height; y++) { - for (int z = 0; z < length; z++) { - for (int x = 0; x < width; x++) { - this.sortedRendererSchematicChunk.add(new RendererSchematicChunk(schematic, x, y, z)); - } - } - } - } - - public void destroyRendererSchematicChunks() { - this.renderBlocks = null; - while (this.sortedRendererSchematicChunk.size() > 0) { - this.sortedRendererSchematicChunk.remove(0).delete(); - } - } - - public void refresh() { - for (RendererSchematicChunk renderer : this.sortedRendererSchematicChunk) { - renderer.setDirty(); - } - - RenderSchematic.INSTANCE.loadRenderers(); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java new file mode 100644 index 00000000..ec089d26 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java @@ -0,0 +1,199 @@ +package com.github.lunatrius.schematica.client.renderer; + +import com.github.lunatrius.schematica.client.renderer.vertex.VertexFormats; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.util.BlockPos; +import org.lwjgl.opengl.GL11; + +public class TessellatorShape extends Tessellator { + public static final int QUAD_DOWN = 0x01; + public static final int QUAD_UP = 0x02; + public static final int QUAD_NORTH = 0x04; + public static final int QUAD_SOUTH = 0x08; + public static final int QUAD_WEST = 0x10; + public static final int QUAD_EAST = 0x20; + public static final int QUAD_ALL = QUAD_DOWN | QUAD_UP | QUAD_NORTH | QUAD_SOUTH | QUAD_WEST | QUAD_EAST; + + public static final int LINE_DOWN_WEST = 0x11; + public static final int LINE_UP_WEST = 0x12; + public static final int LINE_DOWN_EAST = 0x21; + public static final int LINE_UP_EAST = 0x22; + public static final int LINE_DOWN_NORTH = 0x05; + public static final int LINE_UP_NORTH = 0x06; + public static final int LINE_DOWN_SOUTH = 0x09; + public static final int LINE_UP_SOUTH = 0x0A; + public static final int LINE_NORTH_WEST = 0x14; + public static final int LINE_NORTH_EAST = 0x24; + public static final int LINE_SOUTH_WEST = 0x18; + public static final int LINE_SOUTH_EAST = 0x28; + public static final int LINE_ALL = LINE_DOWN_WEST | LINE_UP_WEST | LINE_DOWN_EAST | LINE_UP_EAST | LINE_DOWN_NORTH | LINE_UP_NORTH | LINE_DOWN_SOUTH | LINE_UP_SOUTH | LINE_NORTH_WEST | LINE_NORTH_EAST | LINE_SOUTH_WEST | LINE_SOUTH_EAST; + + private int mode = -1; + + public TessellatorShape(final int size) { + super(size); + } + + public void setTranslation(final double x, final double y, final double z) { + getWorldRenderer().setTranslation(x, y, z); + } + + public void startQuads() { + start(GL11.GL_QUADS); + } + + public void startLines() { + start(GL11.GL_LINES); + } + + public void start(final int mode) { + this.mode = mode; + getWorldRenderer().startDrawing(mode); + getWorldRenderer().setVertexFormat(VertexFormats.ABSTRACT); + } + + @Override + public int draw() { + this.mode = -1; + return super.draw(); + } + + public void drawCuboid(final BlockPos pos, final int sides, final float red, final float green, final float blue, final float alpha) { + drawCuboid(pos, pos, sides, red, green, blue, alpha); + } + + public void drawCuboid(final BlockPos begin, final BlockPos end, final int sides, final float red, final float green, final float blue, final float alpha) { + if (this.mode == -1 || sides == 0) { + return; + } + + final double x0 = begin.getX() - ConfigurationHandler.blockDelta; + final double y0 = begin.getY() - ConfigurationHandler.blockDelta; + final double z0 = begin.getZ() - ConfigurationHandler.blockDelta; + final double x1 = end.getX() + 1 + ConfigurationHandler.blockDelta; + final double y1 = end.getY() + 1 + ConfigurationHandler.blockDelta; + final double z1 = end.getZ() + 1 + ConfigurationHandler.blockDelta; + + if (this.mode == GL11.GL_QUADS) { + drawQuads(x0, y0, z0, x1, y1, z1, sides, red, green, blue, alpha); + } else if (this.mode == GL11.GL_LINES) { + drawLines(x0, y0, z0, x1, y1, z1, sides, red, green, blue, alpha); + } else { + throw new IllegalStateException("Unsupported mode!"); + } + } + + private void drawQuads(final double x0, final double y0, final double z0, final double x1, final double y1, final double z1, final int sides, final float red, final float green, final float blue, final float alpha) { + final WorldRenderer worldRenderer = getWorldRenderer(); + worldRenderer.setColorRGBA_F(red, green, blue, alpha); + + if ((sides & QUAD_DOWN) != 0) { + worldRenderer.addVertex(x1, y0, z0); + worldRenderer.addVertex(x1, y0, z1); + worldRenderer.addVertex(x0, y0, z1); + worldRenderer.addVertex(x0, y0, z0); + } + + if ((sides & QUAD_UP) != 0) { + worldRenderer.addVertex(x1, y1, z0); + worldRenderer.addVertex(x0, y1, z0); + worldRenderer.addVertex(x0, y1, z1); + worldRenderer.addVertex(x1, y1, z1); + } + + if ((sides & QUAD_NORTH) != 0) { + worldRenderer.addVertex(x1, y0, z0); + worldRenderer.addVertex(x0, y0, z0); + worldRenderer.addVertex(x0, y1, z0); + worldRenderer.addVertex(x1, y1, z0); + } + + if ((sides & QUAD_SOUTH) != 0) { + worldRenderer.addVertex(x0, y0, z1); + worldRenderer.addVertex(x1, y0, z1); + worldRenderer.addVertex(x1, y1, z1); + worldRenderer.addVertex(x0, y1, z1); + } + + if ((sides & QUAD_WEST) != 0) { + worldRenderer.addVertex(x0, y0, z0); + worldRenderer.addVertex(x0, y0, z1); + worldRenderer.addVertex(x0, y1, z1); + worldRenderer.addVertex(x0, y1, z0); + } + + if ((sides & QUAD_EAST) != 0) { + worldRenderer.addVertex(x1, y0, z1); + worldRenderer.addVertex(x1, y0, z0); + worldRenderer.addVertex(x1, y1, z0); + worldRenderer.addVertex(x1, y1, z1); + } + } + + private void drawLines(final double x0, final double y0, final double z0, final double x1, final double y1, final double z1, final int sides, final float red, final float green, final float blue, final float alpha) { + final WorldRenderer worldRenderer = getWorldRenderer(); + worldRenderer.setColorRGBA_F(red, green, blue, alpha); + + if ((sides & LINE_DOWN_WEST) != 0) { + worldRenderer.addVertex(x0, y0, z0); + worldRenderer.addVertex(x0, y0, z1); + } + + if ((sides & LINE_UP_WEST) != 0) { + worldRenderer.addVertex(x0, y1, z0); + worldRenderer.addVertex(x0, y1, z1); + } + + if ((sides & LINE_DOWN_EAST) != 0) { + worldRenderer.addVertex(x1, y0, z0); + worldRenderer.addVertex(x1, y0, z1); + } + + if ((sides & LINE_UP_EAST) != 0) { + worldRenderer.addVertex(x1, y1, z0); + worldRenderer.addVertex(x1, y1, z1); + } + + if ((sides & LINE_DOWN_NORTH) != 0) { + worldRenderer.addVertex(x0, y0, z0); + worldRenderer.addVertex(x1, y0, z0); + } + + if ((sides & LINE_UP_NORTH) != 0) { + worldRenderer.addVertex(x0, y1, z0); + worldRenderer.addVertex(x1, y1, z0); + } + + if ((sides & LINE_DOWN_SOUTH) != 0) { + worldRenderer.addVertex(x0, y0, z1); + worldRenderer.addVertex(x1, y0, z1); + } + + if ((sides & LINE_UP_SOUTH) != 0) { + worldRenderer.addVertex(x0, y1, z1); + worldRenderer.addVertex(x1, y1, z1); + } + + if ((sides & LINE_NORTH_WEST) != 0) { + worldRenderer.addVertex(x0, y0, z0); + worldRenderer.addVertex(x0, y1, z0); + } + + if ((sides & LINE_NORTH_EAST) != 0) { + worldRenderer.addVertex(x1, y0, z0); + worldRenderer.addVertex(x1, y1, z0); + } + + if ((sides & LINE_SOUTH_WEST) != 0) { + worldRenderer.addVertex(x0, y0, z1); + worldRenderer.addVertex(x0, y1, z1); + } + + if ((sides & LINE_SOUTH_EAST) != 0) { + worldRenderer.addVertex(x1, y0, z1); + worldRenderer.addVertex(x1, y1, z1); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java new file mode 100644 index 00000000..2f9157bc --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java @@ -0,0 +1,13 @@ +package com.github.lunatrius.schematica.client.renderer.vertex; + +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public final class VertexFormats { + public static final VertexFormat ABSTRACT = new VertexFormat(); + + static { + ABSTRACT.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + ABSTRACT.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4)); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 9694c933..dde58fae 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.command; -import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Names; @@ -41,8 +41,8 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com throw new CommandException(Names.Command.Save.Message.QUOTA_EXCEEDED); } - Vector3i from = new Vector3i(); - Vector3i to = new Vector3i(); + MBlockPos from = new MBlockPos(); + MBlockPos to = new MBlockPos(); String filename; String name; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 4e267987..22ed00c0 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -56,7 +56,7 @@ public class ConfigurationHandler { public static float alpha = (float) ALPHA_DEFAULT; public static boolean highlight = HIGHLIGHT_DEFAULT; public static boolean highlightAir = HIGHLIGHT_AIR_DEFAULT; - public static float blockDelta = (float) BLOCK_DELTA_DEFAULT; + public static double blockDelta = BLOCK_DELTA_DEFAULT; public static boolean drawQuads = DRAW_QUADS_DEFAULT; public static boolean drawLines = DRAW_LINES_DEFAULT; public static int placeDelay = PLACE_DELAY_DEFAULT; @@ -129,7 +129,7 @@ private static void loadConfiguration() { propBlockDelta = configuration.get(Names.Config.Category.RENDER, Names.Config.BLOCK_DELTA, BLOCK_DELTA_DEFAULT, Names.Config.BLOCK_DELTA_DESC, 0.0, 0.2); propBlockDelta.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.BLOCK_DELTA); - blockDelta = (float) propBlockDelta.getDouble(BLOCK_DELTA_DEFAULT); + blockDelta = propBlockDelta.getDouble(BLOCK_DELTA_DEFAULT); propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAW_QUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); propDrawQuads.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_QUADS); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index e723db2a..42272785 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -4,7 +4,7 @@ import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; -import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; +import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; @@ -55,7 +55,7 @@ public void onKeyInput(InputEvent event) { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null && schematic.isRenderingLayer) { schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } } @@ -63,7 +63,7 @@ public void onKeyInput(InputEvent event) { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null && schematic.isRenderingLayer) { schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); - RendererSchematicGlobal.INSTANCE.refresh(); + RenderSchematic.INSTANCE.refresh(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 4ec46af6..ed3899fe 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -2,7 +2,6 @@ import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.client.renderer.RendererSchematicChunk; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; @@ -47,12 +46,6 @@ public void onClientTick(TickEvent.ClientTickEvent event) { printer.print(); } - this.minecraft.mcProfiler.endStartSection("checkDirty"); - checkDirty(schematic); - - this.minecraft.mcProfiler.endStartSection("canUpdate"); - RendererSchematicChunk.setCanUpdate(true); - this.minecraft.mcProfiler.endSection(); } @@ -64,24 +57,4 @@ public void onClientTick(TickEvent.ClientTickEvent event) { this.minecraft.mcProfiler.endSection(); } } - - private void checkDirty(SchematicWorld schematic) { - // TODO - /* - WorldRenderer[] renderers = this.minecraft.renderGlobal.sortedWorldRenderers; - if (renderers != null) { - int count = 0; - for (WorldRenderer worldRenderer : renderers) { - if (worldRenderer != null && worldRenderer.needsUpdate && count++ < 125) { - AxisAlignedBB worldRendererBoundingBox = worldRenderer.rendererBoundingBox.getOffsetBoundingBox(-schematic.position.x, -schematic.position.y, -schematic.position.z); - for (RendererSchematicChunk renderer : RendererSchematicGlobal.INSTANCE.sortedRendererSchematicChunk) { - if (!renderer.getDirty() && renderer.getBoundingBox().intersectsWith(worldRendererBoundingBox)) { - renderer.setDirty(); - } - } - } - } - } - */ - } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 288c749a..d3403364 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,12 +1,11 @@ package com.github.lunatrius.schematica.proxy; +import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; -import com.github.lunatrius.schematica.client.renderer.RendererSchematicGlobal; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.InputHandler; @@ -41,13 +40,15 @@ public class ClientProxy extends CommonProxy { public static EnumFacing orientation = null; public static int rotationRender = 0; - public static final Vector3i pointA = new Vector3i(); - public static final Vector3i pointB = new Vector3i(); - public static final Vector3i pointMin = new Vector3i(); - public static final Vector3i pointMax = new Vector3i(); + public static final MBlockPos pointA = new MBlockPos(); + public static final MBlockPos pointB = new MBlockPos(); + public static final MBlockPos pointMin = new MBlockPos(); + public static final MBlockPos pointMax = new MBlockPos(); public static MovingObjectPosition movingObjectPosition = null; + private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); + private SchematicWorld schematicWorld = null; public static void setPlayerData(EntityPlayer player, float partialTicks) { @@ -91,7 +92,7 @@ public static void updatePoints() { pointMax.z = Math.max(pointA.z, pointB.z); } - public static void movePointToPlayer(Vector3i point) { + public static void movePointToPlayer(MBlockPos point) { point.x = (int) Math.floor(playerPosition.x); point.y = (int) Math.floor(playerPosition.y); point.z = (int) Math.floor(playerPosition.z); @@ -118,7 +119,7 @@ public static void movePointToPlayer(Vector3i point) { public static void moveSchematicToPlayer(SchematicWorld schematic) { if (schematic != null) { - Vector3i position = schematic.position; + MBlockPos position = schematic.position; position.x = (int) Math.floor(playerPosition.x); position.y = (int) Math.floor(playerPosition.y); position.z = (int) Math.floor(playerPosition.z); @@ -174,7 +175,6 @@ public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(ConfigurationHandler.INSTANCE); - // TODO: MinecraftForge.EVENT_BUS.register(RendererSchematicGlobal.INSTANCE); MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(new OverlayHandler()); @@ -182,7 +182,7 @@ public void init(FMLInitializationEvent event) { @Override public File getDataDirectory() { - final File file = Minecraft.getMinecraft().mcDataDir; + final File file = MINECRAFT.mcDataDir; try { return file.getCanonicalFile(); } catch (IOException e) { @@ -200,8 +200,6 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setEnabled(true); SchematicPrinter.INSTANCE.setSchematic(null); - RendererSchematicGlobal.INSTANCE.destroyRendererSchematicChunks(); - setActiveSchematic(null); playerPosition.set(0, 0, 0); @@ -225,7 +223,6 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, world.getWidth(), world.getHeight(), world.getLength())); Schematica.proxy.setActiveSchematic(world); - RendererSchematicGlobal.INSTANCE.createRendererSchematicChunks(world); SchematicPrinter.INSTANCE.setSchematic(world); world.isRendering = true; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index f8328af8..9ecbdf84 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,7 +1,6 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.MBlockPos; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.core.version.VersionChecker; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.command.CommandSchematicaList; @@ -23,6 +22,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -120,7 +120,7 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, } } - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, Vector3i from, Vector3i to) { + public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, BlockPos from, BlockPos to) { try { String iconName = ""; @@ -134,12 +134,12 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam Reference.logger.error("Failed to parse icon data!", e); } - final int minX = Math.min(from.x, to.x); - final int maxX = Math.max(from.x, to.x); - final int minY = Math.min(from.y, to.y); - final int maxY = Math.max(from.y, to.y); - final int minZ = Math.min(from.z, to.z); - final int maxZ = Math.max(from.z, to.z); + final int minX = Math.min(from.getX(), to.getX()); + final int maxX = Math.max(from.getX(), to.getX()); + final int minY = Math.min(from.getY(), to.getY()); + final int maxY = Math.max(from.getY(), to.getY()); + final int minZ = Math.min(from.getZ(), to.getZ()); + final int maxZ = Math.max(from.getZ(), to.getZ()); final short width = (short) (Math.abs(maxX - minX) + 1); final short height = (short) (Math.abs(maxY - minY) + 1); diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index d55c9094..e1a2c69c 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -1,8 +1,6 @@ package com.github.lunatrius.schematica.world; import com.github.lunatrius.core.util.MBlockPos; -import com.github.lunatrius.core.util.vector.Vector3f; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; @@ -52,7 +50,7 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { private ISchematic schematic; - public final Vector3i position = new Vector3i(); + public final MBlockPos position = new MBlockPos(); public boolean isRendering; public boolean isRenderingLayer; public int renderingLayer; @@ -409,8 +407,4 @@ public void rotate() { refreshChests(); */ } - - public Vector3f dimensions() { - return new Vector3f(this.schematic.getWidth(), this.schematic.getHeight(), this.schematic.getLength()); - } } diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index ec22942c..3d3f1999 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -1,4 +1,4 @@ # Schematica -public net.minecraft.client.renderer.RenderGlobal field_72768_k # sortedWorldRenderers +public net.minecraft.client.renderer.RenderGlobal func_72725_b(IIIIII)V # markBlocksForUpdate public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag From 60f4e73a76e0494a8d34bb3784f66206a1be8499 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 5 Feb 2015 04:49:13 +0100 Subject: [PATCH 169/314] Prevent pick block from picking when not rendering and/or when a real block exists at the pick location. --- .../schematica/handler/client/InputHandler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 42272785..1a595f19 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -78,7 +78,7 @@ private void handlePickBlock() { final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); boolean revert = true; - if (schematic != null) { + if (schematic != null && schematic.isRendering) { revert = pickBlock(schematic, ClientProxy.movingObjectPosition); } @@ -102,6 +102,13 @@ private boolean pickBlock(final SchematicWorld schematic, final MovingObjectPosi revert = true; } + final MovingObjectPosition mcObjectMouseOver = this.minecraft.objectMouseOver; + if (mcObjectMouseOver != null && mcObjectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (mcObjectMouseOver.getBlockPos().subtract(schematic.position).equals(objectMouseOver.getBlockPos())) { + return true; + } + } + if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { return revert; } From 2de2a26bd6aeecb1cce9f2290cb468961002e773 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 11 Feb 2015 04:58:57 +0100 Subject: [PATCH 170/314] Made all chunks render when inside the schematics bounds. Cleaned up GL calls. --- .../client/renderer/RenderSchematic.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index c13fadf5..4b324378 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -266,7 +266,7 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { RenderHelper.disableStandardItemLighting(); this.profiler.endStartSection("terrain_setup"); - setupTerrain(entity, partialTicks, frustum, this.frameCount++, false); + setupTerrain(entity, partialTicks, frustum, this.frameCount++, isInsideWorld(x, y, z)); this.profiler.endStartSection("updatechunks"); updateChunks(finishTimeNano); @@ -300,24 +300,26 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.popMatrix(); GlStateManager.enableCull(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f); - GlStateManager.enableBlend(); - GlStateManager.depthMask(false); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); GlStateManager.shadeModel(GL11.GL_SMOOTH); + GlStateManager.depthMask(false); + GlStateManager.pushMatrix(); this.profiler.endStartSection("translucent"); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, partialTicks, PASS, entity); GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); GlStateManager.shadeModel(GL11.GL_FLAT); - GlStateManager.depthMask(true); GlStateManager.enableCull(); - GlStateManager.disableBlend(); - GlStateManager.disableFog(); + } + + private boolean isInsideWorld(final double x, final double y, final double z) { + return x >= -1 && y >= -1 && z >= -1 && x <= this.world.getWidth() && y <= this.world.getHeight() && z <= this.world.getLength(); } private void disableLightmap() { @@ -521,7 +523,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin add = true; } - if (add) { + if (add && !playerSpectator) { this.renderInfos.add(renderInfo); } else { renderchunk.setFrameIndex(frameCount); From 2d5642e9205e5c9edfe4c1a1ef6c051abda06441 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 11 Feb 2015 05:13:16 +0100 Subject: [PATCH 171/314] Make the chunk rendering less derpy. --- .../schematica/client/renderer/RenderSchematic.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 4b324378..4cff0817 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -493,7 +493,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin this.renderInfos = Lists.newArrayListWithCapacity(CHUNKS); final LinkedList renderInfoList = Lists.newLinkedList(); - final boolean renderChunksMany = this.mc.renderChunksMany; + boolean renderChunksMany = this.mc.renderChunksMany; if (renderchunk == null) { final int chunkY = posEye.getY() > 0 ? 248 : 8; @@ -526,6 +526,10 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin if (add && !playerSpectator) { this.renderInfos.add(renderInfo); } else { + if (playerSpectator && this.world.getBlockState(posEye).getBlock().isOpaqueCube()) { + renderChunksMany = false; + } + renderchunk.setFrameIndex(frameCount); renderInfoList.add(renderInfo); } From d27e9c22a50fa720968df29855c34d2f1bbd86a6 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 13 Feb 2015 20:07:30 +0100 Subject: [PATCH 172/314] Added a separate render distance slider for schematics. Fixed a minor issue in the overlay handler. Added the option to turn on/off the block dump (NYI). --- gradle.properties | 6 +++--- .../client/renderer/RenderSchematic.java | 6 +++--- .../command/CommandSchematicaDownload.java | 6 +++--- .../schematica/command/CommandSchematicaList.java | 4 ++-- .../command/CommandSchematicaRemove.java | 4 ++-- .../schematica/command/CommandSchematicaSave.java | 6 +++--- .../schematica/handler/ConfigurationHandler.java | 14 ++++++++++++++ .../schematica/handler/client/OverlayHandler.java | 5 ++--- .../lunatrius/schematica/proxy/ClientProxy.java | 1 + .../lunatrius/schematica/reference/Names.java | 6 ++++++ .../lunatrius/schematica/world/SchematicWorld.java | 4 ++++ .../resources/assets/schematica/lang/ca_ES.lang | 4 ++++ .../resources/assets/schematica/lang/cs_CZ.lang | 4 ++++ .../resources/assets/schematica/lang/da_DK.lang | 4 ++++ .../resources/assets/schematica/lang/de_DE.lang | 6 ++++-- .../resources/assets/schematica/lang/en_GB.lang | 6 ++++-- .../resources/assets/schematica/lang/en_PT.lang | 4 ++++ .../resources/assets/schematica/lang/en_US.lang | 8 ++++++++ .../resources/assets/schematica/lang/es_ES.lang | 4 ++++ .../resources/assets/schematica/lang/es_MX.lang | 4 ++++ .../resources/assets/schematica/lang/fi_FI.lang | 4 ++++ .../resources/assets/schematica/lang/fr_FR.lang | 4 ++++ .../resources/assets/schematica/lang/hu_HU.lang | 4 ++++ .../resources/assets/schematica/lang/it_IT.lang | 4 ++++ .../resources/assets/schematica/lang/ko_KR.lang | 6 ++++-- .../resources/assets/schematica/lang/la_LA.lang | 4 ++++ .../resources/assets/schematica/lang/lt_LT.lang | 4 ++++ .../resources/assets/schematica/lang/nl_NL.lang | 4 ++++ .../resources/assets/schematica/lang/no_NO.lang | 4 ++++ .../resources/assets/schematica/lang/pl_PL.lang | 4 ++++ .../resources/assets/schematica/lang/pt_PT.lang | 4 ++++ .../resources/assets/schematica/lang/ru_RU.lang | 4 ++++ .../resources/assets/schematica/lang/sk_SK.lang | 4 ++++ .../resources/assets/schematica/lang/sl_SI.lang | 4 ++++ .../resources/assets/schematica/lang/th_TH.lang | 4 ++++ .../resources/assets/schematica/lang/tr_TR.lang | 4 ++++ .../resources/assets/schematica/lang/uk_UA.lang | 4 ++++ .../resources/assets/schematica/lang/zh_CN.lang | 4 ++++ 38 files changed, 155 insertions(+), 25 deletions(-) diff --git a/gradle.properties b/gradle.properties index fca62716..a9773024 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,10 @@ version_major=1 version_minor=7 version_micro=5 version_minecraft=1.8 -version_forge=11.14.0.1297 +version_forge=11.14.1.1309 version_minforge=11.14.0.1237 -version_mappings=snapshot_20150127 -version_lunatriuscore=1.1.2.21 +version_mappings=stable_16 +version_lunatriuscore=1.1.2.22 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 4cff0817..0b9ba05d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -336,7 +336,7 @@ public void refresh() { public void loadRenderers() { if (this.world != null) { this.displayListEntitiesDirty = true; - this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; + this.renderDistanceChunks = ConfigurationHandler.renderDistance; final boolean vbo = this.vboEnabled; this.vboEnabled = OpenGlHelper.useVbo(); @@ -353,7 +353,7 @@ public void loadRenderers() { } stopChunkUpdates(); - this.viewFrustum = new ViewFrustum(this.world, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory); + this.viewFrustum = new ViewFrustum(this.world, this.renderDistanceChunks, this, this.renderChunkFactory); final double posX = PLAYER_POSITION_OFFSET.x; final double posZ = PLAYER_POSITION_OFFSET.z; @@ -443,7 +443,7 @@ public String getDebugInfoTileEntities() { @Override public void setupTerrain(final Entity viewEntity, final double partialTicks, final ICamera camera, final int frameCount, final boolean playerSpectator) { - if (this.mc.gameSettings.renderDistanceChunks != this.renderDistanceChunks) { + if (ConfigurationHandler.renderDistance != this.renderDistanceChunks) { loadRenderers(); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index e512bd52..4e514755 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -31,12 +31,12 @@ public String getCommandName() { } @Override - public String getUsage(ICommandSender sender) { + public String getCommandUsage(ICommandSender sender) { return Names.Command.Download.Message.USAGE; } @Override - public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (!(sender instanceof EntityPlayer)) { return null; } @@ -60,7 +60,7 @@ public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { if (args.length < 1) { - throw new WrongUsageException(getUsage(sender)); + throw new WrongUsageException(getCommandUsage(sender)); } if (!(sender instanceof EntityPlayerMP)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index f2404ecc..3dbf4475 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -28,7 +28,7 @@ public String getCommandName() { } @Override - public String getUsage(ICommandSender sender) { + public String getCommandUsage(ICommandSender sender) { return Names.Command.List.Message.USAGE; } @@ -47,7 +47,7 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com } } } catch (NumberFormatException e) { - throw new WrongUsageException(getUsage(sender)); + throw new WrongUsageException(getCommandUsage(sender)); } final EntityPlayer player = (EntityPlayer) sender; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 9e89ec29..3a1e82f0 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -28,14 +28,14 @@ public String getCommandName() { } @Override - public String getUsage(ICommandSender sender) { + public String getCommandUsage(ICommandSender sender) { return Names.Command.Remove.Message.USAGE; } @Override public void processCommand(ICommandSender sender, String[] arguments) throws CommandException{ if (arguments.length < 1) { - throw new WrongUsageException(getUsage(sender)); + throw new WrongUsageException(getCommandUsage(sender)); } if (!(sender instanceof EntityPlayer)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index dde58fae..924b119f 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -21,14 +21,14 @@ public String getCommandName() { } @Override - public String getUsage(ICommandSender sender) { + public String getCommandUsage(ICommandSender sender) { return Names.Command.Save.Message.USAGE; } @Override public void processCommand(ICommandSender sender, String[] arguments) throws CommandException { if (arguments.length < 7) { - throw new WrongUsageException(getUsage(sender)); + throw new WrongUsageException(getCommandUsage(sender)); } if (!(sender instanceof EntityPlayer)) { @@ -53,7 +53,7 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com name = arguments[6]; filename = String.format("%s.schematic", name); } catch (NumberFormatException exception) { - throw new WrongUsageException(getUsage(sender)); + throw new WrongUsageException(getCommandUsage(sender)); } Reference.logger.info(String.format("Saving schematic from %s to %s to %s", from, to, filename)); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 22ed00c0..f25e444c 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -25,6 +25,7 @@ public class ConfigurationHandler { public static Configuration configuration; + public static final boolean DUMP_BLOCK_LIST_DEFAULT = false; public static final boolean ENABLE_ALPHA_DEFAULT = false; public static final double ALPHA_DEFAULT = 1.0; public static final boolean HIGHLIGHT_DEFAULT = true; @@ -32,6 +33,7 @@ public class ConfigurationHandler { public static final double BLOCK_DELTA_DEFAULT = 0.005; public static final boolean DRAW_QUADS_DEFAULT = true; public static final boolean DRAW_LINES_DEFAULT = true; + public static final int RENDER_DISTANCE_DEFAULT = 8; public static final int PLACE_DELAY_DEFAULT = 1; public static final int TIMEOUT_DEFAULT = 10; public static final boolean PLACE_INSTANTLY_DEFAULT = false; @@ -52,6 +54,7 @@ public class ConfigurationHandler { public static final boolean LOAD_ENABLED_DEFAULT = true; public static final int PLAYER_QUOTA_KILOBYTES_DEFAULT = 8192; + public static boolean dumpBlockList = DUMP_BLOCK_LIST_DEFAULT; public static boolean enableAlpha = ENABLE_ALPHA_DEFAULT; public static float alpha = (float) ALPHA_DEFAULT; public static boolean highlight = HIGHLIGHT_DEFAULT; @@ -59,6 +62,7 @@ public class ConfigurationHandler { public static double blockDelta = BLOCK_DELTA_DEFAULT; public static boolean drawQuads = DRAW_QUADS_DEFAULT; public static boolean drawLines = DRAW_LINES_DEFAULT; + public static int renderDistance = RENDER_DISTANCE_DEFAULT; public static int placeDelay = PLACE_DELAY_DEFAULT; public static int timeout = TIMEOUT_DEFAULT; public static boolean placeInstantly = PLACE_INSTANTLY_DEFAULT; @@ -77,6 +81,7 @@ public class ConfigurationHandler { public static boolean loadEnabled = LOAD_ENABLED_DEFAULT; public static int playerQuotaKilobytes = PLAYER_QUOTA_KILOBYTES_DEFAULT; + public static Property propDumpBlockList = null; public static Property propEnableAlpha = null; public static Property propAlpha = null; public static Property propHighlight = null; @@ -84,6 +89,7 @@ public class ConfigurationHandler { public static Property propBlockDelta = null; public static Property propDrawQuads = null; public static Property propDrawLines = null; + public static Property propRenderDistance = null; public static Property propPlaceDelay = null; public static Property propTimeout = null; public static Property propPlaceInstantly = null; @@ -111,6 +117,10 @@ public static void init(File configFile) { } private static void loadConfiguration() { + propDumpBlockList = configuration.get(Names.Config.Category.DEBUG, Names.Config.DUMP_BLOCK_LIST, DUMP_BLOCK_LIST_DEFAULT, Names.Config.DUMP_BLOCK_LIST_DESC); + propDumpBlockList.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DUMP_BLOCK_LIST); + dumpBlockList = propDumpBlockList.getBoolean(DUMP_BLOCK_LIST_DEFAULT); + propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLE_ALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); propEnableAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA_ENABLED); enableAlpha = propEnableAlpha.getBoolean(ENABLE_ALPHA_DEFAULT); @@ -139,6 +149,10 @@ private static void loadConfiguration() { propDrawLines.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_LINES); drawLines = propDrawLines.getBoolean(DRAW_LINES_DEFAULT); + propRenderDistance = configuration.get(Names.Config.Category.RENDER, Names.Config.RENDER_DISTANCE, RENDER_DISTANCE_DEFAULT, Names.Config.RENDER_DISTANCE_DESC, 2, 16); + propRenderDistance.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.RENDER_DISTANCE); + renderDistance = propRenderDistance.getInt(RENDER_DISTANCE_DEFAULT); + propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACE_DELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); propPlaceDelay.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DELAY); placeDelay = propPlaceDelay.getInt(PLACE_DELAY_DEFAULT); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index f22540c8..5b261b0c 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -13,11 +13,10 @@ public class OverlayHandler { @SubscribeEvent public void onText(RenderGameOverlayEvent.Text event) { if (this.minecraft.gameSettings.showDebugInfo) { - event.left.add(""); - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); if (schematic != null) { - event.left.add("[§6Schematica§r] D: " + schematic.getWidth() + "," + schematic.getHeight() + "," + schematic.getLength()); + event.left.add(""); + event.left.add("[§6Schematica§r] " + schematic.getDebugDimensions()); // event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index d3403364..0124c37a 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -152,6 +152,7 @@ public void preInit(FMLPreInitializationEvent event) { final Property[] sliders = { ConfigurationHandler.propAlpha, ConfigurationHandler.propBlockDelta, + ConfigurationHandler.propRenderDistance, ConfigurationHandler.propPlaceDelay, ConfigurationHandler.propTimeout, ConfigurationHandler.propTooltipX, diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 346c6885..40514386 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -4,6 +4,7 @@ public final class Names { public static final class Config { public static final class Category { + public static final String DEBUG = "debug"; public static final String RENDER = "render"; public static final String PRINTER = "printer"; public static final String PRINTER_SWAPSLOTS = "printer.swapslots"; @@ -12,6 +13,9 @@ public static final class Category { public static final String SERVER = "server"; } + public static final String DUMP_BLOCK_LIST = "dumpBlockList"; + public static final String DUMP_BLOCK_LIST_DESC = "Dump all block states on startup."; + public static final String ALPHA_ENABLED = "alphaEnabled"; public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; public static final String ALPHA = "alpha"; @@ -26,6 +30,8 @@ public static final class Category { public static final String DRAW_QUADS_DESC = "Draw surface areas."; public static final String DRAW_LINES = "drawLines"; public static final String DRAW_LINES_DESC = "Draw outlines."; + public static final String RENDER_DISTANCE = "renderDistance"; + public static final String RENDER_DISTANCE_DESC = "Schematic render distance."; public static final String PLACE_DELAY = "placeDelay"; public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index e1a2c69c..18147439 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -407,4 +407,8 @@ public void rotate() { refreshChests(); */ } + + public String getDebugDimensions() { + return "WHL: " + getWidth() + " / " + getHeight() + " / " + getLength(); + } } diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 41e9daba..d22af414 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -27,10 +27,14 @@ schematica.gui.printer=Imprimir # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 522af053..9af27617 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Tiskárna # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index cc02c432..952f0a15 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -28,10 +28,14 @@ schematica.gui.materialamount=Antal # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index c7bcf715..ca08eb4e 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -37,6 +37,8 @@ schematica.config.category.general=Generell schematica.config.category.general.tooltip=Generelle Einstellungen schematica.config.category.server.tooltip=Einstellungen am Server +# gui - config - debug + # gui - config - render schematica.config.alphaEnabled=Alpha eingeschalten schematica.config.alphaEnabled.tooltip=Aktiviert transparente Blöcke. @@ -52,8 +54,8 @@ schematica.config.destroyInstantly=Zerstöre Blöcke sofort schematica.config.destroyInstantly.tooltip=Zerstöre alle Blöcke innerhalb eines Ticks. schematica.config.placeAdjacent=Angrenzende Blöcke berücksichtigen schematica.config.placeAdjacent.tooltip=Platziere Blöcke nur, wenn es angrenzende Blöcke gibt. -schematica.config.swapSlots=Tausche Slots -schematica.config.swapSlots.tooltip=Der Drucker wird Items aus deinem Inventar vertauschen, um Effizienter arbeiten zu können. + +# gui - config - printer - swap slots # gui - config - tooltip schematica.config.tooltipEnabled=Tooltip anschalten diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index a61e0d2f..0c561812 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -40,6 +40,8 @@ schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. +# gui - config - debug + # gui - config - render schematica.config.alphaEnabled=Alpha Enabled schematica.config.alphaEnabled.tooltip=Enable transparent textures. @@ -69,8 +71,8 @@ schematica.config.destroyInstantly=Destroy Instantly schematica.config.destroyInstantly.tooltip=Destroy all blocks that can be destroyed in one tick. schematica.config.placeAdjacent=Place Only Adjacent schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. -schematica.config.swapSlots=Swap Slots -schematica.config.swapSlots.tooltip=The printer will use these slots to swap out items in the inventory. + +# gui - config - printer - swap slots # gui - config - tooltip schematica.config.tooltipEnabled=Tooltip Enabled diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index aef81c82..f80dfc66 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Printing thing # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 76b7196c..9e12eda4 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -31,6 +31,8 @@ schematica.gui.printer=Printer schematica.gui.unknownblock=Unknown Block # gui - config - categories +schematica.config.category.debug=Debug +schematica.config.category.debug.tooltip=Debug/developer settings.\nDon't touch unless you know what you're doing. schematica.config.category.render=Rendering schematica.config.category.render.tooltip=Render related settings. schematica.config.category.printer=Printer @@ -44,6 +46,10 @@ schematica.config.category.general.tooltip=General settings. schematica.config.category.server=Server schematica.config.category.server.tooltip=Server-side settings. +# gui - config - debug +schematica.config.dumpBlockList=Dump Block List +schematica.config.dumpBlockList.tooltip=Dump all block states on startup. + # gui - config - render schematica.config.alphaEnabled=Alpha Enabled schematica.config.alphaEnabled.tooltip=Enable transparent textures. @@ -59,6 +65,8 @@ schematica.config.drawQuads=Draw Quads schematica.config.drawQuads.tooltip=Draw surface areas. schematica.config.drawLines=Draw Lines schematica.config.drawLines.tooltip=Draw outlines. +schematica.config.renderDistance=Render Distance +schematica.config.renderDistance.tooltip=Schematic render distance. # gui - config - printer schematica.config.placeDelay=Placement Delay diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index a6832f21..aeca395c 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -28,10 +28,14 @@ schematica.gui.printer=Impresora # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 5de80e0d..7dd400f2 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -27,10 +27,14 @@ schematica.gui.materialamount=Cantidad # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index ae4c2116..0f1c6976 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Tulostin # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 751a8b4e..1f853dd7 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Mode imprimante # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 366371f2..a6818c6d 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Nyomtató # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 4aacf379..f91728c0 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -28,10 +28,14 @@ schematica.gui.materialamount=Quantità # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index f4ad7a7f..ef761c8b 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -42,6 +42,8 @@ schematica.config.category.general.tooltip=일반 설정. schematica.config.category.server=서버 schematica.config.category.server.tooltip=서버 측 설정. +# gui - config - debug + # gui - config - render schematica.config.alphaEnabled=알파 활성화됨 schematica.config.alphaEnabled.tooltip=투명한 텍스쳐 활성화. @@ -71,8 +73,8 @@ schematica.config.destroyInstantly=즉시 부수기 schematica.config.destroyInstantly.tooltip=1틱안에 가능한 모든 블럭을 부수기. schematica.config.placeAdjacent=접촉된 블럭만 놓기 schematica.config.placeAdjacent.tooltip=접촉된 블럭이 있을 경우에만 블럭을 놓습니다. -schematica.config.swapSlots=슬롯 바꾸기 -schematica.config.swapSlots.tooltip=프린터는 인벤토리의 아이템을 바꾸기 위해 이 슬롯들을 사용합니다. + +# gui - config - printer - swap slots # gui - config - tooltip schematica.config.tooltipEnabled=툴팁 활성화됨 diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index fc5f3d85..19b2b8b9 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -8,10 +8,14 @@ schematica.gui.materialamount=Numerus # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index ac4fba68..ba768c1b 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -28,10 +28,14 @@ schematica.gui.materialamount=Kiekis # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index f524510c..335a1166 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -28,10 +28,14 @@ schematica.gui.materialamount=Hoeveelheid # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 06405ba3..fdfbcf80 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -35,6 +35,8 @@ schematica.config.category.printer.tooltip=Printer-relaterte innstillinger. schematica.config.category.general=Generelt schematica.config.category.general.tooltip=Generelle innstillinger. +# gui - config - debug + # gui - config - render schematica.config.alphaEnabled=Alpha aktivert schematica.config.alphaEnabled.tooltip=Aktiver gjennomsiktige teksturer. @@ -61,6 +63,8 @@ schematica.config.placeInstantly.tooltip=Plasser alle blokker som kan bli plasse schematica.config.placeAdjacent=Plasser kun tilstøtende schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilstøtende blokk ved siden av dem. +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index bdb4726d..207f77d5 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -28,10 +28,14 @@ schematica.gui.printer=Drukarka # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 83acf6bf..465c8cfc 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Modo de construçăo automática # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 359fb97b..63fa3b59 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Принтер # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 6dbbcb5c..73954514 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Tlačiareň # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index 2b7865d1..6e7336b6 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Tiskalnik # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index b770ae87..3649985b 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -29,10 +29,14 @@ schematica.gui.printer=การปริ๊น # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 4f71171a..3982aeea 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Yazıcı # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index fb7a3c8e..478ecd52 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -29,10 +29,14 @@ schematica.gui.printer=Принтер # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 39e0c564..f3e52005 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -29,10 +29,14 @@ schematica.gui.printer=投影 # gui - config - categories +# gui - config - debug + # gui - config - render # gui - config - printer +# gui - config - printer - swap slots + # gui - config - tooltip # gui - config - general From afe03352b0b60e2c464050ebfa37c088d215aec5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 13 Feb 2015 20:16:26 +0100 Subject: [PATCH 173/314] Requires a restart to work. --- .../lunatrius/schematica/handler/ConfigurationHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index f25e444c..54dcd375 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -119,6 +119,7 @@ public static void init(File configFile) { private static void loadConfiguration() { propDumpBlockList = configuration.get(Names.Config.Category.DEBUG, Names.Config.DUMP_BLOCK_LIST, DUMP_BLOCK_LIST_DEFAULT, Names.Config.DUMP_BLOCK_LIST_DESC); propDumpBlockList.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DUMP_BLOCK_LIST); + propDumpBlockList.requiresMcRestart(); dumpBlockList = propDumpBlockList.getBoolean(DUMP_BLOCK_LIST_DEFAULT); propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLE_ALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); From a6fd67050c737bac6c417664348aacaf0c6277e0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 13 Feb 2015 20:17:36 +0100 Subject: [PATCH 174/314] Replaced the old logo with the new logo made by razarosu (MCF). --- src/main/resources/assets/schematica/logo.png | Bin 29678 -> 27272 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/schematica/logo.png b/src/main/resources/assets/schematica/logo.png index adb09068106aa0e0d7bad9e258ce3eef18b844b0..62601b5ad9c56da77c09dacd79edc9eb7dd2a5fa 100644 GIT binary patch literal 27272 zcmXt9b6BO{_s!jGO~z!~=H!|%xo(wr$(?@6PA@{Qjx8-lwN~&OT@F zwbxoZTuDI+3H}Q_7#J9mjI_847#Mgg=s5rY1Nv&dkbMODhUX-q>7;6F>f~zZU;-v$ zY-?mfB4cf6W};$ZXzXr3Y{Cx)WF7n-N<;)w_4{Lw^AuUb&aig`p3!?Sz7yI!N zn6h|8yP-sXyg@jUeAIMb9n*p)hAeu2gi{G;1m8X?I$HT??v8TY~Yvv7sKPtppll|^M^lEr|7kCgpmksDgu88 zYa=XNm^}GTD$5hCh+4qc_2d1D;Q@ETZl+4;cLE6OOyDHT!b!)j9QHHB^rW;)=PpAd zBM>=@u<98}8#(at=6Q<{N=mUP^Ya{M8w7X?(tW!IXv^a>o*Lbz^&;Hp;8fll+e)c~ zvI-PSj(wijuy1!A-*=VG55GSf`GJ;KG)ZrE5=;(;3Xl3Q*07G?ssAZ0QdG^QO&D-w zGw&(tyqtfSKEmbumy#?(!s)t`^?zG8jT=oXb^LA3V))c<+c~(sBFAw2c#d2FTp|u@ z=)&v4Kv5>gckV)uufk(=kV*UtidA&p$Q5NG%|~tAR_I{%llluXLv` zy6d5d*sAIi6^uQ~(j*}3%V%9@?9Eo=JvP;FX}oQJ74oPzom{-6$j{^L-eH#V`d>5^ ziG=|sIQFPerK$R?2Ln5L8bSv{Hk$(Il&Bg#!kd4h`XC(E;1e_bzMw#aa|W#M(_8ah zr3;y+++``%-;Q>&6Kya{#bFqref>x|{1@aLUccgqfKNZZqAJT)y%eDnnx;2OH7Hq% zH2^EONa9&)tC@Z-Ah+*3Y7({d0t`Gagb4+w9VQadk90meVbf_GHcQuWPnM5D<}&Bt!w4Jt*OBh9O1sNsWit&Uk8#z8|AWuL}m6qp&2`RoMTc@%|kQ zYEX08RCsErf1q)UKLsrbT@W~6sj7f$Y{Xb1 zsRkh)49j0yjT9|PnMAo;RcWPqe3?rqXW3@!>tF+uci!<*MStRU!D6q&e;0raLAZ*E zf&kus^cZszU*MueygPQ#YkF+sULIW<0vaL>tihTBUAaoD+7{wfsw@|P4F3fiRpbw| zut@OKCK}#%GC$hoBNw=;A3d>Pe0@7;N&(1K##z3G*SS8uT|BqV0|E#>qf;S)fPbsX zatDi-?juDH7kNb{Y~{b(f<)1G9_MJZTG9o20}s9|xhX-kvJvyEKssJSKqD!c#EOwY z6T*{3KvUowfx>^Em*?9;jvyptMnti9?s~$~s?(-{V>GE+z2&spH`#vvfNcv5HXEZfX_`7rv zJt_)eV3VtWxc4jRPHA~;SvJ7M6~Fyf=*UO-G_&!?caIfryF%Rmaud%m<*nvqb&pf|<>lpu0y=E^sS+{1RC{gGs55N@+sR)&C-SW%c`x0x^@a3( zVj9ny_E^v&`G{g+VEg1GaI^wGn3%&O1xkCVU=j2pqS&O^Yp}|fTGHaBG>-Q9ft4Cb zxZS8r!w}*!-;eKq9PvEEM*Wu?66;pygG7EGv#39!F3@g&pGsEGfC1I(d@fX<+T9K6~b z^M}-6>t)Al+)r2eRt7%0)%3n!d&w_~;|W=|4eW9_uO7@+4W>uLP_G8N z3lBs?k}BS43{WE=;Scz&ST)O7!a}~o6WpUdl>a_tfaS5t3w81nwxfe~JdCDp3EK&! z+C@Hh8S$Wq3$6IC80_s;BSUm6p;9OZj54;Kz39K~;KW4Zvg9i|TJ$)1#5t$>iA_D? zK%E!WdN}zBz2##eUbbRwJR3uv@lQd;t3k9%Tc zXsI7FrZgi)kk|TpG^oh^6_g|vAx31t$^WZEU=VOWLd+>32>G1PoCXP91-%XlUDwhx zGA!AYkzug4Uec<#IId9Hx2B-CNDDuZkwY;mI-HpAj@6-vCq9v}EBL{jksyqlvZ8)a z1Ym91azk_vXnBAuW5WQYjGxgAW-c6b)S!)iCYGgj#ee-2a4_GTLq#QO+5x3O*w}<# z-kxoeuzU)+jaoZ(o3-65|Q?JXK0(BkAb zc){o=^8V1{iSVm?phhdqtx>e65pw4m;Czzb5mQ|Ig~J&gf>bS>1D)d|5DdyJbLku% z5{0PcfB%!%oYjOd&kn%rWWMQhGPg?H{?Kx2Q^<5a-iQ$>2zlQlemA<3G0=eiC<6x3eWr2fBXH}16AHb zi;D?t@t<@>#t13q3ueoWnGHbQ#vz@WCWRks_4u%jYh&%1u%BxO5)m%iRQ> z3p3VLm=J@9Estl*khO3VLvE#R?mq2>btI@tN$Ldn*|#VAxZrA@nvx9+Sg%li6`l z*t%{QO6G}{aZ3nz$}1^>Ba34Ol5<~X+^i;gez`y0x(!Cyp4#q> z-FEUD-v*NiH4@~BY9voA*`k!RH_ zS~)L*r!Jn5ws@%viC6KvAG9cBl24xFsn+2*XQ!j7j`zCO3y;0z4BL+S;^HAg7@Tft zq^V0hJOw)?W;mF@t=s3^ii%&=7%8j$zfur^KkHj#Z^i?VCBU$xMh(HCe_EwOdqsC=WEV!=9v`cq6k3{bo7nwlZk-iE3cCl(Y5rzc5A7GL(hQh^l=t z2#fE5kwufogN9T-b4~OvcHpo3mIN%Tz}c+Tq;T;G9fyxIhoX<~`;~W6_CHkn4hAL? z8iA$mFAVnWo9wsC=GW{{+m7dh5}5@C~DFPQ*&D%11rT{Cbgi8P! zQH+#E%{*tHnyWsZnTi#1Sc*9ce^T zaBZv%YD+mfg1UHs^W;d}fGaNllqD@SHPo1xpX`L2`O4hRkt@)UQdtF61$JG zk0FDrH{ki!aBw0ElN~DAi%X6|tCp0nf|j`<&oDsFH+i{UWzK+;9??iw2 z`igf=Ki|)&cC}k(vJkze!!7K;a4E3*ZH@h6%;HPga5!Z^QEaz9DR*~w$CKFtBZWhy z;YO3IjP9$uj!DMi+Hh@NGpJvoX*GxF+(e0vmdE`5R>uE$8=NDitINR6R_E{oMiEn* zJ+!hWUaRat1vB{GjTuV0nq3288bS_7HVzo))^tJa* zx~l-|mJ7kc$~{KBZ0+(vv-b}t5(`H}z_$urbwOTk*bfqljSU%G?30)#lbRRSio+rr z1=S<|=|Nu=XR3y-S}s%4)Ew$jeSJ6&{3@H$6>`}DbVo`VL`ugDPlhuawo;R)+`y86 z4jx)s6#*Ana3owh^}n6T7|HifFWM{qR85AiUeXL$6N@>%eHJO`Vzb*?#t9N7{X7`Q z=YlUP&W}(l4Hms4LV%wT^xTTAw_Nnr*4N)OuU}R1W)SK^l@1?S#sHmpg_ta**ZOgb z%PN!6WKskiMq`sE15~)~J%{md+k7>lV_SUNuf8O)5Gd?W@Q88c`i;mN9;XaXC#983 z19%mP4bc?l?r39GyY4~+Z_S3xqe@yfYV;1^>D7< z_9_HFfA-8P7n4tE91Ok@3>?(?SOUffuo*ptWpBDxh9VRF^}esy(97Yu?bV>AiS40Z?mcJ?J*YSj%8 z2};-u=)&-k5femC56h7^H@7!fCt)mOfpjlurM}yVPkT{He6+oACM>&1eY z-q59w8bi2b*9Cg_afEP{jcc35VTwqhVWaoSTnWnO+o4d7o{GwjOhEPrZu%ivGX0O5 zljhF1eZ|pEO+n(u?uln}_6J`Gz_-F6QIVsiYT)st&qHm|F^_GJMeSV?5cvXJNl9Jk zV=rOZw(a@=0iWiz8@{gXO$V6-bg21m!3%P8?Yd$~19A5E_i<>suki0Hci{f`&lfu4 zq;mfxL;S){O_Ml8pv8I^hfDwv1O+=FIL8-Ro72`v0WGV*UVt7}gs@;W$^W;l$k*e+ zu5)IcugBv)^Yism4VR_fq=#o_g3voE5{3Q&asme0Jd`DcQT$=a?X#yivy8q+A@~*e zmNFsXQShw2SyXWp?&Z$+_j!$*9!-iJz#@*vd7m7#wGJc1xqnMgB!4SoKVGi4 zqC|BX^JmUCG8w2WRk@KNdp@4^SD|`6uDh1~Uf;GWs2q1T^{@Fl#L0TMfuel*I(37f z#gRODh;p{#dS|QrIK(9YjRS=leBnV)~UuCcY{;V&4tmdQ5E=?PaY<0dS152Y^$I7{w zf=jELnx+``hBEz}|EmW3Lmd|%RYG1nqUwYSY%JQ~Oo)pMWk89O)#8qtnwH)ezClx$ z!}r6B+vN<`gixVs2N7xZNDB)2cO2pC*Q*)C9~e-SI_^Mj1dJ1`qOj>B46T2i2fC-Mv#IG#kuOQ?FJ-c6=P*FN|mBQH|8!=)~RoGW&s*kHCuoMc_q; z`0YR}sf;Wpzc?IS!_bDel&Ko$fk4XY^$9sPUr5{8osLVa)e;3RB#$0lR#NNk3l&ku zhj5Nyd*n<>(DqN6k!A#5;nYG+xmAR|HU6CJ!8AVCiyaMp?|YQxxonS<5+Nj9=G;;r z3h$tb3D)@9&Ed!A_dPlz6*BDf;5y?M{uIU^H81m^&AB+O?0DgilNP^j#tlJ?{coKL zDOu*d{P50}S)qT#bss*8k>K`;vyYEuT4 zO8MCO`3FC{Dfz_-j_yy@&nW|fFXvOe(&HHfc(=jw7F^h7=qb2Fzx z}M6=4O-JY zs^Nqc3eSZoGUc3JSYV4|v0Vh#6ec$>sUBS~*R}_BnX^&-lqBPFb7O^VLkQQ$mNDo{ zXS*xZF06eS})}~#sAUl@HN4%ak+dYmdX);AZFw-%m@+L zA8~WS8GB4qO80lM&-hyLQ2&1HWj@12yrz*L7X3_QRJ8kP-x_L30y@U0ut2GR=VMRia;@R+ zfPAxNlDe)MG>#rO_5_|g@*d6}RU=0Skrt<)dHJUJDPS>vd5AO0jlU+ITNfIq@uw`|F)sJznj>ijuWjAK zx$O2|y2^kF-IlH$iAaOTigl77?0(D-IQDh)5OCkZ44xU@b(wL)G&Iycfp1UOm1AyR zlDZhsIX`3_3=RS=4KDpX)Z4#)9XTVH_2&BA>DYWP)2PgLccUN6+PdG~>-qCXvV}KB zSY4eH-#kg{BIE0UDv@A6x{3_CBL{ZCAm}{9IUbA!gJ3s|5A~Q^Sq=Jz=cT}yMpu*U zfJly>w%d1)-6|?)jK>|b|Nfc@(6DJqwz z4y`|Gh%j#ag;7sVPg61ZIq!a?-ePSv{jB4imEMCIE4unOn`dcr}ts=P$ix%W7Hu8`6FE0cS8#hInUtFx5oSeK2m-p4Q{|Y3}%k*n| z^Wy$|yWRFWVb;dNBE)f_7_LGRUTv^897&{^Dp954oPFEM3mmgI@`1vGR)8!kDS2)K zzW(xcf6TeO;3N}X`Kyz`;h-Laj4JeS$l~jHkta0}g*Q9uB?$ClFf=F_#}|o(HxQ&m z_0wdROjG9cWJ+_CZZJ$;60MD2frLfrDa!GII9>D|1VaHwxaD<|2mE#Oc6--ch#WI} zI9skVdn9T)%8xYY>H@cVtrKr!Y0zL^QffhFPG)7&Z^&fL;*rBg{Cc^2o%#hH*45H) zU^)r2x&vC{e3NDD(^l?BQ|I%$I zMN#f|si$JZeylNo7MgO!f+%5}r@7h6Es@i^F=+s}13>1avOz6{y>T zabO-r>w2C%0|m{2-y?%e$Vbu$`eW+gvT_6DuVmujIL`_HY9N#GV+IAE zHD|2TlphUNctBFk=nyL=^ymd>u{?pY8~ON|Phrd<#XsKqGi{Er@U8(}agnQO<^eob z{pakEfQkc*a5n+x{LZqnvNwyTutod=3lD#Kgodd-|@jNxGwFC~uG4ZN^ns zbCkvn7ksDF6{L^rN#C==iT7&TMXy%msCzf9bWuN0yHus!>GMvM%>o?YP8oGx^0R-QcJnzwsy(hwR!?`Vl^OMMG z6+GHybFyM;U@)_Fnhd~A$XoI7@mP%kKnYVa2+Htea;aZkR5@M{rwbJ(^FJlckz;V+ zVPZnWwjJbh@ge>b3l?_3DcI;RZqbE{cP$nx)~mH`n;Go()ii2uW(x4B260N$S7}Lx zsZ~0A`Fnz$oG%<&%P!j=^%@pj^JF_SGSBLM&Qh-XyqJ|&#x}C)7X)M(Ul=C(H?R5VKwOmP7 z_G9;5`!0x69T=W30VEg4_vpt(5V-hwf6Z%agJ`f>ABaF~alRZl=)n&eelFK;>^b9c zq+U8RS}};PSPpg#?nmerwqx=>mVjB*c|sHOE%JgZszu5F&0#|G)=6e#mUtcX90Nsy zd)fFc{yrqbrUm$Nmm@S&ssA~%ONe-6SYWEAFuczx!+G%4lf+4i+w18H`Fyp}_Z%b_ zd`=xccD`h6@~ioGx}VoCIzW7M33R^9SK5G@&2qM2Ldth)BZ5_a*Z0l!@MKw*_+tPW zw0@ywrEi+X8GOVBt779@?lSbonz{ z)oQl6Hv>TU39<9}z;db86(y?0fIZW5gGWj8JK$QAK)q56DQ6-*_?cLpfwJ0L#Ii=* zR7~;W_SIzuh*};K;_C;>R1f3>P>KZ@?fRWQ>(mHtJD>(VZO4fhn(dUiD=;=OP~moa ze3IN8@(*I1Yb}>J>|6g0Q^Q1#(C6fwfF~0H+d%)3(XZV8}(xyNTG5oVIYjg zO0+|1DA#|Z6FZTZmmrBY3wk95+?~v0NJh7S(Z;A%Gvg)W??OqQg&MvSYwfe+vtq%8 z?$=u`=;&(bbK&1|7T}5Qyu~J@X$pl$2Yw>W#i_bg?EYFW+_f)Ny-{td{M_Q+qjJzM zI?}lbWw<#OS=R9F!GYyeLX_-Pld`K>$SGu zmtU6NY=3?1(9+h%DU>U^dZLn_X>CI~04~U|3y)C*S{j><#cR5CtgY#EP1hg@=|hdC zFagJ7x!JPz`J5_qFk_+0kCj{D%G%I>aLYj=m*c4X6C>{i{tPNFcH9SX>5ZSr!VhQb z36DFnOx2XlapaQuoa*UyiLqzL3%YF|vbVT2Ms98xIznqDK+Qhl?crn~hvkCt zz;5^$j@M-G)AcS*F(R>_mZG(pV?k7oB*lo*-eV#VR5HwJ&AR_4 zm1?S~tE*FHd^M`V`%T>E7EMB$5QN>MQcr{yH%>V%dAVaR@xD@LDvP99t%Yz)lV=wj zE~k*r4mTn2s54;7>vRSHVQT1BUw+sFi>?9~0z?=TDx+&4t_wywgEp?Ve{$M)p{#MO zHyxojZlNTzC*a2Eu~*3WZ9D_E@b@40#D6Bvvs^b!l0>POH~z@u`xPWm#!}kT6{IYn zcN>6>_sB{DD8B?_(P=RE>+z#F_BcuSY;}RVot8H)KZ1%fi%epo1LL%rCBPtrLK>dr zi#I6*Bop{dD+4oCwZ%Q{LT&epaS}1T>~0^99m5B zK!aukHTfE(0j=-(k&+{r6j(=VB^Wv$$56N+F-PU*BflDll`~)#Z_(?Of!!mc%cl0U z88tu+_=;Y0h86sMTG*m&sO0r575$*?Ee=#TKMDPmib|UJ84sL<^q+VL=qmj{H%jbM z&|5PnxEYQKOOTB6xx}fQs<+Caq@p7Go_{Nr=8VAAbImG|?kN6(d&Bv9N209Pb0;XA z*+AIWjytmip3Vr_MuZl}Xlzqjb$6aNy=_j!_jzA~*>=NAz2bDj4&;`YzAt3Y8!Y$@ zqc&-4F5|?x1c!cxI0QgUb2mm$MX26l5my^EEQSEmM-Z4Hmim5v*xjpXh!ss_&D52l z*72%f&-}5*KN8EKaXAID632vxzX_8xVN7OpCu>VHYHQ6ugmA!jvF3C$LD;(-(Fl*j9K4~_|s!e zF+polRBNcB>dvJv49#x%Yl?6v@;Rxzp|Z4RHwb}+SEIp~oiuJ%WOrIFUL4<@{{}2P zc`?tK7K1X9R4@liwnw~Oess_$rRxpxS8m0+<5SqoQ_sie%?V%1wG?H7D__DvFM-eP z=8wgxahZE`WKf@>%Cqzjmr?BVf(cI{rIy1C5TWQdb85 z&2=Z$6%GcnOanp$?6B(bVm*V$xjQqK<%XD749y7}JsKoEN#S{MdUBr8(*co}EF23y z+B}9CSYeu&HnPhv5h_25_TY#;JvPY>Bas&XhD6&38v zQJBljp7xUaM?a2!S5Gj4<`ClKPaOR>QeD}v&Qhzp|H(KHTsd^7?(4&c?yd^0r}jqR$yPDnx!ek0wX$CJUt86qC{HJ zHT}cr#%-}e7o-_sjuOxyG)de0=V9B~cp9$m*^{g@ipeXGmgUAxi7JF()!6{sJQOpCTuuXISr zJ+i_uv-k--eSNJNQxjl684do$FZJV{Ff+DHO@0%Xh(wtF0ZQ^VxWU)UR zzVj2>3XKtZ#ziLJ2g6{@>M~xp=9DMuJH79@VM^|e?~g3mwKW(MolEF08A=#2-cp+e zLsvsE#FO_TJ91dI~bW!56?&qs>aw zam&fh-=D5)?uVDQO&>336Im^(nQ!*DfLR#gKL>HCj+`{X+Z*kkjlSE#I3ErZJcm&} z&-`n%PNK{5`n_T!kfA2jdNPq0@~ZXrSqiBsV$s1ng79?yR{A$6xk#N{fM zs)tcEPC;0G&<;f|l^Hw)34egS4tq==j85IF*RRVu$l-2A?~jpXyrr2~;hh?fO-vq{ zi-HHT1XBvu9naa25vu@EasJui`{QO{AZ8mQo)A$)q;_w}B`2sq5e$SMt2UsPt0|zZ z#+w^yaWbc0&t8PION*rf!9-Q5EGl3=>5)6q6rp>Kr#37$Wdftcu4CFlQtmyFTGBU!0*Qz)OKmg9i#8eDx5S;&TFs|;t#})u%KR%eSv8Kj>%KP(pQQ!AH z^6=vZXEjCN2g~Gkhe3=Z6`c*#3i}>;By^hH!C*@soE3A z#DlFE`|5pP83zy#2ka2N46_)gkSzkRG14(WD?B&dz0cx@`elux-)8wK{&;5JNRY5puGX2#N z61pu;?hoT!n|*$P)?HoxJhq+pE>F>1dI(7=8biqNB(x8DQ}6bsp3JC0q+%i20>A;_ zWR~ki^PxeHAX;Q?Uq@2#)r{w$s!4wUkz`<9g%3Al5tZ-?l<4~+94DkW?zhilu}*Hk zf*$dn6u|+;+NP|cdn`k$ zKi$NY>=iS(%W6X83+jY2^xEDZR^MTSvGxuTK)hAh>D%o@bvsC*$Wt^Mk09}lkleLG zT}WjCGJehyf8HH_K)$&4Wycs$L+Rz<x2KCJ%<(e%%4<9;sO9kIl1rKF__OxQEV;H;1dM zIPw$S*$a;?f7pvp6HtR*W5<`Nz0sm(sjlRwk92=8SIk037wMdc4@CxzE9r>%6T8a- zhA37K=6xHMxNAT@ql*7oi7b1`vqp&E(}v6t;ZrV$-g#NoRLG%Y-?;xk(WG}>vHK%o zavSdxQPHZvTCDfm33I2#X5Krry7~(3=}9fbt4j2Atp_v~wH7&%=UXeb6V7g?wkW|LR5&33_P7RPU zcCzp1Dyoq6w5-OGYV%2}6v{8>BUqbd3pZ$@DqzY}zMO5mzq;E&?z~JaEG%eDdZM<^ zkJpQ_u`zU&E-3oFkZrp1YnCAoEsIl&9~gOq=Q1O0MFSu4>?S~?1w^*@$lEoRqPyWi z;@$^BK21@9FX0#Yldb-X-5?jozo0q?nc#DJxdu)izRH8(lkGi7H!lnOM%f*0+*p!6 zJY-lEuOrZDD0c%?A;tv5w65X?f*031?;TC|r)7^FRyMz+_uhHkKAf-el^5u?T9za< zl;n?ynj@A)QMBa;*F`ywL^S6k%!sPzXID;7m>CL?N&OCi>WVn)7|7fN)pR;k}f#nkzBGkp+OOF=_a!U1jsVBn%kabDgXi~BP`d2$7e%}PK5 zM99!E8C7(ClgUhNeMGzBwBG1T9o+7fB7yY$adg=xc-bJ%uRx$MSfbzY5jK(|WYF)s zlBld`w@>|+IPtD8c=&0XEKnp$__WD^p3R7%Xb!~Is+q%XWc=7~uwEr9t*EHzOX{3X ztGKrdYpI=0*v&`NLyx~9u?qf`wSM$=&x{)&MS_ZWx!!qM2?>jwYQHT3MA`iS^^qkY zDd^N!Ds7U9j;{0<$!=8@r69v*UT}F`l)o|_CEx{92t*pniOPNJLXZ>TLJy}vCgyo* z3{PP6-5cjZ6>nUd8v+4JVb9Re z^ijbxl(-8$eXTtFl6N$rFkW~?i%D+VkxZRIuAkQ^+$ws%c75@{27uM#BwL&Q_^J&9 zDdM1p#WD>MN?sY0jE)tL(`pG8L_4p@W^F~q&&(LgZ86174ORwZr%W9hrT)43xy`7Y zAOh~6)J;bHT}^}7%EH3Sa0H2qp2gG-7c$vSb2gf5gZnWdMriq9^YHbD%+KLMya~hu zW0T}n)VmJM=qz*EddW>dm2pd+naNN&7boY!!oqwf_ijq(dtHIN$QpngujV!+JDDYD z1S|xW*zIb?^P>H6`s099gMwpYB=yjyfKv{`bJ@MNwl+<(AO|8K**K=ADw%V4t&WmS z8D$MSVV}A?ApYx;ADqV#69K%M%GP=`9|tFACdd|6J6nD79L~9xHTH_`lmF;kGr^Gg z^U*o~koWf&IPfU6QY}4@b7C9c^>W2|@quu)$n|_?-?VYmBzzQ89J6O{0O{G$Iye3= zk3%~Ig401j>GjP`1QSgxzw5g5;<;?bN2r{CO|&_CfE&6GsAeyGoa%qB@V?eA&#olZ zwKGvsF~R;eNHw7HAR|KJn^ndcflu#)N64GD6kYIFw?A9rObYYOzV5qR0Fn*ZG{)Z< zyVSY}dR!HbCi8+&FyH$%Rdy4dkkF=NlpuO{TWM^1c>bYWl*kX5(Jm$`Xs|PKxF<;N zT>{ZOW)n)HD}yvPI-)5?$V&u{R&0hB0uX;c;-C<9eS`>yf)9Xsob4QD$r$&U5!$4( zC)@UoZ^BAfeo}R>nEgq0+M$*Hp8Dv#w)sSn{psX`Joz*^00$`@((A9FAY3hiNp!YS zuH8;gmAz8qetI#H#U~)0Woap){Jmjdy+8)wV4 zW>ZHtTre^}!l3u(_g&7v1#qpqk&DHF$XHhK&g|3G%FAQ}>N_|4(w%P2n#h|2z?XPs z+D!V>c>>-CBa$it0j=r+HT%}j=IsIPm=h;RD|J2@?NW+_gO$yXW3z0V*}ug{;jfpS zwkoEk$qnJue_l9(FsBGMzcUhCE`?LV)sKEB6V*ZH) z@TUvqKpA%`?@fL}wDHq>o5=orv^WmoZw$N-uc~|+vhEdau7&#oIiLE1p;U+@PKB}{ zwPhERnqD(LLdJ#y}VyS?ij&i-D_fOKAGBk6pMb|JA8^b(K+ldEtQ z?7Hdg`tc_kzXY<}@X}H~qSy|9u=1!FK@u8dP@$#570Q&%?d=S=t2D!V_FW3JHhNc z+{i&n<+txq#rZ|Zr-T{AZY5oVg6)7I_e9RTCap@U@NKN9q3115d1ZBJ4yxNPXE=Xv zf4_$DBS!EI6+|kJj0B_!Qyhg(OP%CH)NB$jG2%8Ss1}4e*HEH=P<@i-gc)6+2rT|Y zuFgz+wea6=B0ld(e~*@tZL6GpPWxn$_mVdr{KfhSV(%d3<)bO`%(wF|);+sA zKkh5#$t8ca9S+5j+lKZU;;C72eATtC$zcJM>}dA?1%2c6!;kxPE=(;pz=x{T90%z*A<}}Z^2J#qmNJL@_;3G@B`*Pyturg;(Z*W^W**24CM>@0IL>1@&s1+Ah6FOAuJaKiNyi$DC)BHIz-mC zd3QpCvE^yUUs6bhl||u>R4qhf@evbHkhBZ`^UK$OWjZQCK?reBs?4n_4(n*>{dK;& zUEcXg$Z5OLQ`fJum1m}LXF6m~adQ9qZUTdWu1yX3&*Pyut6)w9h@3nfsXT(unm~NL zLhEI#Y<=K8Emr=WTOf{4i4`s$R1F-|%gIV|?p!@*M3(6Bld(OS+kXjpdHkc$etwT{ z)08)Sru4fS_iVWyU%f($CZ*2uFoW4%WleLNO5?uecCF4m;p>-hHyC7sBjLkHPVbky z3lkHQSsJ!4(ezMwQFOh*z1a;IWbZ#;0%OWxXRj#JAc&p2xJ{E038v^&v{e4)*GiWD zElb=WV)I&AKW8m!wQXCS<$i!4qNRs2Tlq^6ZxmyoQzRpka_kZ}cUn+^C4+T>{!UDO z=ug_9R;u0$OFU+*rI)J1b;BzTOQR+Pdk{kXd!@~0y(JP;qM|o2mop_l^JQCwiZ`yx zee6*jZVJRT@&qqZXXd}YC|=wbdFWG}rYjzLXH87Lbw(4_NrN4))MxAuQ~73jgEW|x zv1`}gMTR>C;eki+?vge(7qRB-T4Il$+wG4VIp;3TVf_} zmwlOywV-07N?A*Y;VBCHebzSRn1`t-ZNEYjXv&1Z-GjEMM~c`tNYS-TA)jCFGi3Oj1_dMsxpry*o!!z`?sRo?80l$bgxuDXmgri5DAV(Mn^H^P{N!&G-j|`8%x5=yUh4MMiGG1=Eq+#D&ML; z{b~bgf<-xwhoT)l){qM|Vr&wpf`-{1ktOL^S^xgVsO#sUgb25p2$jU4m&CO+-TMA2sAv@xBwc3o!o#5~zYavqn;|Zd3T-d}x zvpnn`_<4W+!Z6EGhOg+L=re;~L-8PgKzsXP0%&o?c=#EM95#4*$vT@1o}N`LUEco| zshw}2YIH{y4r0<*%QFXF0K+A^lGBi;Wh?!!?p*_aOA!xY&L&8QthE?Oll~bO;0kVV zvJ?5b-txkm%4f!iUtdZCZwcnN&2`(4zs;mxnY=1o0+A z(6Iz_%ovvZtri@dcLjlka((YxwT8*V&};$EqOWiE3*5g-tj&uTVH6AjNbjr`h9%rRr#7?(TxtB>s)c(Zs>MmQVzGice`B|AkV5@dDi(??5IQ+J6qjq5^Iu%+HDOrIuX5MoxnbXk!lf8mylvlU5Z zHTQp0CW)y=E|21{PKHjs%Z^fO*|47I(Gtf`iX>(5s{Hc@o73tE8KmL&-u>08r-c|1 z&UH+gK;*Zuut;r#J$*EQZ~LOuzsm|Ffs@F=&rfL=t$9nL=>2B0+F)w@cKXbBf$in0 z>8FXJG*?_WR+tPS9c80#jFIOZk_0X<@D~M$$7-VJevP}=$QW>h)hK+n!q+vQhtZTC z%pBf~MX0i(DOVcF>(RzES0^eWK3COKz|G1wW@un2tWvLGh6A7l*~*=@8?C$}1Wy-% z*Fh2QOcd`i!{0prb4*A;40VA+Iz~iBX8l5>iu&RVp2>DYz{1D3`fn0QqA2B?TT%Ro zDLtvEg>dP?9S4cXVYqOBQ3Oa<2p-qw6w|fVttpurg2u$g76sWU(kQ}6pKX{4`7tPG z-!X-aDSwku_Ns}`n}%;qxp-R(g#yy< z2uPuGN%NT38B-{PVFaw`c;NfhK_EOP;Arl(oA*Z4Zk66ZUIZXpmVv*9=NKVwu)b2y z?D=4Y8Es4!8Nhgt9@9^X9T_m21g;**z;g>FQs40BVF)B|_#C^m;@GUzmB`G5dK5we zs=}i{ZO85cnV9AhaQmhy^|yYLLEcva#8pc9bZS-+32ECNHucG%RDTK%FWTcLCmxqX z{?CinOX}ODF7;!Z82r5;&NOE1$UG>xSMOC9Yr~-}(y3~ol)Tso#ZTG0>B=vRe@j%f z{ESfs<8g9$PLppKVzR7NVFswpzbjuA7j5EGzZMr&W*CEg6Wr4L9_#?}`xgv*h*TtX zG$=_zxNzgf<;}+zPFZX+`r-c(nN@4_D{Vpol8dGTS|8S!g{qDE;TLo_mZrLvGM@49 z*yJ>w(}^B{`z`xetH^}>PkmE)VqE3=pSnAn@7Bx|AaWOEOiuQ{J6&XIl}%y1C@Z74 zl=&InPxcMsn*$;)GnmKy$#6^SEcl=_XfQXkAP5er_iBEcJk)Ug1vI79MLHt6XS_-1 zV#>wAQOy)}4g7%UMxc7jnlD1R6D&p9Gd`p^j0hqh65g?5l&(?i#T63mHh5Nj)O`}( zI{JOiP@s!tf;ErH&TL4O3$|0J4}Q|y`|a=Jq{yeU3TDLAA})bwh+)x(?hH%m6s@pS znCQ_HI7NO8 zM&HaV7M(ilc4v1WteA+%$0N!7HPW&iDGPx=h;?N(Ro2(9jLyY6A47wI5aHJH!K8w& zX#+a|pW5EB{9dgq3trUH@&#tv(Fo%=X=ZWsh+4wz$CZIiC5RWuT-QLs*0vFUi8*v?AC zFO|(07L+4wGS3>nzz4cD*MVV3GWxlZ#XuY|?C%PDO!5>rxYiQv45)y!vG zYd8!C+~{G_(uVwA#4b15h5H6Nl?cAKkHBYrgfL+rIK92K=P06)bCGb)jnJ|mxuX~p zfk%)C@<0>y@h6CdVg!Aok3v6YiSu59Dw{zk$?=k&An@la zbLO|*&B*4Zv6+P&)l&S=?<@%>4HA=UU+>Sg4T``5zSe>U+F;02x<_he?sM=u zp8x_Uh@e2O8Q?Y*``MSx25)?;jkdI5SA%_QUZup_uDHsiq@*%_oL*(k4*Xx@sa+(e ze9HGcr1_l3Q>o$pTfx6Dzz4UT#Qv|PYjBABasT16ZM!b6t-=A>ze(rfcFW#X|r@?gh`{)Yv%V2iawKRj~)wTJOnJmnqYsL7phcV(= zBqMsxi#yQO#+NXRRLK2|N06L`HpUo>BF{)U(>KxPP_mLCZ(o$HXLFH7m||mznF2Z& zIiia!f3wT?eLc*^4v6XB?8R7d&JI{VU-j1|AK^XayDKbEyo2pEAjf}r_VUqto(SV! z!37a;h0t!6{PwdpU98ZYN!EY2`Z2c1%pTb~(t(u;UX8^QUwPp2CaAuZo*HSMfbG!~ z*odM^N=!+_gNa;xbzUBi#+OhqvGuX7!fe<^IBNW3qxk6fq9HS`5w%gPtAuK!Q=+ z6u&W}PO51j<;hb!FE#vWPDlW`x-vf1b#4HHZvWvLv#&AY+nqb+yc=B2x49*vS-r~7BQ(d5gmWL5Du=DN`5cK~rggb^Z4>^nA0U5W8vjjEtr9M<618Ui%5 z(_&8Xg+5iwx^@Wz-=GR;rrI4xvc&g@P-g%tf9K?-D939hJE~M3qsbm$ciy3Z1{qR{ zS%v?mu1&45vC1w+@Z9y?5SdQ{;*^Sp#*a|(US(BNQ%X8+?mrFu(v}zSDGiMfewv;S zE>mq%5%`84JE3&1IXL0})6tPk$jd|+3 zQQQ6b9(b%*8$v<;0912WXn+af(ROXV0AVC;I#gtkhyW=xrmDhdOo;pJa>+X;Kmi8N z_=Bf)no`z2d?PRHFa0`ruZa8<^DjoZe?&-nrLFO=^Z(ti+5#MdN;cE#@niGzqP-i& z$lDi*aRV4}yhNETtf`?3^d?{dj$P2a=0xnr#d->S^CEOr4eW)3eEwqEMS!B=ve6EL z?!p)$BM{jsG*=@GJKI)Q>%bJV(ES0Ct@S6q`)jh`IfjPG;TpG2g}AL#1#DcLkwL+9 z!q?Q?BHTAfCiIH`?UF?Yf{?O0Ly!3xq=SVo?`R%aY_>{DN!dQcpk$qa>_TvtJuPR6O?pqP&T5mGC)GPW$Q(N z?gSRsoy-y_g*m&InL7(Ikv;z#k(q^QMDaDUfUg8Gvm~ zIq!gRw65tuf^~$eAkOYjDH|$rO6jweo}+KSXm^zJWvzx_S_D!&F76MV$Zs?g6<4Ch zg@vt$)2)wGbDxhFe@W#HcukAYUr=C0QJIoLuCcKZ;V<#tE68)8#6*mIC~~j0E0wwv1&`SY@tj-I9+*9%XKD zT3-JZ$m{I*0K%BfLk1VZ)Uqwq-XLDNd0DrS(yp_kfucy$_Z#*gYWiDn zN$0wu8se zjku7A$VOSvx74n4*b>;8iPn)nHjd&snC&!+aE`ct6ug*YV1N=54Tc%Xt+q1ptLij! z8Wlj+N`Ze{pnQtu&HVI>#{J**`k0wVqIW$%al}=GvNO9+Ei;KhIv)6=30oA z|EQ=&UKW4I>^bO;NfeTztZvkxM84#T8xiokGP1|!uNezWh;loO1N~e#Lco)0F`V6O zHF2zPQ%-Me3e<-Rp7}NgjaD^0=@&Qi6ag2W#&I|`J0;=J0V4+|)qSQZp_g`Z@P;Fh z9<44e=#Xc4n1}Cec=mCm8r><_A4^&VLuP6Y8El}!gBun?RsX+h5|^Y`dHD>r5$v{k z2OF8G!I2|@JGnXo)&NE;1mn(X=uBrr5ejT<+!_IhD2w|SXrNn^Z*PIj-75lZ7Y01# zAGXr+YNUfhynvlro+2`GCMGGT_Ko*S?Iy|Fn;UDeQvfQctHwoCuFW__&S2cX4y&}G zp?|TgByoOunLI2kjRroZ!l&2l%h?Nh2rOyJNYAM_*Ntfi6rL%OiUWMaH3T+-)+Uud zluVYmCc+yXZ5mZ#%=8urCWG`y;NXD2~*aA=qvd>;!he<5j z52O!v27iRRFU>7GoP))dZZKyXXw%2K$o;_pmuNhdA8&MYG-Pd;R&5mO_*$A=I94A0 zi7xFQzQPy2qetMoXgXh&uq-Q2)Bs)-MQuz5iPxHOrG9?L!NwN$)*~HrB1h`!LTg?V z`>ms>tvyBv$G&blBc`IDpvOy$3bWc|K{T*S&6X{k$>tPQ<1)4R1h!cFV>bYE?S|)S zRivbXsu*bM4|r)kY|dv3!m9 z50*e+^s+%V=*x{Ega_=$^GE&rTGqjdcoRi*;hb)2zOPt7dSHYUrJ=3qK06>5xwwzQ zU|+SoS1l$rae&weBvXe4i@9tf-E0g24qpu&q!^24f}|2ixfSQjq}4R*R(gx>78aJu z+g&cBJj%;3k%8cJ@By=S8kmMueA5a1kG7{KcDhNUr@Y#j#aog)G97!DA6ukRGpcuBwMz^&7%X@( zV%(8NNhdh9jDf?L;hJLJ3l?FMJgTXjq^o2)yH>Jy7aMfu!#O za__m?Bt+LG>6)jl1HaxqQ{>dgw3H>n8i&CWj17iBHQo&b$Rhz5cF0Qtj=6aJs4I$o zfM(MCni(jiH7X1y#skvQPR>&a2!20LsQg}u%8TIvFfp*nG_X7&j}EduM;A^g=w%nt z99**<1P%=drGm$!mwU@I|5H1%n(knZm=rTiwS=OR!o^h*@!}N5}@kw#Zs1S5EL2Ifw=z@3F0+O5@38gS!L+MNBHx7@UKTkH(yGea0Ogm7N7Zt)yXS>8|Z&{nEj z4+z7@_LW%)Jz_uZm-N56b}HBeQ}uy(@#3U?ndz!2Od5Z(Dq{I#&EMzmHd|1Kup@^~ z*es>N&}0VYAPv5TsLuCl(wkEHCD{#m)qt3)pwcNQj}cr|FNq9$!$5%hIIo_X8DsA+ z&vj!b?3z;tnJPtUy1Id&(25d>0lL^o{CFaEx;QZc*=3u)E9|q)P9!t02LjqL%?tQn z3_+z~6=89KwT(Zh%l^K-f9J&mZMPNhIVr zmkIbM@%|m7q9E?Gm$cpV%UFR_QwWci8bpFe!yj?czc22HAf8&q#f0zV{!p-+pJ^v+ zMUf!;vr`{8_oD@_UtZbuzw$4AW0bG84%5o2gyA2$iG;e z>yx-j%Z-MeP)Nen0d6PX?gIDL@Whl#h)|olG*kI(SN;<ds1t^S)hejbd^{G<}HeajQ<_0;WQmhu+!5ceVK@<%AA_0 zu6%MrE%Eofqx4^vr?>h;KXCNKbyuZmkGC(6?+cF(@G@(wK#3YPKn@g!JzxVWlTWwp zvHH9&jiUje$M2p=M%Fk4@u;q&T2VbEQ#gm%7Qzyl46pMB(2-#^5^*0w3IMc?a6zFr z8UmzF?duLYMb@ShT3fZFvi;n&%=tHFj^H0g<9CQ$)RpV`YM-CyU@n?(g}js(4;eim zA)Y%LL*9laCc%z8CH+vD9P|uwdA~;O=?X4wR=`Nj&YGypuZOe+ktNK`9Y0#A=6(1fm}ckG5L?mLsq z+27!;uJ^}4U~w+DB&}7K{2!)#CG@x(>J&gUB<%{*=$PSL(S)MD`V=8GJF)4woXmS| z!$_bw`T+c*xb0dKbIV7!pKs`94aV>Pe~2d2+ai--QAX?kMVXPb9ptIZxE*v~_=B3r z7}^ED3K8k_$zonl5i}V?{DbM-J~p3s0gZYy6sI%bQOiyWAOGw%!r3=Aa|D67L$Is|Jp72o8STNC&n#TO3 zUM1fZV^CNB-uajfW@o=FvRHzm8Met~$Q2+{42&!S*wKNP1AaPs)ye14ZH72Qj2gvl z6E?!iX>q=$m4V(Iv|s^3#dHuggU+*)M5JA?=l3D+7Usl<9|a$@6<^%% zO32!mdH*%Ho<~5%c)$JSZF9M_8Bk?U8j%qR=;N$CSo#oc3HUV3oQHvX2Nz+ODo{xU zN+y_UR}|a`doll%oCiLmb=aDa^Wfs|uQl7O%xZu)UCw3cerMuPm@5b%T9Hnn};xBch^yz`>51mlaKRqG>u+$+CD$d+;@;9${hyKi$ssKb&OvMZ7_tFir zA>=eu+^EGGwT=boMF7Q#WkyODM@I$7M=R#pfnXO%Pne_lMZ)_SGmB;R>x4cHEX#YF zn}xIFOWk*Wfg?^s96N@hr|ZsvEUm^nDM8w^=>45FVD{3rnYG11+T_%l7OtO zf_z|$q;q1aNO@(C;oyfCoy+SBf z2~SrYB*l`4;Z(CvU8ijeU`q@hj2&E{s2|vNk>qo=E%G?}gj4k2mw@AojD|MUWV2#v zl`E7;n#$|f5W}3zG~HH)TnTiqF!^LJ+ zw8pl7)>tdUl!&IA4dx2^eKkazHMEuj!(~)_mmrj;y95_UUkdNb9#ZYhd3%FL6dcb9 z)0j2N6+9LTAKY;vr7jK(1g?+Wws31@8mka26|$1HlHPUNBmwNS^Au&L#t= znBLX3=x07as8IC;EIwAP=CEJgbJasER=&@Q;OH|N+BZ35M=ao(j{Bn9+4-=ZuRse5 zZd^tCe4rg1ZIM{7p+q7jM2aR;JD)E9QHs))FanCHqvJpgTRK>q+fDX zv6<1FNR8IP_?|ABC2cG3kE()+nm!Y&)NvW|lMJJ}y&q3L1!;FqVFXht1vGb^M&NA*ROG4iiF;jB;KPRirAyW)?%$u0fu z|3*R>dU!Y5mhQ2KJZ^a#1GadpuzuhjHjZFuq zBfD}Kib|p>6y3KW}$>F_c_wDwe8Y)kZN*m!p>(YVr!&2gdq?V zXT>3;>xb)%y1TJ|xbn{Z)W0BUFpDqmUS$K+ier|r;f-_*kLgdfDdN`x9~S1?+w8U% z$iC+ag;hwTML0F$DrkT0gd=X1jTSmoqJ*&|mU{ z4lz+m2L73KSi&VhVj14u#bV>*L)6R7X-+Q+ilfO^!yktc5+LC=5H>-VVJVbHG|EnK zJGzVU%ADQF%Pv*b(cc}fRH6QisoY-yJrY!mLW+QlUOJcYw_&A($nibk2t5sv82xSw-JYxfo%iB)v7llw23Rws7;oUHkDomB|G6B5yWQo=zHym_;rXxF4?j~T zjv|g9M5ErqqdUqAz>M*{U4-TVWn9@hB;V-)_v+_)v2D9GL%VU~EAd|6p@BZyCNiq3 z;ApDeotBOPi6sZiP30CH?OaYo5FF!Uk|LU1$4Y^mZiSRMZCy#~L4O;@i*lK6wu{#d z5(2<=z8|XkMN&7Z^J~F8Cu5%~BaW?!YfH`He)5K?d$<#vL@3P|53|#asqp9k{3O_a zz3+0lsVW=B_`Sr{4pJO=mLV`x8~SzjkB%ATO?{9hkgFNNV2{MbgsePxP8;&}l%rAL zZYjoq`V*?)Y!V`kK+PeDAe6PK?{UTlfTw7gx8y;efvbBGX~&C0TM4_b&`QRKXawyk zP1!S(4XJVz-tJOEdWLYzwZ^z;6?(240if^UYL zSw*;4`Zlow04Dhl~zzXV>O<~1OE|LjcO?q!nXcX9cUPP|6T6>l3Z{OMgNG$Xo}PU^8V$BD>>K zYodC$|6vbQU!iqe+oLR*a(-AzZsShDBhF#h<3H2iuCzR`M8|50v09lb8 zT%Vm=gknYdn%LM_4RfhrjUk2WE~#!|6$PW*J_!;?P#p&CC#*BSnwWOOZ4DN%DW3!1 zJIMO9_L}{2aU%V~GPO%MthK`vTsM|}D%0v>p3YKUwkP=U!~MIdC`Ud-lynSham?S1BNGu3IgS4MB*Y<(`@5}g z#p2R27vChfuGa4!+Ke(QX42blelKiq8l#2U0KblbjLouhz8?L$A7`vhyYgnIH_w=3 zYiO$6C_j2sXgth%cR`idyP6&K-+XqHZj2$fH%v*W%KK#$HGl0?@Wgt)}-* zzrFIY1QcyR;cwa2@vwn7DD;0bE&u_dxCryFKb%ziCCBSAH%-f*C=WVCLKlg)PvAnk zEDJrP=EtV6DR%aq{h$y_zlQ9X^9{QKuH42Ii6crV< z1FnRK35K_agrK)j24WkQ)`$a!<%;&T*`Uoeb+8Ijh z7BKDZUQ7@z>Gs{a&8Z_7z4yUG3DI=13Ww*`?4~VPA;+m9ctW925#kKO2*QV$vD65g zkPy03ifNASdli3oK(S^3{z6XBK}jvc25gfsyW7cCjBVN0=6ta^S*Q|vQM;79#lnNZ z_v3(IHHkm{r{#o0f9J~m_~mD2)W zLdbjG+j*0z9sF>lH=mG8_xL}5o~Y7k-BB~A?fjmvb*qos)v}!}_=|QJ?Z6n!5!6iU z;e8^KjMvCL^QbK2o++pv<`5u5M0(Uc;K@?rMzVft*xk7d>Le_%-qtxcUw|m;=Iolw zZv5o+HrQJBZNdTTZCrB$vTO5oG5-eVL2t*tBtdSo+4)Sv-DZj9+hWTT2aGN+Z_RuC=FAVW?}UdTV}6e$ds!C#%fV z(}3qfLt7)s%;Zaqu>5=yn37?I5J{A!vb)2zB?H%`k2|EaTNg_fi%<0>N>NoVijoR{ znZ4fY)cNHvRVE*n0m!)9fjDK(|2ia};u@{+>$qLo_zdSE!Jg~u!`I)r5_J)>lSG5+ z@aW)D1V!ookwANEN9^}~^Dq8ZOI-mb97>OTvEq}`8cKcFx=~*A_r(>WfnmX|J7{XBu&t1lzY{eh5wXg1`C@-8m zap8@W4J`vd-(ocIMZkS0vCx=9hJHy+Cy%JFHEcCi`lI?57~F+^WEffE@#-lwG*~h% zcJGwLLZ0wuW@aU=r1wq*HmMzYv+U|rP`RgV|DErVL$<&oX%s!(a=Enm1=CX`V`;xR zY74e_3wAptJeMWORvlV{R_-sCFx0y5zxCU=738#=o2FK4?EN?9v6pD+=-xud@ZK=| z>0W@$N~R?#OnAG5(3J17H>?g)CUF4v+PKHHw9eKM^cuQ4eCr)YN3lj1h|yzQVYsLe zL0hU^43k{}46SXgPOGsmuklOal}-%KzTln+TWa#@81o?+4(pO^zI)rNhgd2$Zf>N? z%Ae@<`vI#C`uEZo0D`|e?thb6^s6M>l`K2JFNG%`XmV*_#DI~Oi%YXAI)NxlGSV;* zArRC5qkYp>%DgyLp7wsEJwEHSmAF1UvMFnv%VL63Y?`E@)^t`LaS8wl2nD6UBXb=; zD9R66Vq>7}?g*sy=dZ3qwPraf{=9_TsH5Ml5p{ENq>UhgjlQ=9zFlX(xs_f(>Ej9M zKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z003zjNkl}!Yo@PF?dz;nmHhZT}2nh)x^gYsppduomWs6Nw)>l@e z!}D4C`BmvDt>Zb?DL+L^u|e!DEkvXd1OiGMLVy72cDkLNz4zLydz;xl-T7m#EQk=s zIb)nZonvI|k@tD#Tx-qwKJ&Tn>%Ok*7C_{mkAFV?`S`kr28i*W*T_E~|9t$@LkKY} zkVpRKpO1e&{`nY=M>Y-p)gONOv;TwHyymh?u3$FX#(Rek5g|azNSci(^D*bnKa5Ef zP1}*ChTdAH(-rDPjgKCa7@D@Gw-#d(^0Xk!6Uzn>#xcBGvRE`EI>C8|6pE&;nM_6mA5mK4y<@Sg$V^U}r6dNr z))PZOX^HJUZC5cKuVVWar4y{}NmIjozCeh`+UgqUlxn$!>m8$Vl@KE#_M}P5vRMrG zCMFn@(YqQc6=^zRS?!SO0_QAJN&=3&TqW9$`C^wWEr~H=QiF8@DFutg4g$%_%7hCS zwkdMOXyph^HKVgFg&7lq$9jt~BO-yinvo=mQ8@;nu4bh98uR%!X_i2cXsu9*K#Ghc zk<`r`?;}Q)^sb?*=B%$DV|Qnh(WJoWG2VGRHM7|Qtqj3?@~j{)M^x1e>nw>*(TPL} zMb~+Ra6~|>6z47DvZS{?S{mwhL5vcu69f?<1S=WlCmpM9@^r1@px=lW9qo z7Z_uZLQ@n4)p9|Ug7uAcoU=?P6O56RWr;D7Wo0o&V{J$Dfu`x0?Oh z9@~4A)?}GvG?`G2rer3iZ+fy^F`sYIyN>DF3W5Zq4RzB{j1m$p$;SmTNVH7BE1IsN zX)6eUG)qA$X7h@w=|~bm-Oez1N}8plY07L~fryw)BN9z;HKErO#e|)mZRU$z(%c{t z&8S=<^qQ*a=(>gw0uboCmOL$S-Vp+Ht|o*)*DSEkW3p^mXd$qyXFx*;9n;B_tT5D7 z$NK6zT`v%^r*C_VO6grq2%a=aaIQh%F-eLs33an1Mlhzpn8;*2C3ru4L3N5Gq3If8 z^aL;P&e6FAsmWQHtWs4=M&$}k?bzDhq-qx^Qbzd-S(Y;%t)LUZ_Vxvi9l4lEIfW>Q zUQpL9NfL2Ba`f;?f(s-{QP(Zbc{aB%U|m2;L7r=bkPsCvSSI6wLmMZs&f)q%*I9&g zG>t_B#bh+0>nxE#-z^EgBTGw^l;l~8kP)pVLO8qw6?4YpDM~54w-7o6n(1gAtprL6 z>bk-t8bnKK3TzkY`wFQdbzMDbCwbHYshS!gB5l{u))mXe9-EsxjK))>mczsDEW0~1 z+IER`mbJAFZ0pcUA&G3BKhLtRm@gNMiV3!LG_6Mx>AIF>U9q;dfg~kHunv~XIlYaz z*mLCQampfNv21A;Embumh>j>M!AZ&@BRWm9Xh8*n=s0rpIKj#Na~c9Y%Vv&H9wh~7 zVyNq$wr+5?qsTI(@MPJDEGZyB*EY=NbBZiuGF~N3a;n*a-~~cOX7f2xNhae}y2{d4 zEmgfopk;MBB{3ONO41}J(TcXOkV24U8L1wjbwZk!BwC?`K?*@)hOsosNz;(lMAw}pcrK!BgH6XZ*O-P%OJ}OLi7j)iPG%N zb}@xuw%Eh(f4;UlMJq$qR4kSiLPUDkG98bRBEhybG5Y;bKN5XpIvyiLf=Lp*cl5nQ zNQgdC7CA~9mdgt3TdeEQiDYHEhBi5ojX|W7ls%> zo1F1g5ux42ybxa6NPXA*xSH`o2RjT+cfPLXjFp*A6!& z_=q+d30NOVO+t(TXFc9~v`LUeq>{jJJ*^W$3HA^anB-B{lS)uGEkXvAguECLL&Q2y-*v<&&^iEM(i|xy z-VeXGbrzjQvLeU($Zu~x$UWyg@$wo7q?sT~_QM1q#7K;hu8|zOYLCZ1Z3xMH@PHr^ z2+@%!&B&BgRfE)ETyhn zVsxY`L89q^zDD#549=_~K zYTnkqm#u!rPapYST;J2Q-J?SL`C`eDBS)C;Ef5k?V*p9p*QBZZx*k8+q+Tr1S&E8^R4I@Vfgn+VuJ@c+J3_UX z5vWL|qU&}j_j8;~4l%8e0wpTCzDE$4q!NO`hvmTyH~Tr$i1<}E{9%kvklv9CMF{b$ za-h9~9B4LQkc!B7yh`x9ASC=ogb2U#UB~GAmdT_fcu-p5y=SqkD6)e8{+11no@sgg ziX_;M`Er*cn}Co6Z$U<~e8M7Z;jP1DIVQ<)&Vlqpj#TfEs)CUC{a8Yh8Vy-ORqxPu zftBfmuI;hPVi*yNKvU1qN|EY`gXGAZ_b;g1PIg0W42=ya5R5^m^ z$;*_w+GBO~DAmIY%2A3y;DbXaf@L-1l8djTd!XY#tiFc#H=p5~)Q#k&W@mesqsJ~{ z^V~Vcd?a%1Sbg!$eM5sUQ}trLhINkUm9 zj~!xly~Wyy4;@MhBsoeI;3X1)6ce=6)b*04vFJn+97G{8W=Im9_k6g9`y;3J{9%Bu8K= zOilzwqsg$fN*GUa#^nftL25C)S)^t(8Dl$#RvMzDY34W=D2s$F&nU}`EHi}Qh%vBS z)L7>k?|WmV(6C%T&HWQ`(QMF~w^H!P|d)^|u1DYAmL?U72cs9LIK&aB!)$bLx1 z^ASzcv8+3Y7VGB}g<(3KfKL!oAQ0HTXK%JiQ5aUo8|3+j2o%MLAO+hOHjz?Mq!WDb zbe*MZJBoaj+2R5lht>!-B88^wdx(;}$T)N6A+kKDs~yjk*YLabyRmH`FEZL@$)O{M z5J*C_INu|p!P}PQe2Kt-SM8Oc1reEyR#7tIy+BGu-?^`? zgB%<_vaBoek;aF>%34Wq5!?4zYiXK_ESHQ|RuCc~`p9B$N#}anx*{JXMB&k?LaPMZ z_Yfqz+goJ0WHcGhYqN;>rd`^16~wcS$x{-Vrel;8R8@t^4FW~q)|ga~BoYV+q3OGx z-c}?kAxXt>-ngKxmxO2_NMiH|8Ay@6=5u`Lk!gxa1l9$-@3EaFMyRTemFX1U z1QykjL~FdWEZPdGBw0Ep_#Po7I+5&d@1PAhXDLS`W_xo?o*`nS?{~i@1kg&Mlw`KM zhfZK~dy6YBy^6iPEt(}Z%O==-7cTem%`3&T553X(Lix^|M~V#ac@K<$TIA%fBoB{fQFs%483 z8i6E9GzEgLs~DwYnq>__Vp0V}vb?148;Z1~S=K16A$YV_SnKg!7*ImnqLf6+;lHkn z%ocl$$0P89$z)2^E-3O6=PX(jB-*jU3e$Xps@~zr=4w94-8{!!kMj+9$g_f~^&~RI z_T6xO6-o0EX&R{N9nz#kN>Ez7#6ddL}{cFAR)w_yvQ&r#S3tq#Y=~?fjrCb(L$7L{iQJC0i!c~7(%N@&WmwatfSEg7lCML z+T~ZyQ;JD$=(>)Ljl(P!3z9@4v_>n4QDI$RJYM0!hwev9OryOjA9 zDI6|F^2E?}OY&?yyi~IsDI+>Dm?Wd?cD{06F+mCdgFvH%qVHQeYdLI67H*G~)m5I! zVLm*&mEW)5!)xrbKm>A=V~nQAr&RNrzH5h4g4o9Pu(Gxa2%3416pF5GXxnW}s#rgC zi0C72+cPRhR80@@JVL3*ULc81FgmC0x&fAp$wAUxWMjtT5!QLKEWz5AdeLK)A|0>L zyMWXw!S_QhBm!DWTyzK|MUfz@Ddi8&s47pQHEYilEKeEAB0*|H41sD{p>;x4)g(Hl z91WorQBqYEd8U{xYSveepp~a?BW0Q6ZDcuLf(%T?E0lSPGy}ZZ)h#kw=ChV^tVt71 zFMCWn8E$Of(sh<{DhWLlllHK#yNf8V=W{) zWp{T5!6HWq<08YmfRZUfNM`c^%~9G>6pG$jLICdqZBvtHhA2FJ<7jk4+ccQW(6=3u zl%PCKx1=a@_I76^YK&B3c&RY#0!fk*JhV*@a)6ab*_hd4wjcLPX7fGTw!@@7c{aj3 zOHt;ut)*!!QbLF@E>{V@r?rkGL~L)-3GB`Hn2c9h%x5Hd#(0#mm@f&j$3=(MLwUfM zjIOt|!XlMmYiFB7hYm9;CTwn=Lo2YZrRzJawV2fKoa}n)x}#oH_z=0SzX+#Wz8oIp zIq8ke_LK8q=Y-%%(nyji%JL9Zn6aD>J7s4rX_hb=C-mI_07Tc*bq)~~DoHTj5~Cs! z`C~7Th``z&+jq2GhuDYR*49@c2!eNX{Q_@OLI^_+f+H_hF=5!!T<-ir z+`~(7LuqYePig zqeiKk-Q8VuA{dR+gTfoyP%UOOO?yyCTQgItx`HAnSi!Q|!o@&2o|5GrRL^|2%QQ^c zy0AGE+MHxG%J4q0tmc&En7zGi%27%Pu)elJ(=1UsVtbEC5}cdU*}(eR3f4B%ZOvlV z?1xJpAq8n_XuBmsX3S?bS|!v=NqR_Pj3LJTd`AU>2dOo=$@l9T33c01Hw}FskXmDV zi;x*gc>2B}V%gc=Bg<2iOpq$UMUSULrIEVn$Wn+=G8wPoJowO1bq!V9Kme0wNHnN~ zD4^-iv`<+t|U#dql!5L_TiG1Nj(s6;WJ z&q!0la^9j%Aj^||bT%i17Gp}bws*)fgVK^jLXl?!`q=x&ULXNWv=W_^jC8hNnH217 z&&Z1uB@)tPGK4ZoPt#QdCxAVS8OD?xDwoT8Zzv=Mke^*8yBvJffM8kg9aKDp?wI6L zoOQSmna`F3WS1G*x(6s5FgKAWMEh%rOVnHb2^lEjp_-r{^kzwD9H5Mvm|WO{Jj z7(p9}h#oBiQs*RzWVu|>_dQu=m`pdYUB}AG6ojH}EX!(%mYT_Q1Fa=1D^r9Nc;^Xm zxTz6IkxBZlBQ-ga9%7*DdrVR?8I?3$$EeJysyPyYF)5HR9gpapC(+41aw5pnjJg|O z*2JVpKjaLLP)oJaBuPnT6gts}C|N9*6nRe5MRGGirqK4DrN55JWWw8j;CnBL&uMkXtN(mX-tx_v$KQk1l|U+G$k)`df%Z}(9wf8#SxcH_=tNWh(F*dlXGl^*aFAvh-sbq=DRM)2`7Ui2*qc=xIdTLgbDFjz z`bY>pUEk5$#ekC+`#8Cb-1eEzvN0YCWvNUkMgu6=*w^9u4tao!xAeVZRE+S!;`)v@#)ETvTjPC$Ni{{8 z(Y75iL?E(Qwn)(;L}X<;W?3yTCS|!?vaA~NtRQrbVl<{{hUE9^>SFGkd>$bMb=#7r zDaJrm)fkgfRV}G8Sm#J|ijs4*8W!22*%_+B)-ozq3EtvmWIUemlmF)b;HG0UDk6S+ zNuuB#zwzS~s|gj65&ZZ*xK606=0GPi>e}u z4i|b%ArK*9R17}$gEE5I_JF^iK7AkKX@TouI$0e; zs3el<5lJG6vd6lb>39|IJwjPFH!pDM#aFU3yFdsq8JB2j*q&WrXK$A>8_{$PiPVfo zC0*}v!PE82fup1n0uiMofALo%oD)Pm5lG}JHh7fC5kjEkP{iteM?3Gy(i9OBgw({S zi8R!G15q%aFUjqFeA}Df&e@Ot3J-4Ya_8-5m~StbtdE&*FJS-Q^}_>HzdPR~FLUau zA_p{OhrO=AfmGRntfSx)c1!2)Uf7Ucrt@rb&%w9S%HSwhfw z0&QPY>V!1W)NLd+LuGnATA}Y9K01U{XyvK?E@%9@2C-P;eS)=aAOyM&geOfQONS)V zeSFN`Q#L7zoKcw}WhBotWL(30%Y3mU;z?afmS=qWBcB@Ha9Yqdmf5_)<4Mu8#+`@e|a|jLeKs!m#Knn&txe zD52{DT6?S4akV? z1*y)6!jqVcU;LGy;^%(q`}wuE-^_)#d_Oln`4UcU9O9<${AFT{eEjYI27oNf09ZZp zt<>A^C&`DLU@;$Zk0F^?N7^1PI(m}#o%u(a*kVN>M30hzs%ajT)GGzTDPAOQ;!o%Ar&2XP zHhBZf#f&~UydO}=YFQBpL>X9}9%J@MW!)rnU5CjuN-3(QCIraxZ-8P68R)u}(Ii7D zgHnRUat2Wlg2NcYVzFQ}E-;B^KHtH7b?D?Qy^nMso6tTGP~DQwc4T=@ViaxLfmFi+ ztA?8%afpQ>dI@HLN#{EQD|4U}C{|Y|%=YFG1-66dzWnvvam)Xr?|Uvic8JL(&%#>A z=RWpsQYmq^BTWLA-|#}}=6z_9(R)X*P}_zO9a2U-j*Y{I4(b$(*%B;b9AP9lfa zPcoZtktBj(J)Mo1Jf&@G(kx+Z?I_MI59$X?J10#u%2Lz!f(}VIlOl$2})^R|AkkPykcjdx};OUQ7s#kN^s8MU8F1&yStLyOfe&|a-fV|sM=#?1xpU-YhS3QKPgU7(6k;V5 zMMBdw2Z%|qf~sARXBnwZk%b}pNSZ0SF2!3x#8NjEX_6AYn1ON}`r*K0DacGt+b)Sf znxu5r;@v>!=zC9^88#nYQYwaurgLQb1*6HdB!-4%GeamrVkE{S-29P`vMNESjNL`e z^86X@zwb1wV@;|IT4}1@Qq>Kc+cWBZLDvqn>9%o%C@@)xXlGQ_9$7Kaos&e6=!B~F zn5;x~b7u4NL;b@`kbx{Q%6Q-7h6Z!E!MpO;eOMc$eYBz-dw%x;~+*mRPIN ziNcr!AqN_{=wM~CI@Ch~gy6X2{tI;DySe<52`fdxUR`tl{r7YC-FNeXn=T&mDq}dm zx5xeW-_O&pKY@snWz&(R8Cn%+BZ!?u2|1i^ zit$&HeLsL3KK3l;yJTs~>gwvjxR8Q-nuoYj9%V7#rN|Pp@#>>Mh`zGuG$B!rNYA0w z<9t{33f?w@KYA-J5;IH%0lsH=t;9JY^iwjHDquIK3SV@MK~^BN&MRb4;! z0+~!FLq$?+>ZZn+5+9e0@)3bRn&NyL#P8Fh7vG;K+hrnW7~ z-U1~BlgJo-Ta|m59tgWUfr726pa*cz*t8=PZ_r2m~kCYi4A51`d)elH{7z ze3iOtFxv3DzyI_6+<$!^U%q!vmRz9jJeQU;oO68eAMZgXiablO(`z_h&hYUV&ULsB z#-kw={=9t}ue|mOzI5Aflc)seI+oiN>l-U9mlfVyq=Gx;GkN6`uHdfQe}``AC`SeN z9(z54-ug;*zfK&>EVqepIODmn}vcLi9)x2%>*%Ht($; z`?Uj#M3$uo>`Ea)sUhY?M67d!5ZKr_#(cIl5c{N}`Ku}UYiG1=_jShyv6TOs@%Eil z^crN(Zyz!{O4EQ$cb_F=oj!f{|`KT`S&sU+<*U?@#qCjSM%`X z6ttm_WO`@TVG ziBbtklCsye15I5iCcpn~vfp|aLJG7=&|2efxr2D?U3ll{f8!mbzw;hUD)AnQyg-;M zx&3qRCp8&DfII$-p&%+4kc{omGAaw2(KR5z`VQwkec#j66&k~Iyo%ZU3~kqPL0m)# zfkjmf@vYQM$E)mKxQ(`J38!zS_Z|1uYuxNMEY^r3B?v*?SM?2|)sPxPupamMVcyDgjYI24NYe>gXLOzA>g#`i z>2wv_^^|4FjrvwX&>X+_j|U-B^gQVqKaTeulktSrwKcAO!kf6#eVpETrnmnlMLDLo zmg}GLW~S2>1d_Zgx$$ZLniGrnBP4hviAqpfl0`#N=A>ycRJ;GlxbyB{+=qcYnq>u2 z7*LY$&tA$>)=Y}&qsFyP2qKcE9w~dK#VUC|Vmh9%zP3S{=7Ub=F{vixZ>IU!FJQW%;)U19aRXH->2KFPjjJk3*V-{WmYo@FeT)gWYv z5u*~aSJuqmHX+YSL=-e#N7L;vDo3Pgj!F`izy24Dw4w{1`5Ru$LPA;Q=n&Cq!jJ#! z@8DNlL`eAc-+C8s`u-O|Uf}jBrYmD?==tnt-a9~njRP4dcW%Q+L3{M6tS-OA-u4`& zJ!&-N^u7N;n#%(O%Gr*-hn?|t#NCe#mF`hsYx5SSD{F&Z#3~kxhTipbN1n=f_mc>z z7!@VYzG0n2CCq0_lol+P{Q*BIn<%m@XUke9GAD+X-gQj!6)Gi2lawqQC?#2H@O{h5 z%9zP$O53#5t>egTe?)fUcT;}!H?XcE)Q&Pw>H9%R*)}aUL}ZXW>!q(J%Q8N3_uZHi zH&SE?eIGb^)$6(QbHB%_^m(A*s^lX)c-NnBhj=zu@DH34&jAPHtFB=2z$qw(?~VD= zA7Fjpp5$3v>p#i6?>GhenT)TvV%WtVI0e96cbwvJ4(`^^0|&R?aSFyS0pQa5W`t4r z7&#hN>Dq>-uJ=)~bjWS?$NSy_`}CXCaAe~M51&1A5a|R2uZz#+H|KxDAtrq9Mc>MD zzs}`-K!l9WdLj!_qbSNL%f*Z=S2Ruk4cNQ_+O9!J&tlnr1+ALx?Z=J-nx(X4F<-KN zXobb!8;Un<)9ee5nnn!tZQD|gMs#gYZ0ZBSQQJn!QGs_Bq{4cEt!w%|McA*PRv`>% zh>(H4ZqVQV3KrIp3c<$uI*a8Tq9n_+Aue|oAp_2Nj7eBqT?Yic>+vq)eUG{5iF8p= zkEe{sQ{49FnWvYtcIFeD)|V5rH5Npq1i$e_cH5qb@7S4vWK1NWH&4@YlyY2h>ER=I zf0*6P&$4>t#zDNL6kXq=H6$mVgAbku`iP&oA%Dpd+O9+C$f5NU%;sBo5A%6NlC1Fj zd!J74E_@BjHJ?{x>4>UsNYjk2tGWBGZ2+2PVEv|l{wr{<0UV$Q6bb0M9;NibyoYXo z7cc&fp8#Msn{n#iEdVZg+yM1n(S3x}7`h;N;N%;*_JKdd6e-uVpFklD^jKwwdI2)+S|l@}>hU15?Dlc~VDn$A`zp-5%HqTXX;V;$>qCR4-N zU-yU;b3|vsONwl~uO&&C?JXFMr!1FC(kwwB_Uk1z0n6@ecM!$chDZ;EV|8VHpl{H# zy|W|)H9*btB}uA?A(A91-p}?c@l$qoYpm@tI$^PF2_a%#!@c*N!h1)SmGllSzw%im zdmm-7TyWyp6RBtSVX<6wXq5}+?qfCHi$t*_FDC!5zslM-Zz1lTqP|#jPaJc#UZQ?3 zA^cB|__E@BwAlan)0}(g7P2&Dxp(_uED#5>h*UkB*)@#kpC#!9Ay3Inij+egNhOL4 zJ7%8O{5mX(zW#1?BCLX?ctln?yLFLCK5>)e0OIZi*}+iB{CV@LiFq+(o*u-2h< z!o{cmoMqKwtsXQtCgGuXz8PNj8^j-eGeW|~^NvtlwZYCu9>8p5bej$J12xxfJA5Cx z{7W65|MYL-!w$#lKjQ2aKg7ug{%}xKDuWU!v)K-JsFzSL-^R12H_-Rp@S^P;S{bbE zS=KFx4kZFw6%=JoZw2+TV|{glx@!^9684p>LTcV@zJ=eOy_<`ZqdYTS4Yp-68sRKt zX2iHGsg}!q6AOb4-+=DEsP_m?pml@R35hNcBm=XxsVRzqDq)h0whm0M8eyJmK^L@@ zqqBpCTS~)pypFe?_0LJth$dVaSVtV&Q#9p08lMW-`7AlZs)HNzbU9kY4oyeBM9Iqh4vZdgAvwWVZIWjRy>02*9-}j)P~B}ko;BnD9}+1)$CjW@oCdRf!9cX08^8xgUi?F9GV|1qw4 z+%suAOLjOxCK+ARvb%Q&mtXP}ZsiuNNLeWgid6A4Kldk$MkBuP<-p3y3UB^_C(*V8 zs?$_8*FE`%xaUj1Lv9RhzeJWL7ys0gsp>$Cu>0vPeCODB#ntrZX6)UvgU%J#zvV?N zKYQQ4jZQ!afwe7HUHD5V3c|bxCz$QcKngDJ-p>d9Hb?>cx)IxX7H&3hvZTXgnqoA@ z+K6+Wt{cMY-T90!##87-5D<*h6#^DvHHY;Y_w{FaN_!bzJ9ZZ>E7R%0HGBxjB;s5^ z{*xT!Q7G0OpZhI9(bf&4@pypIY{w`cQ*|?J2kVDc*n4|Hw`(z%Mi`7dNVKN+9n$H2 zx}CsBKl}s_(L#uW^TcRe;H*PRg=;;|d!$e#i6R7#3(zec&RT?$NHKh_l*0BEQf44P ziiFR7;VzCHJx*0u+;i$Q#$;IA^MvcJ!dZvf=l9F?ix|62y!WiHmY8%%?5*^|hlFB&m6f&2687_W9nA&^262?#OV=#}-$ zsOM*JKG3RFGQTr~U|P|39f{UVC#%fnGjs+%L^z#e&k6qa7ybyX1=2~hG$g5@>jrxx z5E!ZX)MxIdEQW^}qD6>=mHY@d{mGy4p>O^sCX)?<3sm#-y#Md-zMfolfF@#M0UlRx|-lBC%@ctmAi~B6||J8hq*A?G% zaE-(yUxN;Uq|D1lp;%v|Nhb<~)Hojz`%Fpe97-63iF8d*Sd5S>;FbZM2-0*y*Ve<% zqB^t^L!?+maULP=9cNER}5SRQNa~R(Zb4 za`7<9M3d%<5CT#W;jJ~ZVhMK0^0w?GLtgejkwjcBd&Qm6e<#Lx! z?c$n1s}yOPk!by>cscb6_ZF7=RA>t8Cuu(urfW4_YNs*dRy_{_ua

>$vwxuoqo1Uam%~8^i|JbzWq6(h}b0M zuzHvn1Z8shpL1tJ$TjVB5*$eXi_ARJxWqf}0sWu!VAasVY+R11_U z$Wu-4JPyrtG^H$$u{+y@2yS{=GlSH+^KmZ9jVh*{iN6wwC47FXk^_I>mK?^71jS`n`wwlV_HwRB`y5 zuS87>_|bo$w=FBvLp05j!}t6Fd6{$3$;Wd_|!*G4iUY3rV@^<;&jwLMv;Fw!7}A^1quHpr0Tonb*x{jvlQKDdNb%V)t z73(5NDha;BXi4Zg5|xuDBgUhG$#j+J%7i49Na^slr)hc;l_M4z<598in`99(g763e zA@qdcK}6cVC%Br6F1iHg8+LcM*xtUt!w;Y3&O7d6v6!*DyG@qmT>ZEw)At=8{?K1D z9<5=_7%3$iM{XM2|3*_(0>y>TK#cfk*}kjcjBYspBM`5GbDx(ycw5OAUidoBUK-HN zA2Htk81cr)-u5k|c}`JG=ng#{-#KPGGy1M2ib!_hGbBkun&$+ku#F(tVNQ$#fiE{= zAaG^{c!82BAw-sSjduKNl|CPw#qkQu6Mf`Z1bz51mYC z`v6$ZpZyXSU33xC=@erOqtOVZ6h%?6SS*-KCY(Nfnloq4aPh?#Gnq_y>s#N-MVG&x z`!0GTN=X*=f~{-b#DjPIDb_bc7x?fC#ysO?kLSYC|IGa3x0C#bFAQP#O2YIl5A$cw z8DXXg`H6z|!5x~r&+_g&PVt1B-poUneiuSU#-o(3>-o~HzlBngrE2-W?caluB|h}* z><-3ub-f&b2+?DGOP(86rfXzLLe=!tRZU$l@ibKJE@=sQZpchVmL$Bl{u~8{uCMVl zBxxiqVP(38(FIl0(_2B?wJ6DBFOa>xId!!pH5$R-lhk`p+ckI>>D!9sau0RW0-b28 zrY28QM&p#WYv|jCrmET8++k;LhR}n@mWa@HJpxVNHq2);y0)cmdx~*EkrfC)dO?iP z)D_WttcAY!tgfze$Mi1NZX4gAa1%%mvP$-(-7xms@YWg$rA|+;Yn; z+;-b-9KYyl-v4)hO;HrAtsf;#M>yLerR3q$pCXZx#k``o5g$Ddo&Gp^UUK@{mc#!N z!UtgWwXYqlVXj)RcIh8;_}Sk{_vs1h-iEzTq;zedUes*wY;jTt7WLx5uCu^dw!D3`wtE^5(c5$V!jI)(tHdea=$yn#cBho z!N{D`;}^4-?_#o?G%IPE4w-geWbE9t8SjKBn(le6%E~#F&&K zFEH6qM@fywXwA;<&LEW)ku=L``Z?eH^6NQy;v`3o9HPie%Ch9*i%*cIDTg*TSX*D` z<`4fZ*S+jJQEFgvE*867fBlsxl{1;HvU=ot>UK_DFPWRm@W-CPayjF8t+{Y}%Fex- z^S|)t#JfG`?r@0TR^0oC?}eM5&xPm^Pm)ZgtNR70p40b#43jE~yx`EWr*ihpr&uiZ zkSbxLELbdNbgm%;M^O~?wgDNKEp|w=g0|n+$Ge6sPZ*C@$n)Z0&dPKZlP0uH#Si}A zcW`d=)F5PAENT0m_xu4*GqB9mPf#r%!We^41;Mv$ZQYF!g5`3_(W6JH>zXG#;R#e# z#m2@4i^YN?M~+~O!S4Hz{lK&3eqNwa3^G~gBT5M7)h;sE{FiT9g%FTs%IH^4^W1!J zJ!~&@B&&vGEhF@v=p*lW^TlMU!03#}`A_lO9A?WstQXAZ+r-cfhI~5Z1?f}hx`;9v zM|R)I=GFg_>n*uEv<0A{mpYg0729S4Pa1d(_Pyo9E9GL&tPFAxkDGk!m;W?#Fp$J**e?Cm{7Vse_c!P=UW7hl2l_BNx@n6BHRs^?_s zh^If}g;ZN-u-0+i6Q0g|vA}bj-b+H8Fkha>6jyN82{xQ3Zk}QGf)_E)1ZF3N=XsWw zMEERhD9`)`MKSlBy2o+srk8POEZF@6gZ%d6@gAJkSZC;zAk&A~?K|?P0Qar%$Njq=F$us0hgJz*N0JMl<9pHmVpdGkeM{&MHT zygYd_ZPk&eg4^EnPF{RPN}d{&NdZAU@6lSax9Esbk*1!+Bot+KAgy(N5SH1lVO31= zeIzdvde@Pd6!16;w(oI1V4a|s6(;)zb&yALf$?}mtrkdWur83M1N&CX3=w*4NRUdP zWI&sY-t|M}*Faa*k7CIxsc1XP+Uh`uZu^#^$f^38EGr-iq>QwkC(Cm3S1ed8YqC7D z)+>B4C^^7-~x{SVebe*NGHaYX)10+iF=I9!qJ5R8jpBXswna)$@fO2h*XQ7A|J@0E()^LBa~u1 z8t*??$<{4BKTx~^Yb|wEA+^95jrU>SA}7*x7TXP!h`bz7!O0}&*pK}zs}k<~&7WtK zkLdfbZ)zQ>>zZT7jv<6#cXyX-ue}y22OHERNifE+TrMfgl8=5W@WN+%@cp1;F)30( z*Ec+G^m+cLj|e5u;|!rCSG?z6!JFSnbb%v3{0>h4(#zQTckko)+rJH;DpYRvbA*l< z_M?^DFmIp8YIZvx+<5}8IC?jA?RlZNem~df$n%tMxvnPoA=enGK_=j_bZw6igX|(t zr_5(_ma!#@j#MWDH7NENW4I(g!lYOw22b60xUR>?!EMup9`E-ZJlBsfDkk5clAfkm z7ihZ%tqs<8IM-7xBYB#lvOv|;q$WeDNb|QV#8=EfM7m&UJI8dog6sPOtI)2uC?VP0 z+@#;%!bjsV$BvzN6n{obP4nyr35}tuD?$vct!}Vf&ggB2{L{ZB`<~a*w+K_fWIkUaq+o615=N5?Z0~My`NdaJ<{6i=N%V?(F{tlQiu<}X zLfqr%k&|rw`yXL?_gnE-1jL6vP5<{j2=g0&WsWB!zu8^|A$OtaEf-N1hc3 z7nzLLFb3}2UFDK=i+j&_jvpEH>Uow8mZWJ4xFNp??S7pj0U}M?kmV)T)}%Ve6q>4P zQ7SU5xw*NO{88F(wNJAKL?%X-jH0Ac&Z$Eg}XU?3Vsw(=v z=jyAkX1QE)%PqGMW8?+TRDfi!xsJo*y9ao>`wBH=`rNDWvx?D8$NADFzes)dA&vsV zD0cqxjpP?kIre+sid%ME^b_yp=-LDHo#i8oYk0c(6bM+@Co(m+Gn+4XcKKP_cEnzD z4b%Ki-nsZN6aS;s4?e_eZm8MaU9i5sPTNA34{c44 z5F(O2A?3_-UrHq6r;hg4Pasu7-Bh?Z$WgT#d~}t9FYS)FBpY&&5Iin+EUOBw6lIxy zO%77G%SYuPMNu5&AWc`3W(6zL6&8ybI*Ame0_jjnkY$FQ0Qq&QmuPtJxQ6yB@XAVipp% zs;g-3c!2o2l0z+B02Qqgw9Lwk>WiqLpI0GNNtlJ|j1ytsUN12S(FI zXS6ZU|Mi%S*EP)R9HA3%gB_^z14pU1JC&W_viV5JJ$@9YyZ(z9&s` zd<@)u=Vxh}j;?Qc<99w6YvKNOl`D#KgSkOWNy~y51iiJ`=6|BCt#*6ND7pTOZ<5y@OPW`FzPqQxjr}0xr}I zSC3X7#j1@_5}oAe;S*H#g0h@q##4;!L4?6DBTAwZIIoGmW)WdDSs^uw)fIz~f*2)j zYni>{H}HK=o*G8Sr&cK|VTX89ciZ>MA0Iz*|eO0&hJv~pJCREEMgg~MsK1Phr>3tX!g4!_tZaWw?C(zY3S)S1E z8yRP&pzd0vOi?;P2tVWlA+mX4HZVbv96d7S-1$MmDy5+BEmvH16JPwo$53i0(ml{` zpj4zNM%ca|@|31Q2|cLXih@(kD&0JCvNTAkIPuY&vCr{vx?wv;He}?%DexUHVE2N= z?Txs6(sEzB&M_WhR#~DPl!DeqM!7(lj2Aw6%yM3n>XN#tnJpWNiNuD02@;h+o@Z=z zo+K!|kL=8MK?d?7!TUg(E2N5Ks-UhK?t9<@QVuN)oU=?OC0*x84Yb{S=&xZEfAqWm zk;8`zq;!L}9&x}$dW3@iYrk^~Kk|Jy@QKd`x^94NKd|$7UU~e!fqg6uX_|8CmY=8J z=`kDW0PS9W41h0P@{3%1`ajZLdzihC-oyHPUc$W#%lL*3F8jeJGoLS6-&g_QJ)2kX z{P7p)dO`0xUb1=@Rlj7pfO3>lR}}&UjPSyuGte@_$dt;>&>@XUS=^Bf*jzkGW(ByeS+qA^5 zGIQvyr+?mA!e1UD?l<2_vy|R@V%H23NpIQS*&Ny;ph;6hXaZI_5CW|Yv-d*%yiJTT zLpwF8dEov{Oq$?hWN%i}_02&2P!i{cf|^n(&wSeDDCNkq6|T7aFakl>cjQ^Zd{Lv* zv0nvK6{3X)h4zCA!;^8@5lat zqW|@t?DC%D+iRR@Yc9L|HvIPUD8?Tmeo$gx{moo#PBX99G3j|W_D!Or*kDmTjCsUF zT6tVlBxxWD5Fv$VsoNg!1JTv=UZ8`et}8mpGtQ^qh}= z+Vbzd<1&o7i)J~@>qEn=zmDe150IZI(W@CT{t($!Z{_qazntP!#kr#?GLf|BTCV!l zk8tK!UP-h8qf5-#5k0*2rodu(D*-U7Knejukeew^HGm|`$HWkL>D8Njp!+;8&z>=u zMZi8U%h9$SSw11r>VU$NnUW9#c`_w<%X{pn*hr>~$|=!X>TZEjU~Na1rR>ay+-5P~ zB{8c=rAWj#sH6`ZEH{`ngveyNj&+W*D9DSHw&{r>;Jibrgt9bv4_Q`H6y;#&A3Owx zz7|T8rsKh2+PlG;GcyPQ(R+dqaIPRt$8^0P*p=RqWCu&)!T?D zA+#tZP+GB=Z*t##J4hiZ@|>#fhMs-yG!LD*m!dF?#wj62Qj?PD3xp6+N--Wy*xlLY zp)>cgvNCAErIg641nOadzvnrmk2mx$+n_mKF@524dEmAuAs$RInl`L4 zaZb?oHFZ-HykuqNC`S)pj`KZ74_(5c^{Z&QilRKus92>)3y1;l16n0Cjb*;9u&x^D zKmmUAXZ{)&JAUom+q~yPyL{6#3_JDJEEanp4N@hbG$wwEP+Qb~4-FyS3c!h5#M>zBUd^y>PG1-X~cIvC?tz~oT9DjMMHCg(HREBs&8SQ0+lsd9 z59TQ)SynCUs~c?ZZV`p1Zgz;?;e2@P1tN98xt{T8%BYyobi1H>d{C^f9;T`XTa}?R zM8K$$aI|K3cAlnRpykl^AP7f{g9At3_ZU?Uro^G8x9!2a7z67+SRwF8p_!Ibx_;mY z`5;KMF)><-e9Y?fFbL1e^aL?ldTS}mh!h1v4t*k|lqi)_mTM$whS1R2q3zq|g&l+( ztc?T`tqe(a#iQokzB6LJTp+JvNVG3anSJPEa7wYf<;hrY>F<0mZsd8mZwS$%o}N(_ zYx~Vk4NV)kw_B&P4a>TtSuVNjzJ?+lQ)W|IYw>=7J*{uB)*sC4T{pO;^cHP0+BVSE zHO_bRon!mLF7x?3r?N-0{1>}J53|l+*dl*7gOglT>w2 z)ppd4r?-K6*-G<5%BthR=2&WrlSXF%ES5Q8~hQ zp7wl&uPn=tf0he>_&xyAb;I(W1#aH6_De4w7!eQ5Xzt%3SGUo&9k<5k^6X1b@Z$A* zD9b71a+NYKajqV^f(cEjzd%v04t`sG;73+o!>5vaDe{7*u2E9pyrXL)P219S%^=HA z8k6e5nl-}u^binvmU$w*kCeq%B)N&vq=^C%85b)<3yWexl1R!ddF&7?%cft^Z6uL| z6xVBrp1t`N>#OTH>p&;Nym~=#G{+uJ=f#Q92<>3^6!#x}Q6dpc(wSw)NwRFWq28L>|0X zBOel|Ylhu$2umd=#RZJc$g)A_0g~R?p;iKk^3$pI`ikKZqWuoO=1MbL|&?nh%`X0H8PqpY5Q&KRcNF>c>mo_2pFno`2#j zH$QajVC;qW{v9UCsTZGRrsp66b<^R!BN9lAp$QR9V06>9xGOIqh6EuycIPvM74)LU zWSZSYvtLL0iq6FOaA0%040BW>S(#41K@PIDH)yrTn&1b6Hz9lSJf*EA-VNpk^RJ%w z#GY{L6!VlhT1EO^(>sfGmU^*-U`ca{P>L)!|#ll8LGA+FEXlS$Ln76Ebh7Q+|bp_Zn9WB%(jP}*^;iUSuA!~-?)PL{PaNamMPv_ zvaDb^UlPyUOx=Db(@Dx~ca9JdsRU9)p8Zt8qU$;O_{E?Fm!O5>l~>OR(eoES{%?8e zQ#QyhKg_3B{vE5o@FJ$2XMFtz?U@A-dEmSLoXh{r*>42o$x+nJ5+wyj=lE!8 z{`l{i-F^?_%a4PQC?y$kv9_Ipm-?5zU z0D@!3MtI-RZrw?9eVaLz@#`W^_UnUo7gW`=O*@Gc_V z8A9+(&VH2ftv9pNJK_gEM0)1qEI#xx_`8n~cWAiiV%8)NRT3dDCydca=)j#5|ZU& zaE=i|@RPrMGfEkZPU-ueWi@AOc_nF*@Sd}mp%XPU0hNOMs-r~bdE#CFCn_5tBE6Ec z{<6m-GsW?@d@G^zn2T01I;C3HyzI&gSZkS13QlibLYgML_v|GHIb50;f*V9T%XZd3<5Tz1&-%#cwHVz#jIBFVU$V;A=36s5HK!F>Uswu z27Xu5?BKnmDA%~;;weH0tapSc+1_i}y0A%WTcq^lqX|Kt9O&}|j;n`QnXHf{>A}2* z<6+V)LnS!_kP&e|5IEUqa>jXa3BBvM_Jqg!8m$G>@hW*be$>387?GD5ZNDT6hjR^y(&X8Q5G_fnsH!D- zUXm3lQ8@DaB4R9Q8jp7+Kli>r;q>V{Sk5cFH>BAKv_49nrT8#}6fs72=iAJio~l{k zyr=6eo$C>1(CPfrAAFIjs&K(`WaTdEZpn)e--ES|yH0O#=nc;&ecWX%Zad9C9{u+u zZ~6nWBRTV1&a(UWcQC&3IHPM1arnEQ%_T4X_x!JWHqhGe!1;?=E|=^r_t==+$=+;_ zS6p;Ic{=8c_f8Qq$GU(}fxpn#z;mvqyXq*rI~QpC2CZ}6-`$E38tVlzNvZnteN08vWve2v9o`Pd7@ z?dw2%6l95EceYDYwWvhXyM{C?2qEHvLnfZtY!@E|LP?s>B&3<4^Y!4w{dML^8QA>O zuu-$DAib z!hE)iwH=Ac(6U6!44q`4BryiM#!}=HoV9dai_saI7al}OgZG2D?T4>>4wK16MD#%E zKXWJ6HaHuwHlVa7#)K?2-1?<6{PchLH9#Tu<<1*8{{4Ud1mE(UXL0q#yBM8;h$xvL zgyxHrwg|B& zF@qF9NrMpLmEbwPEqc_$=!NvF3z8^S8 zNR$X9reOBAjH5s5hr*!9=qOCelHPf|cZ|xM-nN{o4sk-Bqv;ov#e}{e z>@3^fGurQ!7^0(Yxh zE^@Y6;p+8{#d7)Rd3km~)|4WUWF`IQGVG-@gn-#>PTh3$z9r8!b?wR11dk$m!E#=s zw4`l^J|y? zCq5sz>GAym>GH3>w8HD3v|x2*gTC)cR6^7CC<$+Q*Lkvy!@TyI*+CBZ2>H_4p};tw zEy;4jKim?y)53S(wETwie*JIG@tx;CP476bcM3Ft$|cszWe5(V>R&8SQnKi{$Uw&b8H-E{4K zDc>_Gzf#Jd{ELR=JR*do>pTm)N5qpCIjwb|9HYq?NrIwbQeJ}hmc^n5IUcA6K~iQZ zz3(}G;yNUn<-A7gbfCz`$U_gEW_x>=$6a<6tzD4k6HYCUu)cjCS#DVE?qwN=8bsGE z2ndq2;I8eAOVk9#1#H)&v|x8OCwhm}g5Fp77|`hyt>KQ@nB(dk0lANc)cfVwJi233K57hqSDCJ6i6{<(d;2$=rw39!3&fL z!;8j1n&v#^KmQCn4(|BbpB?7;p+97rs)0&^z+>6k+T!Iee>wj8>oLY)5>LIXSi0H1 zSx1jfBuX2M$$8y%Gx8*7zF0CYGy1M4gbsl3c|lH=_87CqVm_lRQx?mPkA1q~o1U3c zcMGEE2mf6Q-}@9u{|WmxQ3@}5R1#_01#b*@BBv>n@#?_XedZIH-TglJ{5^OVsoOj7 z2I{USoZDq`Z`j_u!0vpP>4*NFi%(uU zT+1y(gV+a)6TRY5`?ch#7uQ?XaU@|rQE!jzofg&3t zWlEw_c4kwqm^SEm0U?Hhrc@rO;OMcF6xoDj}RW~EoG@u*(Dr4 zbYjS@MiXXxGwODY%O-;mDnzi}qIAS$35gmZqK2TTmd#*jrc-X^KfSqtO7Ju4#DIFaA6?{>;yE@&E0oDTBz|Eg<2r;06TO!<8;B)Rkm z`5RtD`iAErzx`RPzv-LV>vq|A-785@+76Sep^D!1ct7-U6fz=IhDr=l8@jHg zb=_kx5Mm_wfOms(Piu|Vin?BqrbCC@vPhZFD~NGu1Ew@x@5zn~1)ROzK}EQ-QlOPY zNKO9*!{}S8{ni267Gvt35-d*9Hk zQEF0?qSU|=uIdhFJ&XB*u4`E==B%zx4t_oi+IES8;Mokxqbk|R6Rb@;?wu7he&taW z?`?JYL1nz_Eyxq3S;@V#0;L0OTahIxF(^jaf@--p>`c8yrI#})EAHHuC>;g_CP|r; z(|_{w4dr->3qyC{f6Dp|K9U+m*H)Oc7}_dpjdeXj`=P&Ima^kuU2*Vl_xo=pO>;i| z-~Joc_4Iwus2n&|YinzqIdg_DfBDNuosniaQEGnU7hcT^o}>8f4>kLFpyJ0~G9mR>5Aa>Dxtz&p1!oLnwjg7fDd;7|Y8eSF8OkI_^u!3X3MP8?L&o6p~gQj*QBb3^q!Pe8y*xk@6$ zfC|2` z@@$NEf!;QlOtG`Q%f`krl0>q#b%CNxhtj;46vddnukj(EbYwnTFdnVpf+dlfEKBKa zPuF|OEN6Rmfh^00DrPpq2S5()+(HV30Bgg3Gt0r@oqdYwc=GTeIh=ZzIrso9p&Sx4X2gYljh zn9K}2vs5IBLzFDpH*ESu&SjrXeE()NMhgq7pM4+Z#nsxKYubV==+YJ|D$`k zB!TaHWh|OGN*WO2QMu~lZuq{hpM#8x$pJq{M33{$!2|CXf<$NZeNEd6M#Y2> zK+6PW!19MD9Vhj`GjMMptluiHqhYfW_eI)*NG&{MwEF<;wId)w-|V3QQ(~9(rH6* z@X%t7%T_meV77*K2`ZPUMBuuPG}Xi)XgW`3#w0>x#={pW21v9-nt()u3d8 zbubw{@*oX)o}z4v?FS;?s4VGROPS~NE})Vy^o8_2MVS$!1JN@bXV@NE-;yL>`GQzK zd_nH1d;atPxaHt`@e6N$8m({nPyg4a`MEbgmH+U|HxK%u=?ZW9z8em}2crz=h)$BP z0w0DJ*1!0}Po(Q=s;V8D;Pj5BU+|y*)l=#Fj$in(ryhVL^WT3T`O_ay-E>UTj0`Qe6tUJ^qA=gq+oBcw{HtH!S*C^_h>x{{-20`s4Szt9V|z!_Eh)hbl#4b0Q*;KqDC^vHGt6-0;un|}mF$%}#CpJj?XAMfh`nn4F}ki>_tN#gT-kWaRi z{r}5#N2C1fqAv5r^1vE1Nd!VEyboU&^|AJAnFC*q=D07EbeHaa-RpieOK4XuJvD`h0DPmT}wk|QmTH2>js)RsG--m65kO08A7`M->xf# z!n#4B>RiO6ip-1=A`blyePA@o_w!3j`==jZ^gS=8t~-|PNCLg4@`-}mj71uoJhrWJ)5a%LNNOpD?EEWs2 z67;raJS{L;Mp0-4iutUx5m-FGe zu4X*hzivKUw{07w4lL@5&JJ$vX)1w$>)qgyRMl*4okQ+d_I>nZ#qc(@&H;hW_M~P& zg?6^KaK0tTmd4h||4)18&SOcEmf@i+@nqFX?C4p=ruR{TT&2+YEY`9mPAgO)9Lg~VeqINNI_s_qdsje zEXzU_ZSIG4^<{2OnHWpEQB5Tm&$=xLQLwfndoa=vFD7Uumlh*OMbyf+dSVXjZ|>;L zgtHyqH)s5kTSiRFP03eXoHPonI+SXGrjL7tA6hr3g7?iDbm$$+95^p0=H*N&5~$4c z+8!v{u>0AcAcSTd_eiJkG2+}r-;a!gLsGAM=HoBF!?^*aHUIL9pL3dzFVZaAI2`_xJZ0S6SB9gkmjB z(;nwKq>-dw+_Iima>($fze0%2vMorJv9=K*DIHTkaXc)n^Fs7+I3BT`z07TOzx?7i zFlu7#2fDt=?J43(mLC#ACUObv_pedHGWG)@6t*=`a>m*IN`;JSey_*#J9>M=G&CZ# ztqCPHUDva28_V2!oxNZ2er;iy+C8I9@7I+$N|79o4@|oorm@2ad8w-~MmGx`X{nX# z++moW(IKrA$o92c35OCEXPb}lFic2Uuhhr60aSAsRKhX#MQx5KY1N-LzUND)3se}>U9xPiBC|C@)y z14SgH2u!;hl(BT((_CW=gB#dQyQ{>b_q_$Kkc=zq!vxXyl{Uu{JUSbRmoaTj+ zHx9>pw6%QmH-F1KpK(sIeD|LirJ2TCxFB1p3hR2}_VyM1XgM7ZR5ns6SgQzOLn+O? zY#1wFzCrfW9xW~J?%(imc*o7{fHD#x70%hG{`1*mRMXAGm{D3|jX{4^;b2f&vHaac ztpSO`YJ*WD&UDP@V{2=ylKssqTsIQy@=3}wpN~`#p-RT-7HcfAZqyo{(W5r^i5@-H zO?WcCg^T8bvkvDRLqAb+e%9}h3Lo{B5B)$&g)Pi@e||=rs`$9aJf(tCe6sEuXU_AC zb#3m@4;ZURx!_}yw)j+#LQy50mvhTtml7!rm4r5mN+QM3URSrsI&b*AkZQP6pH!M6 z;!1sn9sB8)b>48DCDn#H+eg>(V%>hw2q~E71?zf3@JJ!i)^a%f7yD`YUP>gWRG~Q@ z-chqBUn)eg6@Cin$WPe5Fb^Kl>^2U%zAg$&W#lYY+Ql-M-(Eqvvou(hohI z8841Hrp0*Zj%A%c>Ot>^9kRNQlno(y-oAbN@*d=u|Mo3!9{z{E>xe00l*8EzH8PDF zg%AlLBSlNU9lDN?B1Su$F&w|$gRD${cKknSR4)7=%0-cMy~A3=wx#z>hF_*kk8_RE zKZqVZ&V7kWl_a1**Sq%3;IZ!IIg=8fq)kFR$@o%zZdZ!c z0&t$_lyjHJY^kspI`s%Ow&h|t@WOFut)KOV`2b*j>=HGupKH0aZ2U+0zd_B4kpU8F~j5#$hCeMva7oAN^${#wTi2 ztNtX7lBzJek&+6hWy2_gKz~HJYL*}r0?E|dXA2^wjL`}+?l8tuI(3!6be(x`K?F4R zMS5h7LYb$25`f@y%YfG%#XK#D(?3`8rSILkj_r`K#&Dh!N+?26NM+E@5Mv|?fykyU zh>&o~Q8$M#?FLoGvW68A4f3}FKhOWrK4z6jP9TLKZV{m+X>J>Fr47Yrl#%%4;ncb~ zwb6uaL!co*XDvBYN+~$2Ntb;QT&{ymICL|i84Y>xi z9xjbE&{s`||H1mg0 z$lC6ckfr4IZEao_f{#=gQIq50 zVvdNCDW#=E_2#C%ze$DZ3sOt=e+AyBW)P=(sD+rD2|#ZiwM>G=7hX;6#4cgMY0K#} zx9^oQVmn7Ev^1vi3Dd=#8Ej7u0lz+{OwMRR4hYrL_q*%K5~9T}AC~z_uTsu*7W#e% zt;g`0slwxleU!|!|JzJRk?Hpvl^P_(cqFfZwM2{-AJ8U`eUCONEvTDkt>PKQ8m1ki zFr+x6q~)iFKcMTI73dm0H8rV=HJU7+(=mW!e2=CD!QFoMM3FA}hM&?Ll~NJviF!Q} zD#)DAb8Bf<5)ho06Gj_GbH^MGD5;4#vzvO(=lL1UIxQ!(v^dkFPzYJCrVZ~Ohc*}0 zbY9U~qojOJsd6NSjQ1X?Kq+`QKF~SGVDB!{mYxtR&L)(+!q&3#@B|a?vKGrcJWl4Iu;+ zisNZUNpQ|J9n(egWQ<@9rz@r$`q~!2dm5!GX$!|maw**0?5-JmQdDwn$C#^N-8}th z+rH*~b_I3A7{>eM{Fln~6z zf^*Gr5x8oZ`Z~4FK3S-_{Z3;XoA)?p@mpZ4o-e;_PKD=RHM7BWZoaoq+Nai_HJ?4M zgD-ycijrH`pjMZ>kD8EDUQGE~q=uIfA0uCU`Rkld2c}*z&rPUUN@?fKHIul_FP!G% zwZW?8<+e;nYYavke5?qeFBVtdlX6RzCwsV%_ab~~ou@+w4{U(Rw8^*q4K5y3! zu#7~=rje?3Yfbw(vfsaEiz{Q_aXPP1o9jpCCXg9WRN1l%_jj*3pAL-uz}P>Xr1!%y zTkd!z6wl4gD`HCQUn!Q=v#l)*v+H_NN@!^~&ds9V`;Fc17D(v9w&X3*GQCyR6bZF@ zB#v!c*fxKiZ)#;euUPBQN;k;~PxFt*2ZX3h(~haLY)c@QjCyarl9rMcrBn`wL+cQf z6)Dw~WW{_>rTxS2#+Jw=5TqCxhIYP2Ga|HW<{WHP5_dOuPYF*kUqdyUiJt>$s5w$a zGwgeuUsB=W@Q%(o3ZdnrTxvhMjQEfkMu*dlex1(EX=Gk!w3?WD%eroKva+RS2B@{b z>ERmA8B2$#k#YKp;3HPHhmub-HMi6#V-;`SyuH>IM7rUQ;3I~_vdn-artgVh`#e66 z&*Smo^uZ>**82IZd>)_22SYTe>*w)#d>)?~{|l1VOtA`?_#XfO002ovPDHLkV1i?~ B{`LR> From 9ac2de563afaa25ee34c91c62d1528e22fd77037 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 14 Feb 2015 01:47:17 +0100 Subject: [PATCH 175/314] Added license file for contributed resources. --- LICENSE-EXCLUSIONS | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 LICENSE-EXCLUSIONS diff --git a/LICENSE-EXCLUSIONS b/LICENSE-EXCLUSIONS new file mode 100644 index 00000000..00f20517 --- /dev/null +++ b/LICENSE-EXCLUSIONS @@ -0,0 +1,9 @@ +############################################################################## + +logo.png (commit: 8867629) (c) by razarosu (MCF) + +logo.png (commit: 8867629) is licensed under a +Creative Commons Attribution-NoDerivatives 4.0 International License. + +You should have received a copy of the license along with this +work. If not, see . From fcefaf6413438b5cca4d76652c0f521380c18cbe Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 14 Feb 2015 02:26:05 +0100 Subject: [PATCH 176/314] Fixed commands on servers... --- .../lunatrius/schematica/command/CommandSchematicaBase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java index c7295fb6..53535dd1 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java @@ -2,6 +2,7 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; public abstract class CommandSchematicaBase extends CommandBase { @Override @@ -12,6 +13,6 @@ public int getRequiredPermissionLevel() { @Override public boolean canCommandSenderUseCommand(ICommandSender sender) { // TODO: add logic for the client side when ready - return super.canCommandSenderUseCommand(sender); + return super.canCommandSenderUseCommand(sender) || (sender instanceof EntityPlayerMP && getRequiredPermissionLevel() <= 0); } } From 275d4832d35fb56382b9379431ba0e01234fe530 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 14 Feb 2015 02:29:27 +0100 Subject: [PATCH 177/314] Move DEFAULT_ICON to the SchematicUtil class to make it available on the server. --- .../lunatrius/schematica/world/SchematicWorld.java | 2 -- .../schematica/world/schematic/SchematicUtil.java | 12 +++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 18147439..828d4353 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -46,8 +46,6 @@ public int compare(ItemStack itemStackA, ItemStack itemStackB) { } }; - public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); - private ISchematic schematic; public final MBlockPos position = new MBlockPos(); diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index b35e142c..5a472857 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -2,7 +2,7 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; @@ -13,6 +13,8 @@ import java.io.IOException; public final class SchematicUtil { + public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); + public static NBTTagCompound readTagCompoundFromFile(File file) throws IOException { try { return CompressedStreamTools.readCompressed(new FileInputStream(file)); @@ -48,17 +50,17 @@ public static ItemStack getIconFromName(String iconName) { return icon; } - return SchematicWorld.DEFAULT_ICON.copy(); + return DEFAULT_ICON.copy(); } public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { - ItemStack icon = SchematicWorld.DEFAULT_ICON.copy(); + ItemStack icon = DEFAULT_ICON.copy(); if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { icon.readFromNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); if (icon.getItem() == null) { - icon = SchematicWorld.DEFAULT_ICON.copy(); + icon = DEFAULT_ICON.copy(); } } @@ -72,6 +74,6 @@ public static ItemStack getIconFromFile(File file) { Reference.logger.error("Failed to read schematic icon!", e); } - return SchematicWorld.DEFAULT_ICON.copy(); + return DEFAULT_ICON.copy(); } } From d40fae4e3dfbab184a9afe0ff3085fabe4aaeabd Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 14 Feb 2015 03:02:12 +0100 Subject: [PATCH 178/314] Fix transfer for schematic files with dimensions that are a multiple of 16. --- .../lunatrius/schematica/handler/DownloadHandler.java | 3 ++- .../schematica/network/transfer/SchematicTransfer.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java index 40f7381f..75badae0 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -52,7 +52,7 @@ private void processQueue() { return; } - Reference.logger.warn(String.format("%s's download timed out, retrying (#%d)", player.getDisplayName(), transfer.retries)); + Reference.logger.warn(String.format("%s's download timed out, retrying (#%d)", player.getDisplayName().getFormattedText(), transfer.retries)); sendChunk(player, transfer); transfer.timeout = 0; @@ -79,6 +79,7 @@ private void sendBegin(EntityPlayerMP player, SchematicTransfer transfer) { private void sendChunk(EntityPlayerMP player, SchematicTransfer transfer) { transfer.setState(SchematicTransfer.State.CHUNK); + Reference.logger.trace("Sending chunk " + transfer.baseX + "," + transfer.baseY + "," + transfer.baseZ); MessageDownloadChunk message = new MessageDownloadChunk(transfer.schematic, transfer.baseX, transfer.baseY, transfer.baseZ); PacketHandler.INSTANCE.sendTo(message, player); } diff --git a/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java b/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java index cdc7a25f..11e856e8 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java +++ b/src/main/java/com/github/lunatrius/schematica/network/transfer/SchematicTransfer.java @@ -48,15 +48,15 @@ public boolean confirmChunk(final int chunkX, final int chunkY, final int chunkZ setState(State.CHUNK_WAIT); this.baseX += Constants.SchematicChunk.WIDTH; - if (this.baseX > this.width) { + if (this.baseX >= this.width) { this.baseX = 0; this.baseY += Constants.SchematicChunk.HEIGHT; - if (this.baseY > this.height) { + if (this.baseY >= this.height) { this.baseY = 0; this.baseZ += Constants.SchematicChunk.LENGTH; - if (this.baseZ > this.length) { + if (this.baseZ >= this.length) { setState(State.END_WAIT); return false; } From fab32cca9df32187d52707490f7abd1abef35392 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 14 Feb 2015 03:12:31 +0100 Subject: [PATCH 179/314] Missed a few. --- .../lunatrius/schematica/command/CommandSchematicaDownload.java | 2 +- .../lunatrius/schematica/command/CommandSchematicaRemove.java | 2 +- .../github/lunatrius/schematica/handler/DownloadHandler.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 4e514755..fd1fb4f2 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -71,7 +71,7 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE final EntityPlayerMP player = (EntityPlayerMP) sender; final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (!FileUtils.contains(directory, filename)) { - Reference.logger.error(player.getDisplayName() + " has tried to download the file " + filename); + Reference.logger.error(player.getDisplayName().getFormattedText() + " has tried to download the file " + filename); throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 3a1e82f0..2f122340 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -68,7 +68,7 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); File file = new File(schematicDirectory, filename); if (!FileUtils.contains(schematicDirectory, file)) { - Reference.logger.error(player.getDisplayName() + " has tried to download the file " + filename); + Reference.logger.error(player.getDisplayName().getFormattedText() + " has tried to download the file " + filename); throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java index 75badae0..22b0c25c 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -48,7 +48,7 @@ private void processQueue() { if (!transfer.state.isWaiting()) { if (++transfer.timeout >= Constants.Network.TIMEOUT) { if (++transfer.retries >= Constants.Network.RETRIES) { - Reference.logger.warn(String.format("%s's download was dropped!", player.getDisplayName())); + Reference.logger.warn(String.format("%s's download was dropped!", player.getDisplayName().getFormattedText())); return; } From 065b16d4d41dbf317bd0ad333a518615f5c35b62 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 15 Feb 2015 23:38:20 +0100 Subject: [PATCH 180/314] Added entity related methods to the API. Added a null check when adding a tile entity to the schematic. Added entities to the alpha schematic format. They're not loaded by Schematica but may be used by other tools. --- .../lunatrius/schematica/api/ISchematic.java | 24 ++++++++++- .../schematica/api/package-info.java | 2 +- .../nbt/NBTConversionException.java | 18 ++++++++ .../lunatrius/schematica/nbt/NBTHelper.java | 36 ++++++++++++++-- .../schematica/nbt/TileEntityException.java | 9 ---- .../schematica/proxy/CommonProxy.java | 24 +++++++++-- .../schematica/world/WorldDummy.java | 39 +++++++++++++++++ .../world/schematic/SchematicAlpha.java | 16 ++++++- .../schematica/world/storage/Schematic.java | 42 ++++++++++++++++++- 9 files changed, 190 insertions(+), 20 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java create mode 100644 src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java index 129c400b..28716fb3 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.api; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; @@ -37,7 +38,7 @@ public interface ISchematic { TileEntity getTileEntity(BlockPos pos); /** - * returns a list of all tile entities in the schematic. + * Returns a list of all tile entities in the schematic. * * @return all tile entities. */ @@ -58,6 +59,27 @@ public interface ISchematic { */ void removeTileEntity(BlockPos pos); + /** + * Returns a list of all entities in the schematic. + * + * @return all entities. + */ + List getEntities(); + + /** + * Adds an entity to the schematic if it's not a player. + * + * @param entity the entity to add. + */ + void addEntity(Entity entity); + + /** + * Removes an entity from the schematic. + * + * @param entity the entity to remove. + */ + void removeEntity(Entity entity); + /** * Retrieves the icon that will be used to save the schematic. * diff --git a/src/api/java/com/github/lunatrius/schematica/api/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/package-info.java index b0818b08..4ec3c2a1 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/package-info.java +++ b/src/api/java/com/github/lunatrius/schematica/api/package-info.java @@ -1,4 +1,4 @@ -@API(owner = "Schematica", apiVersion = "1.0", provides = "SchematicaAPI") +@API(owner = "Schematica", apiVersion = "1.1", provides = "SchematicaAPI") package com.github.lunatrius.schematica.api; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java new file mode 100644 index 00000000..1da9cc54 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java @@ -0,0 +1,18 @@ +package com.github.lunatrius.schematica.nbt; + +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; + +public class NBTConversionException extends Exception { + public NBTConversionException(String message, Throwable cause) { + super(message, cause); + } + + public NBTConversionException(TileEntity tileEntity, Throwable cause) { + super(String.valueOf(tileEntity), cause); + } + + public NBTConversionException(Entity entity, Throwable cause) { + super(String.valueOf(entity), cause); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index e77a8475..6165556e 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.nbt; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.world.WorldDummy; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.nbt.NBTTagCompound; @@ -86,11 +87,11 @@ public static NBTTagCompound writeEntitiesToCompound(final List entities return compound; } - public static TileEntity reloadTileEntity(TileEntity tileEntity) throws TileEntityException { + public static TileEntity reloadTileEntity(TileEntity tileEntity) throws NBTConversionException { return reloadTileEntity(tileEntity, 0, 0, 0); } - public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, int offsetY, int offsetZ) throws TileEntityException { + public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, int offsetY, int offsetZ) throws NBTConversionException { if (tileEntity == null) { return null; } @@ -102,10 +103,37 @@ public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, in tileEntity = TileEntity.createAndLoadEntity(tileEntityCompound); final BlockPos pos = tileEntity.getPos(); tileEntity.setPos(pos.add(-offsetX, -offsetY, -offsetZ)); - } catch (Exception e) { - throw new TileEntityException(tileEntity, e); + } catch (Throwable t) { + throw new NBTConversionException(tileEntity, t); } return tileEntity; } + + public static Entity reloadEntity(Entity entity) throws NBTConversionException { + return reloadEntity(entity, 0, 0, 0); + } + + public static Entity reloadEntity(Entity entity, int offsetX, int offsetY, int offsetZ) throws NBTConversionException { + if (entity == null) { + return null; + } + + try { + final NBTTagCompound entityCompound = new NBTTagCompound(); + if (entity.writeToNBTOptional(entityCompound)) { + entity = EntityList.createEntityFromNBT(entityCompound, WorldDummy.instance()); + + if (entity != null) { + entity.posX -= offsetX; + entity.posY -= offsetY; + entity.posZ -= offsetZ; + } + } + } catch (Throwable t) { + throw new NBTConversionException(entity, t); + } + + return entity; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java b/src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java deleted file mode 100644 index e7c0451b..00000000 --- a/src/main/java/com/github/lunatrius/schematica/nbt/TileEntityException.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.lunatrius.schematica.nbt; - -import net.minecraft.tileentity.TileEntity; - -public class TileEntityException extends Exception { - public TileEntityException(TileEntity tileEntity, Throwable cause) { - super(String.valueOf(tileEntity), cause); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 9ecbdf84..36e3be5a 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -9,8 +9,8 @@ import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.handler.QueueTickHandler; +import com.github.lunatrius.schematica.nbt.NBTConversionException; import com.github.lunatrius.schematica.nbt.NBTHelper; -import com.github.lunatrius.schematica.nbt.TileEntityException; import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.SchematicWorld; @@ -19,9 +19,11 @@ import com.github.lunatrius.schematica.world.storage.Schematic; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -31,6 +33,7 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import java.io.File; +import java.util.List; public abstract class CommonProxy { public boolean isSaveEnabled = true; @@ -106,8 +109,8 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, try { final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); schematic.setTileEntity(localPos, reloadedTileEntity); - } catch (TileEntityException tee) { - Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), tee); + } catch (NBTConversionException nce) { + Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), nce); schematic.setBlockState(localPos, Blocks.bedrock.getDefaultState()); } } @@ -118,6 +121,21 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, } } } + + final int minX1 = localMinX | (chunkX << 4); + final int minZ1 = localMinZ | (chunkZ << 4); + final int maxX1 = localMaxX | (chunkX << 4); + final int maxZ1 = localMaxZ | (chunkZ << 4); + final AxisAlignedBB bb = AxisAlignedBB.fromBounds(minX1, minY, minZ1, maxX1 + 1, maxY + 1, maxZ1 + 1); + final List entities = world.getEntitiesWithinAABB(Entity.class, bb); + for (Entity entity : entities) { + try { + final Entity reloadedEntity = NBTHelper.reloadEntity(entity, minX, minY, minZ); + schematic.addEntity(reloadedEntity); + } catch (NBTConversionException nce) { + Reference.logger.error(String.format("Error while trying to save entity '%s'!", entity), nce); + } + } } public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, BlockPos from, BlockPos to) { diff --git a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java new file mode 100644 index 00000000..4be30b95 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java @@ -0,0 +1,39 @@ +package com.github.lunatrius.schematica.world; + +import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; +import net.minecraft.profiler.Profiler; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +public class WorldDummy extends World { + private static WorldDummy instance; + + protected WorldDummy(ISaveHandler saveHandler, WorldInfo worldInfo, WorldProvider worldProvider, Profiler profiler, boolean client) { + super(saveHandler, worldInfo, worldProvider, profiler, client); + } + + @Override + protected IChunkProvider createChunkProvider() { + return null; + } + + @Override + protected int getRenderDistanceChunks() { + return 0; + } + + public static WorldDummy instance() { + if (instance == null) { + final WorldSettings worldSettings = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); + final WorldInfo worldInfo = new WorldInfo(worldSettings, "FakeWorld"); + instance = new WorldDummy(new SaveHandlerSchematic(), worldInfo, new WorldProviderSchematic(), new Profiler(), false); + } + + return instance; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 57569ce9..999a535c 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -8,6 +8,7 @@ import com.github.lunatrius.schematica.world.storage.Schematic; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -20,6 +21,7 @@ import net.minecraftforge.fml.common.registry.GameData; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Set; @@ -168,6 +170,18 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { } } + final NBTTagList entityList = new NBTTagList(); + final List entities = schematic.getEntities(); + for (Entity entity : entities) { + try{ + final NBTTagCompound entityCompound = new NBTTagCompound(); + if (entity.writeToNBTOptional(entityCompound)) { + entityList.appendTag(entityCompound); + } }catch(Throwable t){ + Reference.logger.fatal("wat", t); + } + } + PreSchematicSaveEvent event = new PreSchematicSaveEvent(mappings); MinecraftForge.EVENT_BUS.post(event); @@ -182,7 +196,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { if (extra) { tagCompound.setByteArray(Names.NBT.ADD_BLOCKS, extraBlocksNibble); } - tagCompound.setTag(Names.NBT.ENTITIES, new NBTTagList()); + tagCompound.setTag(Names.NBT.ENTITIES, entityList); tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, nbtMapping); final NBTTagCompound extendedMetadata = event.extendedMetadata; diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index 057d9c5f..cab80cf9 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -3,6 +3,8 @@ import com.github.lunatrius.schematica.api.ISchematic; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -22,6 +24,7 @@ public class Schematic implements ISchematic { private final short[][][] blocks; private final byte[][][] metadata; private final List tileEntities = new ArrayList(); + private final List entities = new ArrayList(); private final int width; private final int height; private final int length; @@ -96,7 +99,9 @@ public void setTileEntity(final BlockPos pos, final TileEntity tileEntity) { removeTileEntity(pos); - this.tileEntities.add(tileEntity); + if (tileEntity != null) { + this.tileEntities.add(tileEntity); + } } @Override @@ -111,6 +116,41 @@ public void removeTileEntity(final BlockPos pos) { } } + @Override + public List getEntities() { + return this.entities; + } + + @Override + public void addEntity(final Entity entity) { + if (entity == null || entity.getUniqueID() == null || entity instanceof EntityPlayer) { + return; + } + + for (final Entity e : this.entities) { + if (entity.getUniqueID().equals(e.getUniqueID())) { + return; + } + } + + this.entities.add(entity); + } + + @Override + public void removeEntity(final Entity entity) { + if (entity == null || entity.getUniqueID() == null) { + return; + } + + final Iterator iterator = this.entities.iterator(); + while (iterator.hasNext()) { + final Entity e = iterator.next(); + if (entity.getUniqueID().equals(e.getUniqueID())) { + iterator.remove(); + } + } + } + @Override public ItemStack getIcon() { return this.icon; From 4d9d812e4d34721637658c72f99ce64356c5be37 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 16 Feb 2015 00:14:25 +0100 Subject: [PATCH 181/314] Missed some formatting... --- .../schematica/world/schematic/SchematicAlpha.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 999a535c..3a1fb9be 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -173,12 +173,13 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { final NBTTagList entityList = new NBTTagList(); final List entities = schematic.getEntities(); for (Entity entity : entities) { - try{ - final NBTTagCompound entityCompound = new NBTTagCompound(); - if (entity.writeToNBTOptional(entityCompound)) { - entityList.appendTag(entityCompound); - } }catch(Throwable t){ - Reference.logger.fatal("wat", t); + try { + final NBTTagCompound entityCompound = new NBTTagCompound(); + if (entity.writeToNBTOptional(entityCompound)) { + entityList.appendTag(entityCompound); + } + } catch (Throwable t) { + Reference.logger.error(String.format("Entity %s failed to save, skipping!", entity), t); } } From 8b559b85ffb9475eeddc5d8ee88b2095625ae984 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 16 Feb 2015 02:26:06 +0100 Subject: [PATCH 182/314] Fixed schematics with invalid metadata not loading. --- .../schematica/world/schematic/SchematicAlpha.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 3a1fb9be..338a4bc6 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -79,7 +79,13 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { } final Block block = BLOCK_REGISTRY.getObjectById(blockID); - schematic.setBlockState(pos.set(x, y, z), block.getStateFromMeta(meta)); + pos.set(x, y, z); + try { + final IBlockState blockState = block.getStateFromMeta(meta); + schematic.setBlockState(pos, blockState); + } catch (Exception e) { + Reference.logger.error(String.format("Could not set block state at %s to %s with metadata %d", pos, BLOCK_REGISTRY.getNameForObject(block), meta), e); + } } } } From b3cc7931b71bb56e3ba2501210e9db317a53b0ea Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Feb 2015 21:54:17 +0100 Subject: [PATCH 183/314] Updated the year in the LICENSE file. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index f8a21387..04f0f698 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Jadran "Lunatrius" Kotnik +Copyright (c) 2014-2015 Jadran "Lunatrius" Kotnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From ee04fff619018ddc3ef409328a387e7c17550486 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Feb 2015 23:08:51 +0100 Subject: [PATCH 184/314] Moved the geometry tesselator into LunatriusCore. Extracted the overlay code into a simple method. --- gradle.properties | 4 +- .../client/renderer/RenderSchematic.java | 75 ++++--- .../client/renderer/TessellatorShape.java | 199 ------------------ .../client/renderer/vertex/VertexFormats.java | 13 -- 4 files changed, 44 insertions(+), 247 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java diff --git a/gradle.properties b/gradle.properties index a9773024..e6653ad7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,10 @@ version_major=1 version_minor=7 version_micro=5 version_minecraft=1.8 -version_forge=11.14.1.1309 +version_forge=11.14.1.1321 version_minforge=11.14.0.1237 version_mappings=stable_16 -version_lunatriuscore=1.1.2.22 +version_lunatriuscore=1.1.2.23 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 0b9ba05d..a8519604 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -1,5 +1,7 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.core.client.renderer.GeometryMasks; +import com.github.lunatrius.core.client.renderer.GeometryTessellator; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.Schematica; @@ -78,7 +80,6 @@ public class RenderSchematic extends RenderGlobal implements IWorldAccess, IReso private final Minecraft mc; private final Profiler profiler; private final RenderManager renderManager; - private final TessellatorShape tessellator = new TessellatorShape(0x200000); private final MBlockPos tmp = new MBlockPos(); private SchematicWorld world; private Set chunksToUpdate = Sets.newLinkedHashSet(); @@ -176,48 +177,22 @@ public void setWorldAndLoadRenderers(final SchematicWorld world) { public void onRenderWorldLast(RenderWorldLastEvent event) { EntityPlayerSP player = this.mc.thePlayer; if (player != null) { + this.profiler.startSection("schematica"); ClientProxy.setPlayerData(player, event.partialTicks); + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final boolean isRenderingSchematic = schematic != null && schematic.isRendering; - this.profiler.startSection("schematica"); this.profiler.startSection("schematic"); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - - if (schematic != null && schematic.isRendering) { + if (isRenderingSchematic) { GlStateManager.pushMatrix(); renderSchematic(schematic, event.partialTicks); GlStateManager.popMatrix(); } this.profiler.endStartSection("guide"); - if (ClientProxy.isRenderingGuide || schematic != null && schematic.isRendering) { + if (ClientProxy.isRenderingGuide || isRenderingSchematic) { GlStateManager.pushMatrix(); - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - - this.tessellator.setTranslation(-ClientProxy.playerPosition.x, -ClientProxy.playerPosition.y, -ClientProxy.playerPosition.z); - - if (ClientProxy.isRenderingGuide) { - this.tessellator.startQuads(); - this.tessellator.drawCuboid(ClientProxy.pointA, TessellatorShape.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - this.tessellator.drawCuboid(ClientProxy.pointB, TessellatorShape.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - this.tessellator.draw(); - } - - this.tessellator.startLines(); - if (ClientProxy.isRenderingGuide) { - this.tessellator.drawCuboid(ClientProxy.pointA, TessellatorShape.QUAD_ALL, 0.75f, 0.0f, 0.0f, 0.25f); - this.tessellator.drawCuboid(ClientProxy.pointB, TessellatorShape.QUAD_ALL, 0.0f, 0.0f, 0.75f, 0.25f); - this.tessellator.drawCuboid(ClientProxy.pointMin, ClientProxy.pointMax, TessellatorShape.QUAD_ALL, 0.0f, 0.75f, 0.0f, 0.5f); - } - if (schematic != null && schematic.isRendering) { - this.tmp.set(schematic.position).add(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1); - this.tessellator.drawCuboid(schematic.position, this.tmp, TessellatorShape.LINE_ALL, 0.75f, 0.0f, 0.75f, 0.5f); - } - this.tessellator.draw(); - - GlStateManager.disableBlend(); - GlStateManager.enableTexture2D(); + renderOverlay(schematic, isRenderingSchematic); GlStateManager.popMatrix(); } @@ -248,6 +223,40 @@ private void renderSchematic(final SchematicWorld schematic, final float partial } } + private void renderOverlay(SchematicWorld schematic, boolean isRenderingSchematic) { + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + + final GeometryTessellator tessellator = GeometryTessellator.getInstance(); + tessellator.setTranslation(-ClientProxy.playerPosition.x, -ClientProxy.playerPosition.y, -ClientProxy.playerPosition.z); + tessellator.setDelta(ConfigurationHandler.blockDelta); + + if (ClientProxy.isRenderingGuide) { + tessellator.startQuads(); + tessellator.drawCuboid(ClientProxy.pointA, GeometryMasks.Quad.ALL, 0xBF0000, 0x3F); + tessellator.drawCuboid(ClientProxy.pointB, GeometryMasks.Quad.ALL, 0x0000BF, 0x3F); + tessellator.draw(); + } + + tessellator.startLines(); + if (ClientProxy.isRenderingGuide) { + tessellator.drawCuboid(ClientProxy.pointA, GeometryMasks.Line.ALL, 0xBF0000, 0x3F); + tessellator.drawCuboid(ClientProxy.pointB, GeometryMasks.Line.ALL, 0x0000BF, 0x3F); + tessellator.drawCuboid(ClientProxy.pointMin, ClientProxy.pointMax, GeometryMasks.Line.ALL, 0x00BF00, 0x7F); + } + if (isRenderingSchematic) { + this.tmp.set(schematic.position).add(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1); + tessellator.drawCuboid(schematic.position, this.tmp, GeometryMasks.Line.ALL, 0xBF00BF, 0x7F); + } + tessellator.draw(); + + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + } + private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.enableCull(); this.profiler.endStartSection("culling"); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java deleted file mode 100644 index ec089d26..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/TessellatorShape.java +++ /dev/null @@ -1,199 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer; - -import com.github.lunatrius.schematica.client.renderer.vertex.VertexFormats; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.util.BlockPos; -import org.lwjgl.opengl.GL11; - -public class TessellatorShape extends Tessellator { - public static final int QUAD_DOWN = 0x01; - public static final int QUAD_UP = 0x02; - public static final int QUAD_NORTH = 0x04; - public static final int QUAD_SOUTH = 0x08; - public static final int QUAD_WEST = 0x10; - public static final int QUAD_EAST = 0x20; - public static final int QUAD_ALL = QUAD_DOWN | QUAD_UP | QUAD_NORTH | QUAD_SOUTH | QUAD_WEST | QUAD_EAST; - - public static final int LINE_DOWN_WEST = 0x11; - public static final int LINE_UP_WEST = 0x12; - public static final int LINE_DOWN_EAST = 0x21; - public static final int LINE_UP_EAST = 0x22; - public static final int LINE_DOWN_NORTH = 0x05; - public static final int LINE_UP_NORTH = 0x06; - public static final int LINE_DOWN_SOUTH = 0x09; - public static final int LINE_UP_SOUTH = 0x0A; - public static final int LINE_NORTH_WEST = 0x14; - public static final int LINE_NORTH_EAST = 0x24; - public static final int LINE_SOUTH_WEST = 0x18; - public static final int LINE_SOUTH_EAST = 0x28; - public static final int LINE_ALL = LINE_DOWN_WEST | LINE_UP_WEST | LINE_DOWN_EAST | LINE_UP_EAST | LINE_DOWN_NORTH | LINE_UP_NORTH | LINE_DOWN_SOUTH | LINE_UP_SOUTH | LINE_NORTH_WEST | LINE_NORTH_EAST | LINE_SOUTH_WEST | LINE_SOUTH_EAST; - - private int mode = -1; - - public TessellatorShape(final int size) { - super(size); - } - - public void setTranslation(final double x, final double y, final double z) { - getWorldRenderer().setTranslation(x, y, z); - } - - public void startQuads() { - start(GL11.GL_QUADS); - } - - public void startLines() { - start(GL11.GL_LINES); - } - - public void start(final int mode) { - this.mode = mode; - getWorldRenderer().startDrawing(mode); - getWorldRenderer().setVertexFormat(VertexFormats.ABSTRACT); - } - - @Override - public int draw() { - this.mode = -1; - return super.draw(); - } - - public void drawCuboid(final BlockPos pos, final int sides, final float red, final float green, final float blue, final float alpha) { - drawCuboid(pos, pos, sides, red, green, blue, alpha); - } - - public void drawCuboid(final BlockPos begin, final BlockPos end, final int sides, final float red, final float green, final float blue, final float alpha) { - if (this.mode == -1 || sides == 0) { - return; - } - - final double x0 = begin.getX() - ConfigurationHandler.blockDelta; - final double y0 = begin.getY() - ConfigurationHandler.blockDelta; - final double z0 = begin.getZ() - ConfigurationHandler.blockDelta; - final double x1 = end.getX() + 1 + ConfigurationHandler.blockDelta; - final double y1 = end.getY() + 1 + ConfigurationHandler.blockDelta; - final double z1 = end.getZ() + 1 + ConfigurationHandler.blockDelta; - - if (this.mode == GL11.GL_QUADS) { - drawQuads(x0, y0, z0, x1, y1, z1, sides, red, green, blue, alpha); - } else if (this.mode == GL11.GL_LINES) { - drawLines(x0, y0, z0, x1, y1, z1, sides, red, green, blue, alpha); - } else { - throw new IllegalStateException("Unsupported mode!"); - } - } - - private void drawQuads(final double x0, final double y0, final double z0, final double x1, final double y1, final double z1, final int sides, final float red, final float green, final float blue, final float alpha) { - final WorldRenderer worldRenderer = getWorldRenderer(); - worldRenderer.setColorRGBA_F(red, green, blue, alpha); - - if ((sides & QUAD_DOWN) != 0) { - worldRenderer.addVertex(x1, y0, z0); - worldRenderer.addVertex(x1, y0, z1); - worldRenderer.addVertex(x0, y0, z1); - worldRenderer.addVertex(x0, y0, z0); - } - - if ((sides & QUAD_UP) != 0) { - worldRenderer.addVertex(x1, y1, z0); - worldRenderer.addVertex(x0, y1, z0); - worldRenderer.addVertex(x0, y1, z1); - worldRenderer.addVertex(x1, y1, z1); - } - - if ((sides & QUAD_NORTH) != 0) { - worldRenderer.addVertex(x1, y0, z0); - worldRenderer.addVertex(x0, y0, z0); - worldRenderer.addVertex(x0, y1, z0); - worldRenderer.addVertex(x1, y1, z0); - } - - if ((sides & QUAD_SOUTH) != 0) { - worldRenderer.addVertex(x0, y0, z1); - worldRenderer.addVertex(x1, y0, z1); - worldRenderer.addVertex(x1, y1, z1); - worldRenderer.addVertex(x0, y1, z1); - } - - if ((sides & QUAD_WEST) != 0) { - worldRenderer.addVertex(x0, y0, z0); - worldRenderer.addVertex(x0, y0, z1); - worldRenderer.addVertex(x0, y1, z1); - worldRenderer.addVertex(x0, y1, z0); - } - - if ((sides & QUAD_EAST) != 0) { - worldRenderer.addVertex(x1, y0, z1); - worldRenderer.addVertex(x1, y0, z0); - worldRenderer.addVertex(x1, y1, z0); - worldRenderer.addVertex(x1, y1, z1); - } - } - - private void drawLines(final double x0, final double y0, final double z0, final double x1, final double y1, final double z1, final int sides, final float red, final float green, final float blue, final float alpha) { - final WorldRenderer worldRenderer = getWorldRenderer(); - worldRenderer.setColorRGBA_F(red, green, blue, alpha); - - if ((sides & LINE_DOWN_WEST) != 0) { - worldRenderer.addVertex(x0, y0, z0); - worldRenderer.addVertex(x0, y0, z1); - } - - if ((sides & LINE_UP_WEST) != 0) { - worldRenderer.addVertex(x0, y1, z0); - worldRenderer.addVertex(x0, y1, z1); - } - - if ((sides & LINE_DOWN_EAST) != 0) { - worldRenderer.addVertex(x1, y0, z0); - worldRenderer.addVertex(x1, y0, z1); - } - - if ((sides & LINE_UP_EAST) != 0) { - worldRenderer.addVertex(x1, y1, z0); - worldRenderer.addVertex(x1, y1, z1); - } - - if ((sides & LINE_DOWN_NORTH) != 0) { - worldRenderer.addVertex(x0, y0, z0); - worldRenderer.addVertex(x1, y0, z0); - } - - if ((sides & LINE_UP_NORTH) != 0) { - worldRenderer.addVertex(x0, y1, z0); - worldRenderer.addVertex(x1, y1, z0); - } - - if ((sides & LINE_DOWN_SOUTH) != 0) { - worldRenderer.addVertex(x0, y0, z1); - worldRenderer.addVertex(x1, y0, z1); - } - - if ((sides & LINE_UP_SOUTH) != 0) { - worldRenderer.addVertex(x0, y1, z1); - worldRenderer.addVertex(x1, y1, z1); - } - - if ((sides & LINE_NORTH_WEST) != 0) { - worldRenderer.addVertex(x0, y0, z0); - worldRenderer.addVertex(x0, y1, z0); - } - - if ((sides & LINE_NORTH_EAST) != 0) { - worldRenderer.addVertex(x1, y0, z0); - worldRenderer.addVertex(x1, y1, z0); - } - - if ((sides & LINE_SOUTH_WEST) != 0) { - worldRenderer.addVertex(x0, y0, z1); - worldRenderer.addVertex(x0, y1, z1); - } - - if ((sides & LINE_SOUTH_EAST) != 0) { - worldRenderer.addVertex(x1, y0, z1); - worldRenderer.addVertex(x1, y1, z1); - } - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java deleted file mode 100644 index 2f9157bc..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/vertex/VertexFormats.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer.vertex; - -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; - -public final class VertexFormats { - public static final VertexFormat ABSTRACT = new VertexFormat(); - - static { - ABSTRACT.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); - ABSTRACT.setElement(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4)); - } -} From 5d42343f8dbb8baec26266de73e646912b0a4d84 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 23 Feb 2015 00:15:50 +0100 Subject: [PATCH 185/314] Removed a useless constructor. Removed a few useless variables. --- .../client/renderer/RenderSchematic.java | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index a8519604..1d399fca 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -83,7 +83,7 @@ public class RenderSchematic extends RenderGlobal implements IWorldAccess, IReso private final MBlockPos tmp = new MBlockPos(); private SchematicWorld world; private Set chunksToUpdate = Sets.newLinkedHashSet(); - private List renderInfos = Lists.newArrayListWithCapacity(CHUNKS); + private List renderInfos = Lists.newArrayListWithCapacity(CHUNKS); private ViewFrustum viewFrustum; private double frustumUpdatePosX = Double.MIN_VALUE; private double frustumUpdatePosY = Double.MIN_VALUE; @@ -480,15 +480,12 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin } this.profiler.endStartSection("renderlistcamera"); - final double x = PLAYER_POSITION_OFFSET.x; - final double y = PLAYER_POSITION_OFFSET.y; - final double z = PLAYER_POSITION_OFFSET.z; - this.renderContainer.initialize(x, y, z); + this.renderContainer.initialize(posX, posY, posZ); this.profiler.endStartSection("culling"); - final BlockPos posEye = new BlockPos(x, y + viewEntity.getEyeHeight(), z); + final BlockPos posEye = new BlockPos(posX, posY + viewEntity.getEyeHeight(), posZ); final RenderChunk renderchunk = this.viewFrustum.getRenderChunk(posEye); - final BlockPos blockpos = new BlockPos(MathHelper.floor_double(x) & ~0xF, MathHelper.floor_double(y) & ~0xF, MathHelper.floor_double(z) & ~0xF); + final BlockPos blockpos = new BlockPos(MathHelper.floor_double(posX) & ~0xF, MathHelper.floor_double(posY) & ~0xF, MathHelper.floor_double(posZ) & ~0xF); this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || posX != this.lastViewEntityX || posY != this.lastViewEntityY || posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw; this.lastViewEntityX = posX; @@ -513,13 +510,13 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin if (renderChunk != null && camera.isBoundingBoxInFrustum(renderChunk.boundingBox)) { renderChunk.setFrameIndex(frameCount); - renderInfoList.add(new ContainerLocalRenderInformation(renderChunk, null, 0, null)); + renderInfoList.add(new ContainerLocalRenderInformation(renderChunk, null, 0)); } } } } else { boolean add = false; - final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, null, 0, null); + final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, null, 0); final Set visibleSides = getVisibleSides(posEye); if (!visibleSides.isEmpty() && visibleSides.size() == 1) { @@ -555,7 +552,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, posChunk, side); if ((!renderChunksMany || !renderInfo.setFacing.contains(side.getOpposite())) && (!renderChunksMany || facing == null || renderChunk.getCompiledChunk().isVisible(facing.getOpposite(), side)) && neighborRenderChunk != null && neighborRenderChunk.setFrameIndex(frameCount) && camera.isBoundingBoxInFrustum(neighborRenderChunk.boundingBox)) { - final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation(neighborRenderChunk, side, renderInfo.counter + 1, null); + final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation(neighborRenderChunk, side, renderInfo.counter + 1); renderInfoNext.setFacing.addAll(renderInfo.setFacing); renderInfoNext.setFacing.add(side); renderInfoList.add(renderInfoNext); @@ -861,15 +858,11 @@ class ContainerLocalRenderInformation { final Set setFacing; final int counter; - private ContainerLocalRenderInformation(final RenderChunk renderChunk, final EnumFacing facing, final int counter) { + ContainerLocalRenderInformation(final RenderChunk renderChunk, final EnumFacing facing, final int counter) { this.setFacing = EnumSet.noneOf(EnumFacing.class); this.renderChunk = renderChunk; this.facing = facing; this.counter = counter; } - - ContainerLocalRenderInformation(final RenderChunk p_i46249_2_, final EnumFacing p_i46249_3_, final int p_i46249_4_, final Object p_i46249_5_) { - this(p_i46249_2_, p_i46249_3_, p_i46249_4_); - } } } From ec85681f9fbac66d1fa6bbba5b122cae7b96f007 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 23 Feb 2015 03:35:39 +0100 Subject: [PATCH 186/314] Fixed the schematicaList command failing for users whose schematic folder does not exist. --- .../command/CommandSchematicaList.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 3dbf4475..c41d2289 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -3,6 +3,7 @@ import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.util.FileUtils; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; @@ -58,8 +59,20 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com LinkedList componentsToSend = new LinkedList(); - File file = Schematica.proxy.getPlayerSchematicDirectory(player, true); - final File[] files = file.listFiles(FILE_FILTER_SCHEMATIC); + File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + if (schematicDirectory == null) { + Reference.logger.info(String.format("Unable to determine the schematic directory for player %s", player)); + throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); + } + + if (!schematicDirectory.exists()) { + if (!schematicDirectory.mkdirs()) { + Reference.logger.info(String.format("Could not create player schematic directory %s", schematicDirectory.getAbsolutePath())); + throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); + } + } + + final File[] files = schematicDirectory.listFiles(FILE_FILTER_SCHEMATIC); for (File path : files) { if (currentFile >= pageStart && currentFile < pageEnd) { String fileName = FilenameUtils.removeExtension(path.getName()); From 2d67929e64289bcca28cb6b2230a1d40fe75926b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 24 Feb 2015 21:31:57 +0100 Subject: [PATCH 187/314] Added back overlay rendering. --- gradle.properties | 2 +- .../client/renderer/RenderSchematic.java | 219 +++++++++++------- .../SchematicBlockRendererDispatcher.java | 30 +++ .../client/renderer/ViewFrustumOverlay.java | 149 ++++++++++++ .../renderer/chunk/CompiledOverlay.java | 30 +++ .../chunk/OverlayRenderDispatcher.java | 41 ++++ .../SchematicChunkRenderContainer.java | 23 ++ .../SchematicChunkRenderContainerList.java | 43 ++++ .../SchematicChunkRenderContainerVbo.java | 107 +++++++++ .../overlay/ISchematicRenderChunkFactory.java | 10 + .../renderer/chunk/overlay/RenderOverlay.java | 174 ++++++++++++++ .../chunk/overlay/RenderOverlayList.java | 26 +++ .../chunk/proxy/SchematicRenderChunkList.java | 33 +++ .../chunk/proxy/SchematicRenderChunkVbo.java | 33 +++ .../schematica/proxy/ClientProxy.java | 28 ++- .../schematica/world/SchematicWorld.java | 8 + src/main/resources/META-INF/schematica_at.cfg | 12 + 17 files changed, 878 insertions(+), 90 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainer.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java diff --git a/gradle.properties b/gradle.properties index e6653ad7..31f2ef24 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ version_minecraft=1.8 version_forge=11.14.1.1321 version_minforge=11.14.0.1237 version_mappings=stable_16 -version_lunatriuscore=1.1.2.23 +version_lunatriuscore=1.1.2.24 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 1d399fca..7370a239 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -5,6 +5,15 @@ import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.renderer.chunk.OverlayRenderDispatcher; +import com.github.lunatrius.schematica.client.renderer.chunk.container.SchematicChunkRenderContainer; +import com.github.lunatrius.schematica.client.renderer.chunk.container.SchematicChunkRenderContainerList; +import com.github.lunatrius.schematica.client.renderer.chunk.container.SchematicChunkRenderContainerVbo; +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.ISchematicRenderChunkFactory; +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlay; +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlayList; +import com.github.lunatrius.schematica.client.renderer.chunk.proxy.SchematicRenderChunkList; +import com.github.lunatrius.schematica.client.renderer.chunk.proxy.SchematicRenderChunkVbo; import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; @@ -14,32 +23,22 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.ChunkRenderContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.RenderList; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VboRenderList; -import net.minecraft.client.renderer.ViewFrustum; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; import net.minecraft.client.renderer.chunk.CompiledChunk; -import net.minecraft.client.renderer.chunk.IRenderChunkFactory; -import net.minecraft.client.renderer.chunk.ListChunkFactory; import net.minecraft.client.renderer.chunk.RenderChunk; -import net.minecraft.client.renderer.chunk.VboChunkFactory; import net.minecraft.client.renderer.chunk.VisGraph; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.culling.ICamera; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.profiler.Profiler; @@ -50,7 +49,7 @@ import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.IWorldAccess; +import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.relauncher.Side; @@ -66,7 +65,7 @@ import java.util.Set; @SideOnly(Side.CLIENT) -public class RenderSchematic extends RenderGlobal implements IWorldAccess, IResourceManagerReloadListener { +public class RenderSchematic extends RenderGlobal { public static final RenderSchematic INSTANCE = new RenderSchematic(Minecraft.getMinecraft()); public static final int RENDER_DISTANCE = 32; @@ -83,8 +82,9 @@ public class RenderSchematic extends RenderGlobal implements IWorldAccess, IReso private final MBlockPos tmp = new MBlockPos(); private SchematicWorld world; private Set chunksToUpdate = Sets.newLinkedHashSet(); + private Set overlaysToUpdate = Sets.newLinkedHashSet(); private List renderInfos = Lists.newArrayListWithCapacity(CHUNKS); - private ViewFrustum viewFrustum; + private ViewFrustumOverlay viewFrustum; private double frustumUpdatePosX = Double.MIN_VALUE; private double frustumUpdatePosY = Double.MIN_VALUE; private double frustumUpdatePosZ = Double.MIN_VALUE; @@ -97,14 +97,15 @@ public class RenderSchematic extends RenderGlobal implements IWorldAccess, IReso private double lastViewEntityPitch = Double.MIN_VALUE; private double lastViewEntityYaw = Double.MIN_VALUE; private final ChunkRenderDispatcher renderDispatcher = new ChunkRenderDispatcher(); - private ChunkRenderContainer renderContainer; + private final OverlayRenderDispatcher renderDispatcherOverlay = new OverlayRenderDispatcher(); + private SchematicChunkRenderContainer renderContainer; private int renderDistanceChunks = -1; private int countEntitiesTotal; private int countEntitiesRendered; private int countTileEntitiesTotal; private int countTileEntitiesRendered; private boolean vboEnabled = false; - private IRenderChunkFactory renderChunkFactory; + private ISchematicRenderChunkFactory renderChunkFactory; private double prevRenderSortX; private double prevRenderSortY; private double prevRenderSortZ; @@ -122,14 +123,42 @@ public RenderSchematic(final Minecraft minecraft) { this.vboEnabled = OpenGlHelper.useVbo(); if (this.vboEnabled) { - this.renderContainer = new VboRenderList(); - this.renderChunkFactory = new VboChunkFactory(); + initVbo(); } else { - this.renderContainer = new RenderList(); - this.renderChunkFactory = new ListChunkFactory(); + initList(); } } + private void initVbo() { + this.renderContainer = new SchematicChunkRenderContainerVbo(); + this.renderChunkFactory = new ISchematicRenderChunkFactory() { + @Override + public RenderChunk makeRenderChunk(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + return new SchematicRenderChunkVbo(world, renderGlobal, pos, index); + } + + @Override + public RenderOverlay makeRenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + return new RenderOverlay(world, renderGlobal, pos, index); + } + }; + } + + private void initList() { + this.renderContainer = new SchematicChunkRenderContainerList(); + this.renderChunkFactory = new ISchematicRenderChunkFactory() { + @Override + public RenderChunk makeRenderChunk(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + return new SchematicRenderChunkList(world, renderGlobal, pos, index); + } + + @Override + public RenderOverlay makeRenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + return new RenderOverlayList(world, renderGlobal, pos, index); + } + }; + } + @Override public void onResourceManagerReload(final IResourceManager resourceManager) {} @@ -174,8 +203,8 @@ public void setWorldAndLoadRenderers(final SchematicWorld world) { } @SubscribeEvent - public void onRenderWorldLast(RenderWorldLastEvent event) { - EntityPlayerSP player = this.mc.thePlayer; + public void onRenderWorldLast(final RenderWorldLastEvent event) { + final EntityPlayerSP player = this.mc.thePlayer; if (player != null) { this.profiler.startSection("schematica"); ClientProxy.setPlayerData(player, event.partialTicks); @@ -223,7 +252,7 @@ private void renderSchematic(final SchematicWorld schematic, final float partial } } - private void renderOverlay(SchematicWorld schematic, boolean isRenderingSchematic) { + private void renderOverlay(final SchematicWorld schematic, final boolean isRenderingSchematic) { GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); @@ -231,7 +260,7 @@ private void renderOverlay(SchematicWorld schematic, boolean isRenderingSchemati final GeometryTessellator tessellator = GeometryTessellator.getInstance(); tessellator.setTranslation(-ClientProxy.playerPosition.x, -ClientProxy.playerPosition.y, -ClientProxy.playerPosition.z); - tessellator.setDelta(ConfigurationHandler.blockDelta); + GeometryTessellator.setDelta(ConfigurationHandler.blockDelta); if (ClientProxy.isRenderingGuide) { tessellator.startQuads(); @@ -252,6 +281,10 @@ private void renderOverlay(SchematicWorld schematic, boolean isRenderingSchemati } tessellator.draw(); + GlStateManager.depthMask(false); + this.renderContainer.renderOverlay(); + GlStateManager.depthMask(true); + GL11.glDisable(GL11.GL_LINE_SMOOTH); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); @@ -278,7 +311,7 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { setupTerrain(entity, partialTicks, frustum, this.frameCount++, isInsideWorld(x, y, z)); this.profiler.endStartSection("updatechunks"); - updateChunks(finishTimeNano); + updateChunks(finishTimeNano / 2); this.profiler.endStartSection("terrain"); GlStateManager.matrixMode(GL11.GL_MODELVIEW); @@ -350,11 +383,9 @@ public void loadRenderers() { this.vboEnabled = OpenGlHelper.useVbo(); if (vbo && !this.vboEnabled) { - this.renderContainer = new RenderList(); - this.renderChunkFactory = new ListChunkFactory(); + initList(); } else if (!vbo && this.vboEnabled) { - this.renderContainer = new VboRenderList(); - this.renderChunkFactory = new VboChunkFactory(); + initVbo(); } if (this.viewFrustum != null) { @@ -362,7 +393,7 @@ public void loadRenderers() { } stopChunkUpdates(); - this.viewFrustum = new ViewFrustum(this.world, this.renderDistanceChunks, this, this.renderChunkFactory); + this.viewFrustum = new ViewFrustumOverlay(this.world, this.renderDistanceChunks, this, this.renderChunkFactory); final double posX = PLAYER_POSITION_OFFSET.x; final double posZ = PLAYER_POSITION_OFFSET.z; @@ -373,7 +404,9 @@ public void loadRenderers() { @Override protected void stopChunkUpdates() { this.chunksToUpdate.clear(); + this.overlaysToUpdate.clear(); this.renderDispatcher.stopChunkUpdates(); + this.renderDispatcherOverlay.stopChunkUpdates(); } @Override @@ -452,7 +485,7 @@ public String getDebugInfoTileEntities() { @Override public void setupTerrain(final Entity viewEntity, final double partialTicks, final ICamera camera, final int frameCount, final boolean playerSpectator) { - if (ConfigurationHandler.renderDistance != this.renderDistanceChunks) { + if (ConfigurationHandler.renderDistance != this.renderDistanceChunks || this.vboEnabled != OpenGlHelper.useVbo()) { loadRenderers(); } @@ -485,6 +518,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin this.profiler.endStartSection("culling"); final BlockPos posEye = new BlockPos(posX, posY + viewEntity.getEyeHeight(), posZ); final RenderChunk renderchunk = this.viewFrustum.getRenderChunk(posEye); + final RenderOverlay renderoverlay = this.viewFrustum.getRenderOverlay(posEye); final BlockPos blockpos = new BlockPos(MathHelper.floor_double(posX) & ~0xF, MathHelper.floor_double(posY) & ~0xF, MathHelper.floor_double(posZ) & ~0xF); this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || posX != this.lastViewEntityX || posY != this.lastViewEntityY || posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw; @@ -507,16 +541,18 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin for (int chunkX = -this.renderDistanceChunks; chunkX <= this.renderDistanceChunks; chunkX++) { for (int chunkZ = -this.renderDistanceChunks; chunkZ <= this.renderDistanceChunks; chunkZ++) { final RenderChunk renderChunk = this.viewFrustum.getRenderChunk(new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8)); + final RenderOverlay renderOverlay = this.viewFrustum.getRenderOverlay(new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8)); if (renderChunk != null && camera.isBoundingBoxInFrustum(renderChunk.boundingBox)) { renderChunk.setFrameIndex(frameCount); - renderInfoList.add(new ContainerLocalRenderInformation(renderChunk, null, 0)); + renderOverlay.setFrameIndex(frameCount); + renderInfoList.add(new ContainerLocalRenderInformation(renderChunk, renderOverlay, null, 0)); } } } } else { boolean add = false; - final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, null, 0); + final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, renderoverlay, null, 0); final Set visibleSides = getVisibleSides(posEye); if (!visibleSides.isEmpty() && visibleSides.size() == 1) { @@ -537,6 +573,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin } renderchunk.setFrameIndex(frameCount); + renderoverlay.setFrameIndex(frameCount); renderInfoList.add(renderInfo); } } @@ -550,9 +587,10 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin for (final EnumFacing side : EnumFacing.values()) { final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, posChunk, side); + final RenderOverlay neighborRenderOverlay = getNeighborRenderOverlay(posEye, posChunk, side); if ((!renderChunksMany || !renderInfo.setFacing.contains(side.getOpposite())) && (!renderChunksMany || facing == null || renderChunk.getCompiledChunk().isVisible(facing.getOpposite(), side)) && neighborRenderChunk != null && neighborRenderChunk.setFrameIndex(frameCount) && camera.isBoundingBoxInFrustum(neighborRenderChunk.boundingBox)) { - final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation(neighborRenderChunk, side, renderInfo.counter + 1); + final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation(neighborRenderChunk, neighborRenderOverlay, side, renderInfo.counter + 1); renderInfoNext.setFacing.addAll(renderInfo.setFacing); renderInfoNext.setFacing.add(side); renderInfoList.add(renderInfoNext); @@ -562,28 +600,30 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin } this.renderDispatcher.clearChunkUpdates(); + this.renderDispatcherOverlay.clearChunkUpdates(); final Set set = this.chunksToUpdate; + final Set set1 = this.overlaysToUpdate; this.chunksToUpdate = Sets.newLinkedHashSet(); for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { final RenderChunk renderChunk = renderInfo.renderChunk; + final RenderOverlay renderOverlay = renderInfo.renderOverlay; if (renderChunk.isNeedsUpdate() || renderChunk.isCompileTaskPending() || set.contains(renderChunk)) { this.displayListEntitiesDirty = true; - // TODO: remove? - if (false && isPositionInRenderChunk(blockpos, renderInfo.renderChunk)) { - this.profiler.startSection("build near"); - this.renderDispatcher.updateChunkNow(renderChunk); - renderChunk.setNeedsUpdate(false); - this.profiler.endSection(); - } else { - this.chunksToUpdate.add(renderChunk); - } + this.chunksToUpdate.add(renderChunk); + } + + if (renderOverlay.isNeedsUpdate() || renderOverlay.isCompileTaskPending() || set1.contains(renderOverlay)) { + this.displayListEntitiesDirty = true; + + this.overlaysToUpdate.add(renderOverlay); } } this.chunksToUpdate.addAll(set); + this.overlaysToUpdate.addAll(set1); this.profiler.endSection(); } @@ -634,6 +674,23 @@ private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final BlockPos return this.viewFrustum.getRenderChunk(offset); } + private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final BlockPos posChunk, final EnumFacing side) { + final BlockPos offset = posChunk.offset(side, 16); + if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { + return null; + } + + if (offset.getY() < 0 || offset.getY() >= 256) { + return null; + } + + if (MathHelper.abs_int(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) { + return null; + } + + return this.viewFrustum.getRenderOverlay(offset); + } + @Override protected Vector3f getViewVector(final Entity entity, final double partialTicks) { float rotationPitch = (float) (entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks); @@ -674,6 +731,7 @@ public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partia for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { if (renderInfo.renderChunk.compiledChunk.isLayerStarted(layer) && count++ < 15) { this.renderDispatcher.updateTransparencyLater(renderInfo.renderChunk); + this.renderDispatcherOverlay.updateTransparencyLater(renderInfo.renderOverlay); } } } @@ -689,11 +747,18 @@ public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partia final int step = isTranslucent ? -1 : 1; for (int index = start; index != end; index += step) { - final RenderChunk renderchunk = this.renderInfos.get(index).renderChunk; + final ContainerLocalRenderInformation renderInfo = this.renderInfos.get(index); + final RenderChunk renderChunk = renderInfo.renderChunk; + final RenderOverlay renderOverlay = renderInfo.renderOverlay; + + if (!renderChunk.getCompiledChunk().isLayerEmpty(layer)) { + count++; + this.renderContainer.addRenderChunk(renderChunk, layer); + } - if (!renderchunk.getCompiledChunk().isLayerEmpty(layer)) { + if (isTranslucent && renderOverlay != null && !renderOverlay.getCompiledChunk().isLayerEmpty(layer)) { count++; - this.renderContainer.addRenderChunk(renderchunk, layer); + this.renderContainer.addRenderOverlay(renderOverlay); } } @@ -707,44 +772,8 @@ public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partia private void renderBlockLayer(final EnumWorldBlockLayer layer) { this.mc.entityRenderer.enableLightmap(); - if (OpenGlHelper.useVbo()) { - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); - } - this.renderContainer.renderChunkLayer(layer); - if (OpenGlHelper.useVbo()) { - final List elements = DefaultVertexFormats.BLOCK.getElements(); - - for (final VertexFormatElement element : elements) { - final VertexFormatElement.EnumUsage usage = element.getUsage(); - final int index = element.getIndex(); - - switch (usage) { - case POSITION: - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); - break; - - case UV: - OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + index); - GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - break; - - case COLOR: - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GlStateManager.resetColor(); - break; - } - } - } - this.mc.entityRenderer.disableLightmap(); } @@ -769,15 +798,28 @@ public boolean hasCloudFog(final double x, final double y, final double z, final public void updateChunks(final long finishTimeNano) { this.displayListEntitiesDirty |= this.renderDispatcher.runChunkUploads(finishTimeNano); - final Iterator iterator = this.chunksToUpdate.iterator(); - while (iterator.hasNext()) { - final RenderChunk renderChunk = iterator.next(); + final Iterator chunkIterator = this.chunksToUpdate.iterator(); + while (chunkIterator.hasNext()) { + final RenderChunk renderChunk = chunkIterator.next(); if (!this.renderDispatcher.updateChunkLater(renderChunk)) { break; } renderChunk.setNeedsUpdate(false); - iterator.remove(); + chunkIterator.remove(); + } + + this.displayListEntitiesDirty |= this.renderDispatcherOverlay.runChunkUploads(finishTimeNano); + + final Iterator overlayIterator = this.overlaysToUpdate.iterator(); + while (overlayIterator.hasNext()) { + final RenderOverlay renderOverlay = overlayIterator.next(); + if (!this.renderDispatcherOverlay.updateChunkLater(renderOverlay)) { + break; + } + + renderOverlay.setNeedsUpdate(false); + overlayIterator.remove(); } } @@ -813,7 +855,8 @@ public void markBlockRangeForRenderUpdate(final int x1, final int y1, final int @Override public void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { - this.viewFrustum.markBlocksForUpdate(x1, y1, z1, x2, y2, z2); + final MBlockPos position = this.world.position; + this.viewFrustum.markBlocksForUpdate(x1 - position.x, y1 - position.y, z1 - position.z, x2 - position.x, y2 - position.y, z2 - position.z); } @Override @@ -854,13 +897,15 @@ public void setDisplayListEntitiesDirty() { @SideOnly(Side.CLIENT) class ContainerLocalRenderInformation { final RenderChunk renderChunk; + final RenderOverlay renderOverlay; final EnumFacing facing; final Set setFacing; final int counter; - ContainerLocalRenderInformation(final RenderChunk renderChunk, final EnumFacing facing, final int counter) { + ContainerLocalRenderInformation(final RenderChunk renderChunk, final RenderOverlay renderOverlay, final EnumFacing facing, final int counter) { this.setFacing = EnumSet.noneOf(EnumFacing.class); this.renderChunk = renderChunk; + this.renderOverlay = renderOverlay; this.facing = facing; this.counter = counter; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java new file mode 100644 index 00000000..61442f3a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java @@ -0,0 +1,30 @@ +package com.github.lunatrius.schematica.client.renderer; + +import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.BlockModelShapes; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; + +public class SchematicBlockRendererDispatcher extends BlockRendererDispatcher { + private final Minecraft minecraft = Minecraft.getMinecraft(); + + public SchematicBlockRendererDispatcher(final BlockModelShapes blockModelShapes, final GameSettings gameSettings) { + super(blockModelShapes, gameSettings); + } + + @Override + public boolean renderBlock(final IBlockState blockState, final BlockPos pos, final IBlockAccess blockAccess, final WorldRenderer worldRenderer) { + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final BlockPos realPos = new BlockPos(pos.getX() + schematic.position.x, pos.getY() + schematic.position.y, pos.getZ() + schematic.position.z); + final WorldClient world = this.minecraft.theWorld; + + return world.isAirBlock(realPos) && super.renderBlock(blockState, pos, blockAccess, worldRenderer); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java new file mode 100644 index 00000000..9bfbe766 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java @@ -0,0 +1,149 @@ +package com.github.lunatrius.schematica.client.renderer; + +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.ISchematicRenderChunkFactory; +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlay; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.ViewFrustum; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ViewFrustumOverlay extends ViewFrustum { + public RenderOverlay[] renderOverlays; + + public ViewFrustumOverlay(final World world, final int renderDistanceChunks, final RenderGlobal renderGlobal, final ISchematicRenderChunkFactory renderChunkFactory) { + super(world, renderDistanceChunks, renderGlobal, renderChunkFactory); + createRenderOverlays(renderChunkFactory); + } + + protected void createRenderOverlays(final ISchematicRenderChunkFactory renderChunkFactory) { + final int amount = this.countChunksX * this.countChunksY * this.countChunksZ; + this.renderOverlays = new RenderOverlay[amount]; + int count = 0; + + for (int x = 0; x < this.countChunksX; x++) { + for (int y = 0; y < this.countChunksY; y++) { + for (int z = 0; z < this.countChunksZ; z++) { + final int index = (z * this.countChunksY + y) * this.countChunksX + x; + final BlockPos pos = new BlockPos(x * 16, y * 16, z * 16); + this.renderOverlays[index] = renderChunkFactory.makeRenderOverlay(this.world, this.renderGlobal, pos, count++); + } + } + } + } + + @Override + public void deleteGlResources() { + super.deleteGlResources(); + + for (final RenderOverlay renderOverlay : this.renderOverlays) { + renderOverlay.deleteGlResources(); + } + } + + @Override + public void updateChunkPositions(final double viewEntityX, final double viewEntityZ) { + super.updateChunkPositions(viewEntityX, viewEntityZ); + + final int xx = MathHelper.floor_double(viewEntityX) - 8; + final int zz = MathHelper.floor_double(viewEntityZ) - 8; + final int yy = this.countChunksX * 16; + + for (int chunkX = 0; chunkX < this.countChunksX; chunkX++) { + final int x = getPosition(xx, yy, chunkX); + + for (int chunkZ = 0; chunkZ < this.countChunksZ; chunkZ++) { + final int z = getPosition(zz, yy, chunkZ); + + for (int chunkY = 0; chunkY < this.countChunksY; chunkY++) { + final int y = chunkY * 16; + final RenderOverlay renderOverlay = this.renderOverlays[(chunkZ * this.countChunksY + chunkY) * this.countChunksX + chunkX]; + final BlockPos blockpos = new BlockPos(x, y, z); + + if (!blockpos.equals(renderOverlay.getPosition())) { + renderOverlay.setPosition(blockpos); + } + } + } + } + } + + private int getPosition(final int xz, final int y, final int chunk) { + final int chunks = chunk * 16; + int i = chunks - xz + y / 2; + + if (i < 0) { + i -= y - 1; + } + + return chunks - i / y * y; + } + + @Override + public void markBlocksForUpdate(final int fromX, final int fromY, final int fromZ, final int toX, final int toY, final int toZ) { + super.markBlocksForUpdate(fromX, fromY, fromZ, toX, toY, toZ); + + final int x0 = MathHelper.bucketInt(fromX, 16); + final int y0 = MathHelper.bucketInt(fromY, 16); + final int z0 = MathHelper.bucketInt(fromZ, 16); + final int x1 = MathHelper.bucketInt(toX, 16); + final int y1 = MathHelper.bucketInt(toY, 16); + final int z1 = MathHelper.bucketInt(toZ, 16); + + for (int xi = x0; xi <= x1; ++xi) { + int x = xi % this.countChunksX; + + if (x < 0) { + x += this.countChunksX; + } + + for (int yi = y0; yi <= y1; ++yi) { + int y = yi % this.countChunksY; + + if (y < 0) { + y += this.countChunksY; + } + + for (int zi = z0; zi <= z1; ++zi) { + int z = zi % this.countChunksZ; + + if (z < 0) { + z += this.countChunksZ; + } + + final int index = (z * this.countChunksY + y) * this.countChunksX + x; + final RenderOverlay renderOverlay = this.renderOverlays[index]; + renderOverlay.setNeedsUpdate(true); + } + } + } + } + + public RenderOverlay getRenderOverlay(final BlockPos pos) { + int x = MathHelper.bucketInt(pos.getX(), 16); + final int y = MathHelper.bucketInt(pos.getY(), 16); + int z = MathHelper.bucketInt(pos.getZ(), 16); + + if (y >= 0 && y < this.countChunksY) { + x %= this.countChunksX; + + if (x < 0) { + x += this.countChunksX; + } + + z %= this.countChunksZ; + + if (z < 0) { + z += this.countChunksZ; + } + + final int index = (z * this.countChunksY + y) * this.countChunksX + x; + return this.renderOverlays[index]; + } else { + return null; + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java new file mode 100644 index 00000000..0169023e --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java @@ -0,0 +1,30 @@ +package com.github.lunatrius.schematica.client.renderer.chunk; + +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.util.EnumWorldBlockLayer; + +public class CompiledOverlay extends CompiledChunk { + @Override + public void setLayerStarted(final EnumWorldBlockLayer layer) { + if (layer == EnumWorldBlockLayer.TRANSLUCENT) { + super.setLayerStarted(layer); + } + } + + @Override + public void setLayerUsed(final EnumWorldBlockLayer layer) { + if (layer == EnumWorldBlockLayer.TRANSLUCENT) { + super.setLayerUsed(layer); + } + } + + @Override + public boolean isLayerStarted(final EnumWorldBlockLayer layer) { + return layer == EnumWorldBlockLayer.TRANSLUCENT && super.isLayerStarted(layer); + } + + @Override + public boolean isLayerEmpty(final EnumWorldBlockLayer layer) { + return layer == EnumWorldBlockLayer.TRANSLUCENT && super.isLayerEmpty(layer); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java new file mode 100644 index 00000000..32d99738 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java @@ -0,0 +1,41 @@ +package com.github.lunatrius.schematica.client.renderer.chunk; + +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlayList; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListenableFutureTask; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.EnumWorldBlockLayer; + +public class OverlayRenderDispatcher extends ChunkRenderDispatcher { + @Override + public ListenableFuture uploadChunk(final EnumWorldBlockLayer layer, final WorldRenderer worldRenderer, final RenderChunk renderChunk, final CompiledChunk compiledChunk) { + if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { + if (OpenGlHelper.useVbo()) { + uploadVertexBuffer(worldRenderer, renderChunk.getVertexBufferByLayer(layer.ordinal())); + } else { + uploadDisplayList(worldRenderer, ((RenderOverlayList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); + } + + worldRenderer.setTranslation(0.0, 0.0, 0.0); + return Futures.immediateFuture(null); + } else { + final ListenableFutureTask listenableFutureTask = ListenableFutureTask.create(new Runnable() { + @Override + public void run() { + uploadChunk(layer, worldRenderer, renderChunk, compiledChunk); + } + }, null); + + synchronized (this.queueChunkUploads) { + this.queueChunkUploads.add(listenableFutureTask); + return listenableFutureTask; + } + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainer.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainer.java new file mode 100644 index 00000000..46562a54 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainer.java @@ -0,0 +1,23 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.container; + +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlay; +import com.google.common.collect.Lists; +import net.minecraft.client.renderer.ChunkRenderContainer; + +import java.util.List; + +public abstract class SchematicChunkRenderContainer extends ChunkRenderContainer { + protected List renderOverlays = Lists.newArrayListWithCapacity(16 * 33 * 33); + + @Override + public void initialize(final double viewEntityX, final double viewEntityY, final double viewEntityZ) { + super.initialize(viewEntityX, viewEntityY, viewEntityZ); + this.renderOverlays.clear(); + } + + public void addRenderOverlay(final RenderOverlay renderOverlay) { + this.renderOverlays.add(renderOverlay); + } + + public abstract void renderOverlay(); +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java new file mode 100644 index 00000000..b63e29cc --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java @@ -0,0 +1,43 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.container; + +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlay; +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlayList; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.chunk.ListedRenderChunk; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.EnumWorldBlockLayer; +import org.lwjgl.opengl.GL11; + +public class SchematicChunkRenderContainerList extends SchematicChunkRenderContainer { + @Override + public void renderChunkLayer(final EnumWorldBlockLayer layer) { + if (this.initialized) { + for (final RenderChunk renderchunk : (Iterable) this.renderChunks) { + final ListedRenderChunk listedRenderChunk = (ListedRenderChunk) renderchunk; + GlStateManager.pushMatrix(); + preRenderChunk(renderchunk); + GL11.glCallList(listedRenderChunk.getDisplayList(layer, listedRenderChunk.getCompiledChunk())); + GlStateManager.popMatrix(); + } + + GlStateManager.resetColor(); + this.renderChunks.clear(); + } + } + + @Override + public void renderOverlay() { + if (this.initialized) { + for (final RenderOverlay renderOverlay : this.renderOverlays) { + final RenderOverlayList renderOverlayList = (RenderOverlayList) renderOverlay; + GlStateManager.pushMatrix(); + preRenderChunk(renderOverlay); + GL11.glCallList(renderOverlayList.getDisplayList(EnumWorldBlockLayer.TRANSLUCENT, renderOverlayList.getCompiledChunk())); + GlStateManager.popMatrix(); + } + } + + GlStateManager.resetColor(); + this.renderOverlays.clear(); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java new file mode 100644 index 00000000..dae0b9b9 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java @@ -0,0 +1,107 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.container; + +import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlay; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.util.EnumWorldBlockLayer; +import org.lwjgl.opengl.GL11; + +import java.util.List; + +public class SchematicChunkRenderContainerVbo extends SchematicChunkRenderContainer { + @Override + public void renderChunkLayer(final EnumWorldBlockLayer layer) { + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + + if (this.initialized) { + for (final RenderChunk renderChunk : (Iterable) this.renderChunks) { + final VertexBuffer vertexbuffer = renderChunk.getVertexBufferByLayer(layer.ordinal()); + GlStateManager.pushMatrix(); + preRenderChunk(renderChunk); + renderChunk.multModelviewMatrix(); + vertexbuffer.bindBuffer(); + setupArrayPointers(); + vertexbuffer.drawArrays(GL11.GL_QUADS); + GlStateManager.popMatrix(); + } + + OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); + GlStateManager.resetColor(); + this.renderChunks.clear(); + } + + final List elements = DefaultVertexFormats.BLOCK.getElements(); + + for (final VertexFormatElement element : elements) { + final VertexFormatElement.EnumUsage usage = element.getUsage(); + final int index = element.getIndex(); + + switch (usage) { + case POSITION: + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + break; + + case UV: + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + index); + GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + break; + + case COLOR: + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GlStateManager.resetColor(); + break; + } + } + } + + private void setupArrayPointers() { + GL11.glVertexPointer(3, GL11.GL_FLOAT, 28, 0L); + GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 28, 12L); + GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 28, 16L); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glTexCoordPointer(2, GL11.GL_SHORT, 28, 24L); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + } + + @Override + public void renderOverlay() { + if (this.initialized) { + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + + for (final RenderOverlay renderOverlay : this.renderOverlays) { + final VertexBuffer vertexBuffer = renderOverlay.getVertexBufferByLayer(EnumWorldBlockLayer.TRANSLUCENT.ordinal()); + GlStateManager.pushMatrix(); + preRenderChunk(renderOverlay); + renderOverlay.multModelviewMatrix(); + vertexBuffer.bindBuffer(); + setupArrayPointersOverlay(); + vertexBuffer.drawArrays(GL11.GL_QUADS); + GlStateManager.popMatrix(); + } + + OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); + GlStateManager.resetColor(); + this.renderOverlays.clear(); + + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + } + } + + private void setupArrayPointersOverlay() { + GL11.glVertexPointer(3, GL11.GL_FLOAT, 16, 0); + GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 16, 12); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java new file mode 100644 index 00000000..ecad012a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java @@ -0,0 +1,10 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.overlay; + +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.chunk.IRenderChunkFactory; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public interface ISchematicRenderChunkFactory extends IRenderChunkFactory { + RenderOverlay makeRenderOverlay(World world, RenderGlobal renderGlobal, BlockPos pos, int index); +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java new file mode 100644 index 00000000..d8c6532e --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -0,0 +1,174 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.overlay; + +import com.github.lunatrius.core.client.renderer.GeometryMasks; +import com.github.lunatrius.core.client.renderer.GeometryTessellator; +import com.github.lunatrius.core.client.renderer.vertex.VertexFormats; +import com.github.lunatrius.schematica.client.renderer.chunk.CompiledOverlay; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RegionRenderCache; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.chunk.VisGraph; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; + +import java.util.HashMap; +import java.util.Map; + +public class RenderOverlay extends RenderChunk { + private static final Map FACING_TO_QUAD = new HashMap(); + private final VertexBuffer vertexBuffer; + + public RenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + super(world, renderGlobal, pos, index); + this.vertexBuffer = OpenGlHelper.useVbo() ? new VertexBuffer(VertexFormats.ABSTRACT) : null; + } + + @Override + public VertexBuffer getVertexBufferByLayer(final int layer) { + return this.vertexBuffer; + } + + @Override + public void rebuildChunk(final float x, final float y, final float z, final ChunkCompileTaskGenerator generator) { + final CompiledOverlay compiledOverlay = new CompiledOverlay(); + final BlockPos from = getPosition(); + final BlockPos to = from.add(15, 15, 15); + generator.getLock().lock(); + RegionRenderCache regionRenderCache; + + try { + if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING) { + return; + } + + regionRenderCache = new RegionRenderCache(this.world, from.add(-1, -1, -1), to.add(1, 1, 1), 1); + generator.setCompiledChunk(compiledOverlay); + } finally { + generator.getLock().unlock(); + } + + final VisGraph visgraph = new VisGraph(); + + if (!regionRenderCache.extendedLevelsInChunkCache()) { + ++renderChunksUpdated; + + final SchematicWorld schematic = (SchematicWorld) this.world; + final World mcWorld = Minecraft.getMinecraft().theWorld; + + final EnumWorldBlockLayer layer = EnumWorldBlockLayer.TRANSLUCENT; + final WorldRenderer worldRenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); + + GeometryTessellator.setDelta(ConfigurationHandler.blockDelta); + + for (BlockPos pos : (Iterable) BlockPos.getAllInBox(from, to)) { + if (schematic.isRenderingLayer && schematic.renderingLayer != pos.getY() || !schematic.isInside(pos)) { + continue; + } + + boolean render = false; + int sides = 0; + int color = 0; + + final IBlockState schBlockState = schematic.getBlockState(pos); + final Block schBlock = schBlockState.getBlock(); + + if (schBlock.isOpaqueCube()) { + visgraph.func_178606_a(pos); + } + + final BlockPos mcPos = pos.add(schematic.position); + final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); + final Block mcBlock = mcBlockState.getBlock(); + + final boolean isAirBlock = mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock); + + if (!isAirBlock) { + if (schBlock == Blocks.air && ConfigurationHandler.highlightAir) { + render = true; + sides = GeometryMasks.Quad.ALL; + color = 0xBF00BF; + } + } + + if (!render) { + for (EnumFacing facing : EnumFacing.values()) { + if (schBlock.shouldSideBeRendered(schematic, pos.offset(facing), facing)) { + sides |= FACING_TO_QUAD.get(facing); + } + } + + if (!isAirBlock) { + if (ConfigurationHandler.highlight) { + if (schBlock != mcBlock) { + render = true; + color = 0xFF0000; + } else if (schBlock.getMetaFromState(schBlockState) != mcBlock.getMetaFromState(mcBlockState)) { + render = true; + color = 0xBF5F00; + } + } + } else if (!schematic.isAirBlock(pos)) { + if (ConfigurationHandler.highlight) { + render = true; + color = 0x00BFFF; + } + } + } + + if (render) { + if (!compiledOverlay.isLayerStarted(layer)) { + compiledOverlay.setLayerStarted(layer); + preRenderBlocks(worldRenderer, from); + } + + GeometryTessellator.drawCuboid(worldRenderer, GL11.GL_QUADS, pos, sides, color, 0x3F); + compiledOverlay.setLayerUsed(layer); + } + } + + if (compiledOverlay.isLayerStarted(layer)) { + postRenderBlocks(layer, x, y, z, worldRenderer, compiledOverlay); + } + } + + compiledOverlay.setVisibility(visgraph.computeVisibility()); + } + + @Override + public void preRenderBlocks(final WorldRenderer worldRenderer, final BlockPos pos) { + super.preRenderBlocks(worldRenderer, pos); + + worldRenderer.setVertexFormat(VertexFormats.ABSTRACT); + } + + @Override + public void deleteGlResources() { + super.deleteGlResources(); + + if (this.vertexBuffer != null) { + this.vertexBuffer.deleteGlBuffers(); + } + } + + static { + FACING_TO_QUAD.put(EnumFacing.DOWN, GeometryMasks.Quad.DOWN); + FACING_TO_QUAD.put(EnumFacing.UP, GeometryMasks.Quad.UP); + FACING_TO_QUAD.put(EnumFacing.NORTH, GeometryMasks.Quad.NORTH); + FACING_TO_QUAD.put(EnumFacing.SOUTH, GeometryMasks.Quad.SOUTH); + FACING_TO_QUAD.put(EnumFacing.WEST, GeometryMasks.Quad.WEST); + FACING_TO_QUAD.put(EnumFacing.EAST, GeometryMasks.Quad.EAST); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java new file mode 100644 index 00000000..163e4d0b --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java @@ -0,0 +1,26 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.overlay; + +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class RenderOverlayList extends RenderOverlay { + private final int displayList = GLAllocation.generateDisplayLists(1); + + public RenderOverlayList(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + super(world, renderGlobal, pos, index); + } + + public int getDisplayList(final EnumWorldBlockLayer layer, final CompiledChunk compiledChunk) { + return !compiledChunk.isLayerEmpty(layer) ? this.displayList : -1; + } + + @Override + public void deleteGlResources() { + super.deleteGlResources(); + GLAllocation.deleteDisplayLists(this.displayList); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java new file mode 100644 index 00000000..4b468a75 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -0,0 +1,33 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.proxy; + +import com.github.lunatrius.schematica.proxy.ClientProxy; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.ListedRenderChunk; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class SchematicRenderChunkList extends ListedRenderChunk { + public SchematicRenderChunkList(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + super(world, renderGlobal, pos, index); + } + + @Override + public void preRenderBlocks(final WorldRenderer worldRendererIn, final BlockPos pos) { + ClientProxy.setDispatcherSchematic(); + + super.preRenderBlocks(worldRendererIn, pos); + } + + @Override + public void postRenderBlocks(final EnumWorldBlockLayer layer, final float x, final float y, final float z, final WorldRenderer worldRenderer, final CompiledChunk compiledChunk) { + super.postRenderBlocks(layer, x, y, z, worldRenderer, compiledChunk); + + ClientProxy.setDispatcherVanilla(); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java new file mode 100644 index 00000000..509cbb01 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -0,0 +1,33 @@ +package com.github.lunatrius.schematica.client.renderer.chunk.proxy; + +import com.github.lunatrius.schematica.proxy.ClientProxy; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class SchematicRenderChunkVbo extends RenderChunk { + public SchematicRenderChunkVbo(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { + super(world, renderGlobal, pos, index); + } + + @Override + public void preRenderBlocks(final WorldRenderer worldRendererIn, final BlockPos pos) { + ClientProxy.setDispatcherSchematic(); + + super.preRenderBlocks(worldRendererIn, pos); + } + + @Override + public void postRenderBlocks(final EnumWorldBlockLayer layer, final float x, final float y, final float z, final WorldRenderer worldRenderer, final CompiledChunk compiledChunk) { + super.postRenderBlocks(layer, x, y, z, worldRenderer, compiledChunk); + + ClientProxy.setDispatcherVanilla(); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 0124c37a..13e81c98 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -3,9 +3,9 @@ import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.SchematicPrinter; -import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.client.renderer.SchematicBlockRendererDispatcher; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.InputHandler; @@ -16,6 +16,7 @@ import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; @@ -27,6 +28,7 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import java.io.File; @@ -48,6 +50,8 @@ public class ClientProxy extends CommonProxy { public static MovingObjectPosition movingObjectPosition = null; private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); + private static BlockRendererDispatcher dispatcherVanilla = null; + private static BlockRendererDispatcher dispatcherSchematic = null; private SchematicWorld schematicWorld = null; @@ -145,6 +149,14 @@ public static void moveSchematicToPlayer(SchematicWorld schematic) { } } + public static void setDispatcherSchematic() { + MINECRAFT.blockRenderDispatcher = dispatcherSchematic; + } + + public static void setDispatcherVanilla() { + MINECRAFT.blockRenderDispatcher = dispatcherVanilla; + } + @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); @@ -181,6 +193,14 @@ public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new OverlayHandler()); } + @Override + public void postInit(FMLPostInitializationEvent event) { + super.postInit(event); + + dispatcherVanilla = MINECRAFT.getBlockRendererDispatcher(); + dispatcherSchematic = new SchematicBlockRendererDispatcher(dispatcherVanilla.getBlockModelShapes(), MINECRAFT.gameSettings); + } + @Override public File getDataDirectory() { final File file = MINECRAFT.mcDataDir; @@ -202,6 +222,9 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setSchematic(null); setActiveSchematic(null); + if (MINECRAFT.theWorld != null) { + MINECRAFT.theWorld.removeWorldAccess(RenderSchematic.INSTANCE); + } playerPosition.set(0, 0, 0); orientation = null; @@ -223,7 +246,8 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, world.getWidth(), world.getHeight(), world.getLength())); - Schematica.proxy.setActiveSchematic(world); + setActiveSchematic(world); + MINECRAFT.theWorld.addWorldAccess(RenderSchematic.INSTANCE); SchematicPrinter.INSTANCE.setSchematic(world); world.isRendering = true; diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 828d4353..3dd620ff 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -409,4 +409,12 @@ public void rotate() { public String getDebugDimensions() { return "WHL: " + getWidth() + " / " + getHeight() + " / " + getLength(); } + + public boolean isInside(final BlockPos pos) { + final int x = pos.getX(); + final int y = pos.getY(); + final int z = pos.getZ(); + + return !(x < 0 || y < 0 || z < 0 || x >= getWidth() || y >= getHeight() || z >= getLength()); + } } diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index 3d3f1999..f5479510 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -1,4 +1,16 @@ # Schematica +public net.minecraft.client.Minecraft field_175618_aM # blockRenderDispatcher + +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher field_178524_h # queueChunkUploads +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178506_a(Lnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/client/renderer/vertex/VertexBuffer;)V # uploadVertexBuffer +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178510_a(Lnet/minecraft/client/renderer/WorldRenderer;ILnet/minecraft/client/renderer/chunk/RenderChunk;)V # uploadDisplayList + +public net.minecraft.client.renderer.chunk.RenderChunk field_178588_d # world +public net.minecraft.client.renderer.chunk.RenderChunk func_178573_a(Lnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/util/BlockPos;)V # preRenderBlocks +public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecraft/util/EnumWorldBlockLayer;FFFLnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/client/renderer/chunk/CompiledChunk;)V # postRenderBlocks + public net.minecraft.client.renderer.RenderGlobal func_72725_b(IIIIII)V # markBlocksForUpdate + public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk + public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag From 05122cdd506a0f9a8d65bf3a9eb60fe7238f423c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 24 Feb 2015 22:49:18 +0100 Subject: [PATCH 188/314] Removed no longer used config settings. --- .../schematica/handler/ConfigurationHandler.java | 14 -------------- .../lunatrius/schematica/reference/Names.java | 4 ---- .../resources/assets/schematica/lang/en_GB.lang | 4 ---- .../resources/assets/schematica/lang/en_US.lang | 4 ---- .../resources/assets/schematica/lang/ko_KR.lang | 4 ---- .../resources/assets/schematica/lang/no_NO.lang | 4 ---- 6 files changed, 34 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 54dcd375..acd7eaaa 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -31,8 +31,6 @@ public class ConfigurationHandler { public static final boolean HIGHLIGHT_DEFAULT = true; public static final boolean HIGHLIGHT_AIR_DEFAULT = true; public static final double BLOCK_DELTA_DEFAULT = 0.005; - public static final boolean DRAW_QUADS_DEFAULT = true; - public static final boolean DRAW_LINES_DEFAULT = true; public static final int RENDER_DISTANCE_DEFAULT = 8; public static final int PLACE_DELAY_DEFAULT = 1; public static final int TIMEOUT_DEFAULT = 10; @@ -60,8 +58,6 @@ public class ConfigurationHandler { public static boolean highlight = HIGHLIGHT_DEFAULT; public static boolean highlightAir = HIGHLIGHT_AIR_DEFAULT; public static double blockDelta = BLOCK_DELTA_DEFAULT; - public static boolean drawQuads = DRAW_QUADS_DEFAULT; - public static boolean drawLines = DRAW_LINES_DEFAULT; public static int renderDistance = RENDER_DISTANCE_DEFAULT; public static int placeDelay = PLACE_DELAY_DEFAULT; public static int timeout = TIMEOUT_DEFAULT; @@ -87,8 +83,6 @@ public class ConfigurationHandler { public static Property propHighlight = null; public static Property propHighlightAir = null; public static Property propBlockDelta = null; - public static Property propDrawQuads = null; - public static Property propDrawLines = null; public static Property propRenderDistance = null; public static Property propPlaceDelay = null; public static Property propTimeout = null; @@ -142,14 +136,6 @@ private static void loadConfiguration() { propBlockDelta.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.BLOCK_DELTA); blockDelta = propBlockDelta.getDouble(BLOCK_DELTA_DEFAULT); - propDrawQuads = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_QUADS, DRAW_QUADS_DEFAULT, Names.Config.DRAW_QUADS_DESC); - propDrawQuads.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_QUADS); - drawQuads = propDrawQuads.getBoolean(DRAW_QUADS_DEFAULT); - - propDrawLines = configuration.get(Names.Config.Category.RENDER, Names.Config.DRAW_LINES, DRAW_LINES_DEFAULT, Names.Config.DRAW_LINES_DESC); - propDrawLines.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DRAW_LINES); - drawLines = propDrawLines.getBoolean(DRAW_LINES_DEFAULT); - propRenderDistance = configuration.get(Names.Config.Category.RENDER, Names.Config.RENDER_DISTANCE, RENDER_DISTANCE_DEFAULT, Names.Config.RENDER_DISTANCE_DESC, 2, 16); propRenderDistance.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.RENDER_DISTANCE); renderDistance = propRenderDistance.getInt(RENDER_DISTANCE_DEFAULT); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 40514386..79cd736e 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -26,10 +26,6 @@ public static final class Category { public static final String HIGHLIGHT_AIR_DESC = "Highlight blocks that should be air."; public static final String BLOCK_DELTA = "blockDelta"; public static final String BLOCK_DELTA_DESC = "Delta value used for highlighting (if you experience z-fighting increase this)."; - public static final String DRAW_QUADS = "drawQuads"; - public static final String DRAW_QUADS_DESC = "Draw surface areas."; - public static final String DRAW_LINES = "drawLines"; - public static final String DRAW_LINES_DESC = "Draw outlines."; public static final String RENDER_DISTANCE = "renderDistance"; public static final String RENDER_DISTANCE_DESC = "Schematic render distance."; diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 0c561812..27b2f917 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -53,10 +53,6 @@ schematica.config.highlightAir=Highlight Air schematica.config.highlightAir.tooltip=Highlight blocks that should be air. schematica.config.blockDelta=Block Delta schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -schematica.config.drawQuads=Draw Quads -schematica.config.drawQuads.tooltip=Draw surface areas. -schematica.config.drawLines=Draw Lines -schematica.config.drawLines.tooltip=Draw outlines. # gui - config - printer schematica.config.placeDelay=Placement Delay diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 9e12eda4..d3d57ac5 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -61,10 +61,6 @@ schematica.config.highlightAir=Highlight Air schematica.config.highlightAir.tooltip=Highlight blocks that should be air. schematica.config.blockDelta=Block Delta schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). -schematica.config.drawQuads=Draw Quads -schematica.config.drawQuads.tooltip=Draw surface areas. -schematica.config.drawLines=Draw Lines -schematica.config.drawLines.tooltip=Draw outlines. schematica.config.renderDistance=Render Distance schematica.config.renderDistance.tooltip=Schematic render distance. diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index ef761c8b..d1132c8a 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -55,10 +55,6 @@ schematica.config.highlightAir=공기 표시 schematica.config.highlightAir.tooltip=공기여야 하는 블럭을 표시합니다. schematica.config.blockDelta=블럭 델타 schematica.config.blockDelta.tooltip=표시에 쓰이는 델타 값 (만약 z-fighting 이 생기면 높이세요). -schematica.config.drawQuads=표면 그리기 -schematica.config.drawQuads.tooltip=블럭 표면을 보여줍니다. -schematica.config.drawLines=선 그리기 -schematica.config.drawLines.tooltip=외곽선을 보여줍니다. # gui - config - printer schematica.config.placeDelay=놓기 지연시간 diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index fdfbcf80..1e92cf6e 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -48,10 +48,6 @@ schematica.config.highlightAir=Marker luft schematica.config.highlightAir.tooltip=Marker blokker som bør være luft. schematica.config.blockDelta=Block Delta schematica.config.blockDelta.tooltip=Delta-verdi brukt for markering (hvis du opplever z-kollisjoner, øk dette). -schematica.config.drawQuads=Tegn overflater -schematica.config.drawQuads.tooltip=Tegn overflateområder. -schematica.config.drawLines=Tegn linjer -schematica.config.drawLines.tooltip=Tegn kantlinjer. # gui - config - printer schematica.config.placeDelay=Plasseringsforsinkelse From 2c33e302735ecc18dd9a7dcadcb0ca81d6e108cf Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 25 Feb 2015 02:49:32 +0100 Subject: [PATCH 189/314] Fix for latest LunatriusCore. --- gradle.properties | 2 +- .../lunatrius/schematica/client/renderer/RenderSchematic.java | 2 +- .../schematica/client/renderer/chunk/overlay/RenderOverlay.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 31f2ef24..cc3fc135 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ version_minecraft=1.8 version_forge=11.14.1.1321 version_minforge=11.14.0.1237 version_mappings=stable_16 -version_lunatriuscore=1.1.2.24 +version_lunatriuscore=1.1.2.25 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 7370a239..f8cfa384 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -260,7 +260,7 @@ private void renderOverlay(final SchematicWorld schematic, final boolean isRende final GeometryTessellator tessellator = GeometryTessellator.getInstance(); tessellator.setTranslation(-ClientProxy.playerPosition.x, -ClientProxy.playerPosition.y, -ClientProxy.playerPosition.z); - GeometryTessellator.setDelta(ConfigurationHandler.blockDelta); + tessellator.setDelta(ConfigurationHandler.blockDelta); if (ClientProxy.isRenderingGuide) { tessellator.startQuads(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index d8c6532e..ba02ac32 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -71,7 +71,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final EnumWorldBlockLayer layer = EnumWorldBlockLayer.TRANSLUCENT; final WorldRenderer worldRenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); - GeometryTessellator.setDelta(ConfigurationHandler.blockDelta); + GeometryTessellator.setStaticDelta(ConfigurationHandler.blockDelta); for (BlockPos pos : (Iterable) BlockPos.getAllInBox(from, to)) { if (schematic.isRenderingLayer && schematic.renderingLayer != pos.getY() || !schematic.isInside(pos)) { From af2327462b915f5cb77a5319ebfa391e39b06ca5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Feb 2015 20:02:51 +0100 Subject: [PATCH 190/314] Minor optimization and a fix for IllegalArgumentException in postRenderBlocks. Fixes #77 --- .../client/renderer/chunk/overlay/RenderOverlay.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index ba02ac32..b292ae09 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -110,8 +110,8 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } } - if (!isAirBlock) { - if (ConfigurationHandler.highlight) { + if (ConfigurationHandler.highlight) { + if (!isAirBlock) { if (schBlock != mcBlock) { render = true; color = 0xFF0000; @@ -119,16 +119,14 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun render = true; color = 0xBF5F00; } - } - } else if (!schematic.isAirBlock(pos)) { - if (ConfigurationHandler.highlight) { + } else if (!schematic.isAirBlock(pos)) { render = true; color = 0x00BFFF; } } } - if (render) { + if (render && sides != 0) { if (!compiledOverlay.isLayerStarted(layer)) { compiledOverlay.setLayerStarted(layer); preRenderBlocks(worldRenderer, from); From cfc559533e089267383aacd6a52dd5b133e7fec9 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Feb 2015 20:04:29 +0100 Subject: [PATCH 191/314] Replace the quad construction loop by explicit calls (for speed) and only do so if there is anything to render. --- .../renderer/chunk/overlay/RenderOverlay.java | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index b292ae09..23ff7ef5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -24,11 +24,7 @@ import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -import java.util.HashMap; -import java.util.Map; - public class RenderOverlay extends RenderChunk { - private static final Map FACING_TO_QUAD = new HashMap(); private final VertexBuffer vertexBuffer; public RenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { @@ -104,12 +100,6 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } if (!render) { - for (EnumFacing facing : EnumFacing.values()) { - if (schBlock.shouldSideBeRendered(schematic, pos.offset(facing), facing)) { - sides |= FACING_TO_QUAD.get(facing); - } - } - if (ConfigurationHandler.highlight) { if (!isAirBlock) { if (schBlock != mcBlock) { @@ -124,6 +114,32 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun color = 0x00BFFF; } } + + if (render) { + if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) { + sides |= GeometryMasks.Quad.DOWN; + } + + if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.UP), EnumFacing.UP)) { + sides |= GeometryMasks.Quad.UP; + } + + if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) { + sides |= GeometryMasks.Quad.NORTH; + } + + if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { + sides |= GeometryMasks.Quad.SOUTH; + } + + if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) { + sides |= GeometryMasks.Quad.WEST; + } + + if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) { + sides |= GeometryMasks.Quad.EAST; + } + } } if (render && sides != 0) { @@ -160,13 +176,4 @@ public void deleteGlResources() { this.vertexBuffer.deleteGlBuffers(); } } - - static { - FACING_TO_QUAD.put(EnumFacing.DOWN, GeometryMasks.Quad.DOWN); - FACING_TO_QUAD.put(EnumFacing.UP, GeometryMasks.Quad.UP); - FACING_TO_QUAD.put(EnumFacing.NORTH, GeometryMasks.Quad.NORTH); - FACING_TO_QUAD.put(EnumFacing.SOUTH, GeometryMasks.Quad.SOUTH); - FACING_TO_QUAD.put(EnumFacing.WEST, GeometryMasks.Quad.WEST); - FACING_TO_QUAD.put(EnumFacing.EAST, GeometryMasks.Quad.EAST); - } } From 38f2ba51f881493a4a370f2f859be1c72e9f942c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Feb 2015 20:09:20 +0100 Subject: [PATCH 192/314] Only need a single BlockPos instance for both calls... --- .../schematica/client/renderer/RenderSchematic.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index f8cfa384..0b383e29 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -540,8 +540,9 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin for (int chunkX = -this.renderDistanceChunks; chunkX <= this.renderDistanceChunks; chunkX++) { for (int chunkZ = -this.renderDistanceChunks; chunkZ <= this.renderDistanceChunks; chunkZ++) { - final RenderChunk renderChunk = this.viewFrustum.getRenderChunk(new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8)); - final RenderOverlay renderOverlay = this.viewFrustum.getRenderOverlay(new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8)); + final BlockPos pos = new BlockPos((chunkX << 4) + 8, chunkY, (chunkZ << 4) + 8); + final RenderChunk renderChunk = this.viewFrustum.getRenderChunk(pos); + final RenderOverlay renderOverlay = this.viewFrustum.getRenderOverlay(pos); if (renderChunk != null && camera.isBoundingBoxInFrustum(renderChunk.boundingBox)) { renderChunk.setFrameIndex(frameCount); From e48d1ce6b645f4fc1fe5515aa961e06d4271a24b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Feb 2015 20:13:29 +0100 Subject: [PATCH 193/314] Removed unused methods/variables and an identical overridden method. --- gradle.properties | 2 +- .../client/renderer/RenderSchematic.java | 35 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/gradle.properties b/gradle.properties index cc3fc135..5c00cc9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ version_major=1 version_minor=7 version_micro=5 version_minecraft=1.8 -version_forge=11.14.1.1321 +version_forge=11.14.1.1329 version_minforge=11.14.0.1237 version_mappings=stable_16 version_lunatriuscore=1.1.2.25 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 0b383e29..6ba4b958 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -519,7 +519,6 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final BlockPos posEye = new BlockPos(posX, posY + viewEntity.getEyeHeight(), posZ); final RenderChunk renderchunk = this.viewFrustum.getRenderChunk(posEye); final RenderOverlay renderoverlay = this.viewFrustum.getRenderOverlay(posEye); - final BlockPos blockpos = new BlockPos(MathHelper.floor_double(posX) & ~0xF, MathHelper.floor_double(posY) & ~0xF, MathHelper.floor_double(posZ) & ~0xF); this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || posX != this.lastViewEntityX || posY != this.lastViewEntityY || posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw; this.lastViewEntityX = posX; @@ -628,23 +627,6 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin this.profiler.endSection(); } - private boolean isPositionInRenderChunk(final BlockPos pos, final RenderChunk renderChunk) { - final BlockPos blockPos = renderChunk.getPosition(); - if (MathHelper.abs_int(pos.getX() - blockPos.getX()) > 16) { - return false; - } - - if (MathHelper.abs_int(pos.getY() - blockPos.getY()) > 16) { - return false; - } - - if (MathHelper.abs_int(pos.getZ() - blockPos.getZ()) > 16) { - return false; - } - - return true; - } - private Set getVisibleSides(final BlockPos pos) { final VisGraph visgraph = new VisGraph(); final BlockPos posChunk = new BlockPos(pos.getX() & ~0xF, pos.getY() & ~0xF, pos.getZ() & ~0xF); @@ -692,23 +674,6 @@ private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final Bloc return this.viewFrustum.getRenderOverlay(offset); } - @Override - protected Vector3f getViewVector(final Entity entity, final double partialTicks) { - float rotationPitch = (float) (entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks); - final float rotationYaw = (float) (entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks); - - if (this.mc.gameSettings.thirdPersonView == 2) { - rotationPitch += 180.0f; - } - - final float f1 = (float) (1 / (360 / (Math.PI * 2))); - final float f2 = MathHelper.cos(-rotationYaw * f1 - (float) Math.PI); - final float f3 = MathHelper.sin(-rotationYaw * f1 - (float) Math.PI); - final float f4 = -MathHelper.cos(-rotationPitch * f1); - final float f5 = MathHelper.sin(-rotationPitch * f1); - return new Vector3f(f3 * f4, f5, f2 * f4); - } - @Override public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partialTicks, final int pass, final Entity entity) { RenderHelper.disableStandardItemLighting(); From 059060858bbb262a3f851132842c9feb7b97ebb2 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Feb 2015 20:47:43 +0100 Subject: [PATCH 194/314] Fixed tile entities (sometimes) not rendering due to wrong view point coordinates. --- .../schematica/client/renderer/RenderSchematic.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 6ba4b958..6b974581 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -417,8 +417,8 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, final int entityPass = 0; this.profiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); - this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, renderViewEntity, partialTicks); + this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRendererObj, renderViewEntity, this.mc.pointedEntity, this.mc.gameSettings, partialTicks); this.countEntitiesTotal = 0; this.countEntitiesRendered = 0; @@ -434,6 +434,10 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, TileEntityRendererDispatcher.staticPlayerY = y; TileEntityRendererDispatcher.staticPlayerZ = z; + TileEntityRendererDispatcher.instance.entityX = x; + TileEntityRendererDispatcher.instance.entityY = y; + TileEntityRendererDispatcher.instance.entityZ = z; + this.renderManager.setRenderPosition(x, y, z); this.mc.entityRenderer.enableLightmap(); From dcd84eef03a09cf19615bf58532d2996ae1e982a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Feb 2015 20:53:08 +0100 Subject: [PATCH 195/314] Chunks outside the schematic are no longer compiled (for the overlay). --- .../client/renderer/chunk/overlay/RenderOverlay.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 23ff7ef5..9ca429a8 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -14,6 +14,7 @@ import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; +import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.VisGraph; import net.minecraft.client.renderer.vertex.VertexBuffer; @@ -44,12 +45,18 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final BlockPos to = from.add(15, 15, 15); generator.getLock().lock(); RegionRenderCache regionRenderCache; + final SchematicWorld schematic = (SchematicWorld) this.world; try { if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING) { return; } + if (from.getX() < 0 || from.getZ() < 0 || from.getX() >= schematic.getWidth() || from.getZ() >= schematic.getLength()) { + generator.setCompiledChunk(CompiledChunk.DUMMY); + return; + } + regionRenderCache = new RegionRenderCache(this.world, from.add(-1, -1, -1), to.add(1, 1, 1), 1); generator.setCompiledChunk(compiledOverlay); } finally { @@ -61,7 +68,6 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun if (!regionRenderCache.extendedLevelsInChunkCache()) { ++renderChunksUpdated; - final SchematicWorld schematic = (SchematicWorld) this.world; final World mcWorld = Minecraft.getMinecraft().theWorld; final EnumWorldBlockLayer layer = EnumWorldBlockLayer.TRANSLUCENT; From 0c92728b1ce85df56531931f855093658d0bb2fb Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Feb 2015 17:26:46 +0100 Subject: [PATCH 196/314] Register the schematic dispatcher to the resource manager. Fixes #78 --- .../java/com/github/lunatrius/schematica/proxy/ClientProxy.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 13e81c98..39405800 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -17,6 +17,7 @@ import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; @@ -199,6 +200,7 @@ public void postInit(FMLPostInitializationEvent event) { dispatcherVanilla = MINECRAFT.getBlockRendererDispatcher(); dispatcherSchematic = new SchematicBlockRendererDispatcher(dispatcherVanilla.getBlockModelShapes(), MINECRAFT.gameSettings); + ((IReloadableResourceManager) MINECRAFT.getResourceManager()).registerReloadListener(dispatcherSchematic); } @Override From 36621686186822545b2658690f0eb0ab8ecbf6ce Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Feb 2015 18:18:09 +0100 Subject: [PATCH 197/314] Prevent chunks outside the schematic to rebuild, just return a blank, dummy compiled chunk. --- .../chunk/proxy/SchematicRenderChunkList.java | 30 +++++++++++++++++++ .../chunk/proxy/SchematicRenderChunkVbo.java | 30 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java index 4b468a75..75a3bc44 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -1,10 +1,13 @@ package com.github.lunatrius.schematica.client.renderer.chunk.proxy; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.ListedRenderChunk; +import net.minecraft.client.renderer.chunk.SetVisibility; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; @@ -17,6 +20,33 @@ public SchematicRenderChunkList(final World world, final RenderGlobal renderGlob super(world, renderGlobal, pos, index); } + @Override + public void rebuildChunk(final float x, final float y, final float z, final ChunkCompileTaskGenerator generator) { + generator.getLock().lock(); + + try { + if (generator.getStatus() == ChunkCompileTaskGenerator.Status.COMPILING) { + final BlockPos from = getPosition(); + final SchematicWorld schematic = (SchematicWorld) this.world; + + if (from.getX() < 0 || from.getZ() < 0 || from.getX() >= schematic.getWidth() || from.getZ() >= schematic.getLength()) { + final SetVisibility visibility = new SetVisibility(); + visibility.setAllVisible(true); + + final CompiledChunk dummy = new CompiledChunk(); + dummy.setVisibility(visibility); + + generator.setCompiledChunk(dummy); + return; + } + } + } finally { + generator.getLock().unlock(); + } + + super.rebuildChunk(x, y, z, generator); + } + @Override public void preRenderBlocks(final WorldRenderer worldRendererIn, final BlockPos pos) { ClientProxy.setDispatcherSchematic(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java index 509cbb01..5490f0b0 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -1,10 +1,13 @@ package com.github.lunatrius.schematica.client.renderer.chunk.proxy; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.chunk.SetVisibility; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; @@ -17,6 +20,33 @@ public SchematicRenderChunkVbo(final World world, final RenderGlobal renderGloba super(world, renderGlobal, pos, index); } + @Override + public void rebuildChunk(final float x, final float y, final float z, final ChunkCompileTaskGenerator generator) { + generator.getLock().lock(); + + try { + if (generator.getStatus() == ChunkCompileTaskGenerator.Status.COMPILING) { + final BlockPos from = getPosition(); + final SchematicWorld schematic = (SchematicWorld) this.world; + + if (from.getX() < 0 || from.getZ() < 0 || from.getX() >= schematic.getWidth() || from.getZ() >= schematic.getLength()) { + final SetVisibility visibility = new SetVisibility(); + visibility.setAllVisible(true); + + final CompiledChunk dummy = new CompiledChunk(); + dummy.setVisibility(visibility); + + generator.setCompiledChunk(dummy); + return; + } + } + } finally { + generator.getLock().unlock(); + } + + super.rebuildChunk(x, y, z, generator); + } + @Override public void preRenderBlocks(final WorldRenderer worldRendererIn, final BlockPos pos) { ClientProxy.setDispatcherSchematic(); From ecea9f8a6b56e79667a66b9a4a5926e4695e7611 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 7 Mar 2015 01:41:20 +0100 Subject: [PATCH 198/314] Re-implemented schematic rotation and extended it to all 6 directions. --- gradle.properties | 2 +- .../client/gui/GuiSchematicControl.java | 36 ++- .../schematica/proxy/ClientProxy.java | 2 + .../schematica/util/RotationHelper.java | 213 ++++++++++++++++++ .../schematica/world/SchematicWorld.java | 112 +-------- .../assets/schematica/lang/en_US.lang | 6 + 6 files changed, 263 insertions(+), 108 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java diff --git a/gradle.properties b/gradle.properties index 5c00cc9e..892c5b6c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version_major=1 version_minor=7 -version_micro=5 +version_micro=6 version_minecraft=1.8 version_forge=11.14.1.1329 version_minforge=11.14.0.1237 diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index ca1da510..55250c21 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -7,11 +7,16 @@ import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; +import com.github.lunatrius.schematica.util.RotationHelper; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.fml.client.config.GuiUnicodeGlyphButton; + +import java.io.IOException; public class GuiSchematicControl extends GuiScreenBase { private final SchematicWorld schematic; @@ -30,6 +35,7 @@ public class GuiSchematicControl extends GuiScreenBase { private GuiButton btnHide = null; private GuiButton btnMove = null; private GuiButton btnFlip = null; + private GuiButton btnRotateDirection = null; private GuiButton btnRotate = null; private GuiButton btnMaterials = null; @@ -88,7 +94,10 @@ public void initGui() { this.btnFlip = new GuiButton(id++, this.width - 90, this.height - 55, 80, 20, I18n.format("schematica.gui.flip")); this.buttonList.add(this.btnFlip); - this.btnRotate = new GuiButton(id++, this.width - 90, this.height - 30, 80, 20, I18n.format("schematica.gui.rotate")); + this.btnRotateDirection = new GuiButton(id++, this.width - 180, this.height - 30, 80, 20, I18n.format("schematica.gui." + ClientProxy.axisRotation.getName())); + this.buttonList.add(this.btnRotateDirection); + + this.btnRotate = new GuiUnicodeGlyphButton(id++, this.width - 90, this.height - 30, 80, 20, " " + I18n.format("schematica.gui.rotate"), "\u21bb", 2.0f); this.buttonList.add(this.btnRotate); this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, this.strMaterials); @@ -108,8 +117,8 @@ public void initGui() { this.btnMove.enabled = this.schematic != null; this.btnFlip.enabled = this.schematic != null; this.btnFlip.enabled = false; + this.btnRotateDirection.enabled = this.schematic != null; this.btnRotate.enabled = this.schematic != null; - this.btnRotate.enabled = false; this.btnMaterials.enabled = this.schematic != null; this.btnPrint.enabled = this.schematic != null && this.printer.isEnabled(); @@ -170,10 +179,16 @@ protected void actionPerformed(GuiButton guiButton) { RenderSchematic.INSTANCE.refresh(); setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); } else if (guiButton.id == this.btnFlip.id) { - this.schematic.flip(); + // TODO: implement flip logic SchematicPrinter.INSTANCE.refresh(); + } else if (guiButton.id == this.btnRotateDirection.id) { + final EnumFacing[] values = EnumFacing.values(); + ClientProxy.axisRotation = values[((ClientProxy.axisRotation.ordinal() + 1) % values.length)]; + guiButton.displayString = I18n.format("schematica.gui." + ClientProxy.axisRotation.getName()); } else if (guiButton.id == this.btnRotate.id) { - this.schematic.rotate(); + RotationHelper.INSTANCE.rotate(this.schematic, ClientProxy.axisRotation, isShiftKeyDown()); + setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); + RenderSchematic.INSTANCE.refresh(); SchematicPrinter.INSTANCE.refresh(); } else if (guiButton.id == this.btnMaterials.id) { this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); @@ -184,6 +199,19 @@ protected void actionPerformed(GuiButton guiButton) { } } + @Override + public void handleKeyboardInput() throws IOException { + super.handleKeyboardInput(); + + if (this.btnFlip.enabled) { + this.btnFlip.packedFGColour = isShiftKeyDown() ? 0xFF0000 : 0x000000; + } + + if (this.btnRotate.enabled) { + this.btnRotate.packedFGColour = isShiftKeyDown() ? 0xFF0000 : 0x000000; + } + } + @Override public void drawScreen(int par1, int par2, float par3) { // drawDefaultBackground(); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 39405800..9b4984b5 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -48,6 +48,8 @@ public class ClientProxy extends CommonProxy { public static final MBlockPos pointMin = new MBlockPos(); public static final MBlockPos pointMax = new MBlockPos(); + public static EnumFacing axisRotation = EnumFacing.UP; + public static MovingObjectPosition movingObjectPosition = null; private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); diff --git a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java new file mode 100644 index 00000000..eec50976 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java @@ -0,0 +1,213 @@ +package com.github.lunatrius.schematica.util; + +import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.world.storage.Schematic; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.IBlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3i; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; + +import java.util.List; +import java.util.Set; + +public class RotationHelper { + public static final RotationHelper INSTANCE = new RotationHelper(); + + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + private static final EnumFacing[][] ROTATION_MATRIX = new EnumFacing[6][]; + + public boolean rotate(final SchematicWorld world) { + return rotate(world, EnumFacing.UP, false); + } + + public boolean rotate(final SchematicWorld world, final EnumFacing axis, final boolean forced) { + if (world == null) { + return false; + } + + try { + final ISchematic schematic = world.getSchematic(); + final Schematic schematicRotated = rotate(schematic, axis, forced); + + updatePosition(world, axis); + + world.setSchematic(schematicRotated); + + for (final TileEntity tileEntity : world.getTileEntities()) { + world.initializeTileEntity(tileEntity); + } + + return true; + } catch (final RotationException re) { + Reference.logger.error(re.getMessage()); + } + + return false; + } + + private void updatePosition(final SchematicWorld world, final EnumFacing axis) { + switch (axis) { + case DOWN: + case UP: { + final int offset = (world.getWidth() - world.getLength()) / 2; + world.position.x += offset; + world.position.z -= offset; + break; + } + + case NORTH: + case SOUTH: { + final int offset = (world.getWidth() - world.getHeight()) / 2; + world.position.x += offset; + world.position.y -= offset; + break; + } + + case WEST: + case EAST: { + final int offset = (world.getHeight() - world.getLength()) / 2; + world.position.y += offset; + world.position.z -= offset; + break; + } + } + } + + public Schematic rotate(final ISchematic schematic, final EnumFacing axis, boolean forced) throws RotationException { + final Vec3i dimensionsRotated = rotateDimensions(axis, schematic.getWidth(), schematic.getHeight(), schematic.getLength()); + final Schematic schematicRotated = new Schematic(schematic.getIcon(), dimensionsRotated.getX(), dimensionsRotated.getY(), dimensionsRotated.getZ()); + final MBlockPos tmp = new MBlockPos(); + + for (final MBlockPos pos : MBlockPos.getAllInBox(BlockPos.ORIGIN, new BlockPos(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1))) { + final IBlockState blockState = schematic.getBlockState(pos); + final IBlockState blockStateRotated = rotateBlock(blockState, axis, forced); + schematicRotated.setBlockState(rotatePos(pos, axis, dimensionsRotated, tmp), blockStateRotated); + } + + final List tileEntities = schematic.getTileEntities(); + for (final TileEntity tileEntity : tileEntities) { + final BlockPos pos = tileEntity.getPos(); + tileEntity.setPos(new BlockPos(rotatePos(pos, axis, dimensionsRotated, tmp))); + schematicRotated.setTileEntity(tileEntity.getPos(), tileEntity); + } + + return schematicRotated; + } + + private Vec3i rotateDimensions(final EnumFacing axis, final int width, final int height, final int length) throws RotationException { + switch (axis) { + case DOWN: + case UP: + return new Vec3i(length, height, width); + + case NORTH: + case SOUTH: + return new Vec3i(height, width, length); + + case WEST: + case EAST: + return new Vec3i(width, length, height); + } + + throw new RotationException("'%s' is not a valid axis!", axis.getName()); + } + + private BlockPos rotatePos(final BlockPos pos, final EnumFacing axis, final Vec3i dimensions, final MBlockPos rotated) throws RotationException { + switch (axis) { + case DOWN: + return rotated.set(pos.getZ(), pos.getY(), dimensions.getZ() - 1 - pos.getX()); + + case UP: + return rotated.set(dimensions.getX() - 1 - pos.getZ(), pos.getY(), pos.getX()); + + case NORTH: + return rotated.set(dimensions.getX() - 1 - pos.getY(), pos.getX(), pos.getZ()); + + case SOUTH: + return rotated.set(pos.getY(), dimensions.getY() - 1 - pos.getX(), pos.getZ()); + + case WEST: + return rotated.set(pos.getX(), dimensions.getY() - 1 - pos.getZ(), pos.getY()); + + case EAST: + return rotated.set(pos.getX(), pos.getZ(), dimensions.getZ() - 1 - pos.getY()); + } + + throw new RotationException("'%s' is not a valid axis!", axis.getName()); + } + + private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing axis, boolean forced) throws RotationException { + final PropertyDirection facingProperty = getFacingProperty(blockState); + if (facingProperty == null) { + return blockState; + } + + final Comparable value = blockState.getValue(facingProperty); + if (value instanceof EnumFacing) { + final EnumFacing facing = getRotatedFacing(axis, (EnumFacing) value); + if (facingProperty.getAllowedValues().contains(facing)) { + return blockState.withProperty(facingProperty, facing); + } + } + + if (!forced) { + throw new RotationException("'%s' cannot be rotated around '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axis); + } + + return blockState; + } + + private PropertyDirection getFacingProperty(final IBlockState blockState) { + for (final IProperty prop : (Set) blockState.getProperties().keySet()) { + if (prop.getName().equals("facing")) { + if (prop instanceof PropertyDirection) { + return (PropertyDirection) prop; + } + + Reference.logger.error("'{}': {} is not an instance of {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), prop.getClass().getSimpleName(), PropertyDirection.class.getSimpleName()); + } + } + + return null; + } + + private static EnumFacing getRotatedFacing(final EnumFacing axis, final EnumFacing side) { + return ROTATION_MATRIX[axis.ordinal()][side.ordinal()]; + } + + static { + ROTATION_MATRIX[EnumFacing.DOWN.ordinal()] = new EnumFacing[] { + EnumFacing.DOWN, EnumFacing.UP, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.NORTH + }; + ROTATION_MATRIX[EnumFacing.UP.ordinal()] = new EnumFacing[] { + EnumFacing.DOWN, EnumFacing.UP, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH + }; + ROTATION_MATRIX[EnumFacing.NORTH.ordinal()] = new EnumFacing[] { + EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.DOWN, EnumFacing.UP + }; + ROTATION_MATRIX[EnumFacing.SOUTH.ordinal()] = new EnumFacing[] { + EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP, EnumFacing.DOWN + }; + ROTATION_MATRIX[EnumFacing.WEST.ordinal()] = new EnumFacing[] { + EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.EAST + }; + ROTATION_MATRIX[EnumFacing.EAST.ordinal()] = new EnumFacing[] { + EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.DOWN, EnumFacing.UP, EnumFacing.WEST, EnumFacing.EAST + }; + } + + public static class RotationException extends Exception { + public RotationException(String message, Object... args) { + super(String.format(message, args)); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 3dd620ff..4e631829 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -19,7 +19,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntitySkull; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; @@ -179,10 +178,19 @@ public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { return getBlockState(pos).getBlock().isSideSolid(this, pos, side); } + public void setSchematic(ISchematic schematic) { + this.schematic = schematic; + } + + public ISchematic getSchematic() { + return this.schematic; + } + public void initializeTileEntity(TileEntity tileEntity) { tileEntity.setWorldObj(this); tileEntity.getBlockType(); try { + tileEntity.invalidate(); tileEntity.validate(); } catch (Exception e) { Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); @@ -304,108 +312,6 @@ public boolean toggleRendering() { return this.isRendering; } - public void refreshChests() { - for (TileEntity tileEntity : this.schematic.getTileEntities()) { - if (tileEntity instanceof TileEntityChest) { - TileEntityChest tileEntityChest = (TileEntityChest) tileEntity; - tileEntityChest.adjacentChestChecked = false; - tileEntityChest.checkForAdjacentChests(); - } - } - } - - public void flip() { - // TODO - /* - int tmp; - for (int x = 0; x < this.width; x++) { - for (int y = 0; y < this.height; y++) { - for (int z = 0; z < (this.length + 1) / 2; z++) { - tmp = this.blocks[x][y][z]; - this.blocks[x][y][z] = this.blocks[x][y][this.length - 1 - z]; - this.blocks[x][y][this.length - 1 - z] = tmp; - - if (z == this.length - 1 - z) { - this.metadata[x][y][z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][z], this.metadata[x][y][z]); - } else { - tmp = this.metadata[x][y][z]; - this.metadata[x][y][z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][z], this.metadata[x][y][this.length - 1 - z]); - this.metadata[x][y][this.length - 1 - z] = BlockInfo.getTransformedMetadataFlip(this.blocks[x][y][this.length - 1 - z], tmp); - } - } - } - } - - TileEntity tileEntity; - for (int i = 0; i < this.tileEntities.size(); i++) { - tileEntity = this.tileEntities.get(i); - tileEntity.zCoord = this.length - 1 - tileEntity.zCoord; - tileEntity.blockMetadata = this.metadata[tileEntity.xCoord][tileEntity.yCoord][tileEntity.zCoord]; - - if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { - TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; - int angle = skullTileEntity.func_82119_b(); - int base = 0; - if (angle <= 7) { - base = 4; - } else { - base = 12; - } - - skullTileEntity.setSkullRotation((2 * base - angle) & 15); - } - } - - refreshChests(); - */ - } - - public void rotate() { - // TODO - /* - final ItemStack icon = this.schematic.getIcon(); - final int width = this.schematic.getWidth(); - final int height = this.schematic.getHeight(); - final int length = this.schematic.getLength(); - - final ISchematic schematicRotated = new Schematic(icon, length, height, width); - - for (int y = 0; y < height; y++) { - for (int z = 0; z < length; z++) { - for (int x = 0; x < width; x++) { - try { - getBlock(x, y, length - 1 - z).rotateBlock(this, x, y, length - 1 - z, ForgeDirection.UP); - } catch (Exception e) { - Reference.logger.debug("Failed to rotate block!", e); - } - - final Block block = getBlock(x, y, length - 1 - z); - final int metadata = getBlockMetadata(x, y, length - 1 - z); - schematicRotated.setBlock(z, y, x, block, metadata); - } - } - } - - for (TileEntity tileEntity : this.schematic.getTileEntities()) { - final int coord = tileEntity.zCoord; - tileEntity.zCoord = tileEntity.xCoord; - tileEntity.xCoord = length - 1 - coord; - tileEntity.blockMetadata = schematicRotated.getBlockMetadata(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); - - if (tileEntity instanceof TileEntitySkull && tileEntity.blockMetadata == 0x1) { - TileEntitySkull skullTileEntity = (TileEntitySkull) tileEntity; - skullTileEntity.func_145903_a((skullTileEntity.func_145906_b() + 12) & 15); - } - - schematicRotated.setTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, tileEntity); - } - - this.schematic = schematicRotated; - - refreshChests(); - */ - } - public String getDebugDimensions() { return "WHL: " + getWidth() + " / " + getHeight() + " / " + getLength(); } diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index d3d57ac5..400876ef 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -29,6 +29,12 @@ schematica.gui.materialname=Material schematica.gui.materialamount=Amount schematica.gui.printer=Printer schematica.gui.unknownblock=Unknown Block +schematica.gui.down=Down +schematica.gui.up=Up +schematica.gui.north=North +schematica.gui.south=South +schematica.gui.west=West +schematica.gui.east=East # gui - config - categories schematica.config.category.debug=Debug From 3b233b25bd6f670c1c114cef15b185922027aece Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 7 Mar 2015 02:04:26 +0100 Subject: [PATCH 199/314] Do not refresh the schematic if the rotation failed. --- .../schematica/client/gui/GuiSchematicControl.java | 9 +++++---- .../github/lunatrius/schematica/util/RotationHelper.java | 4 ---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index 55250c21..c4d90d56 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -186,10 +186,11 @@ protected void actionPerformed(GuiButton guiButton) { ClientProxy.axisRotation = values[((ClientProxy.axisRotation.ordinal() + 1) % values.length)]; guiButton.displayString = I18n.format("schematica.gui." + ClientProxy.axisRotation.getName()); } else if (guiButton.id == this.btnRotate.id) { - RotationHelper.INSTANCE.rotate(this.schematic, ClientProxy.axisRotation, isShiftKeyDown()); - setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); - RenderSchematic.INSTANCE.refresh(); - SchematicPrinter.INSTANCE.refresh(); + if (RotationHelper.INSTANCE.rotate(this.schematic, ClientProxy.axisRotation, isShiftKeyDown())) { + setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); + RenderSchematic.INSTANCE.refresh(); + SchematicPrinter.INSTANCE.refresh(); + } } else if (guiButton.id == this.btnMaterials.id) { this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); } else if (guiButton.id == this.btnPrint.id && this.printer.isEnabled()) { diff --git a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java index eec50976..3129693b 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java @@ -25,10 +25,6 @@ public class RotationHelper { private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private static final EnumFacing[][] ROTATION_MATRIX = new EnumFacing[6][]; - public boolean rotate(final SchematicWorld world) { - return rotate(world, EnumFacing.UP, false); - } - public boolean rotate(final SchematicWorld world, final EnumFacing axis, final boolean forced) { if (world == null) { return false; From c9dc1d64a9254807c0792dea28484dbef2fc68f1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 7 Mar 2015 05:53:35 +0100 Subject: [PATCH 200/314] Fixed a crash in non-dev environment. --- gradle.properties | 2 +- .../com/github/lunatrius/schematica/util/RotationHelper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 892c5b6c..0688bea5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ version_minecraft=1.8 version_forge=11.14.1.1329 version_minforge=11.14.0.1237 version_mappings=stable_16 -version_lunatriuscore=1.1.2.25 +version_lunatriuscore=1.1.2.26 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java index 3129693b..f072fa34 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java @@ -83,7 +83,7 @@ public Schematic rotate(final ISchematic schematic, final EnumFacing axis, boole final Schematic schematicRotated = new Schematic(schematic.getIcon(), dimensionsRotated.getX(), dimensionsRotated.getY(), dimensionsRotated.getZ()); final MBlockPos tmp = new MBlockPos(); - for (final MBlockPos pos : MBlockPos.getAllInBox(BlockPos.ORIGIN, new BlockPos(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1))) { + for (final MBlockPos pos : MBlockPos.getAllInRange(BlockPos.ORIGIN, new BlockPos(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1))) { final IBlockState blockState = schematic.getBlockState(pos); final IBlockState blockStateRotated = rotateBlock(blockState, axis, forced); schematicRotated.setBlockState(rotatePos(pos, axis, dimensionsRotated, tmp), blockStateRotated); From f9d18b901f4e132ddd6ab86dbb5c6cd0633117f5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 9 Mar 2015 01:21:13 +0100 Subject: [PATCH 201/314] Added support for logs, pillars, pillar quartz blocks and levers. --- .../schematica/util/RotationHelper.java | 153 +++++++++++++++--- 1 file changed, 128 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java index f072fa34..871514e0 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java @@ -6,8 +6,12 @@ import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.storage.Schematic; import net.minecraft.block.Block; +import net.minecraft.block.BlockLever; +import net.minecraft.block.BlockLog; +import net.minecraft.block.BlockQuartz; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; @@ -23,7 +27,10 @@ public class RotationHelper { public static final RotationHelper INSTANCE = new RotationHelper(); private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - private static final EnumFacing[][] ROTATION_MATRIX = new EnumFacing[6][]; + private static final EnumFacing[][] FACINGS = new EnumFacing[EnumFacing.values().length][]; + private static final EnumFacing.Axis[][] AXISES = new EnumFacing.Axis[EnumFacing.Axis.values().length][]; + private static final BlockLog.EnumAxis[][] AXISES_LOG = new BlockLog.EnumAxis[EnumFacing.Axis.values().length][]; + private static final BlockQuartz.EnumType[][] AXISES_QUARTZ = new BlockQuartz.EnumType[EnumFacing.Axis.values().length][]; public boolean rotate(final SchematicWorld world, final EnumFacing axis, final boolean forced) { if (world == null) { @@ -45,6 +52,8 @@ public boolean rotate(final SchematicWorld world, final EnumFacing axis, final b return true; } catch (final RotationException re) { Reference.logger.error(re.getMessage()); + } catch (final Exception e) { + Reference.logger.fatal("Something went wrong!", e); } return false; @@ -142,63 +151,157 @@ private BlockPos rotatePos(final BlockPos pos, final EnumFacing axis, final Vec3 } private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing axis, boolean forced) throws RotationException { - final PropertyDirection facingProperty = getFacingProperty(blockState); - if (facingProperty == null) { - return blockState; + final IProperty propertyFacing = getProperty(blockState, "facing"); + if (propertyFacing instanceof PropertyDirection) { + final Comparable value = blockState.getValue(propertyFacing); + if (value instanceof EnumFacing) { + final EnumFacing facing = getRotatedFacing(axis, (EnumFacing) value); + if (propertyFacing.getAllowedValues().contains(facing)) { + return blockState.withProperty(propertyFacing, facing); + } + } + } else if (propertyFacing instanceof PropertyEnum) { + if (BlockLever.EnumOrientation.class.isAssignableFrom(propertyFacing.getValueClass())) { + final BlockLever.EnumOrientation value = (BlockLever.EnumOrientation) blockState.getValue(propertyFacing); + final BlockLever.EnumOrientation valueRotated = getRotatedLeverFacing(axis, value); + return blockState.withProperty(propertyFacing, valueRotated); + } + } else if (propertyFacing != null) { + Reference.logger.error("'{}': found 'facing' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); + } + + final IProperty propertyAxis = getProperty(blockState, "axis"); + if (propertyAxis instanceof PropertyEnum) { + if (EnumFacing.Axis.class.isAssignableFrom(propertyAxis.getValueClass())) { + final EnumFacing.Axis value = (EnumFacing.Axis) blockState.getValue(propertyAxis); + final EnumFacing.Axis valueRotated = getRotatedAxis(axis, value); + return blockState.withProperty(propertyAxis, valueRotated); + } + + if (BlockLog.EnumAxis.class.isAssignableFrom(propertyAxis.getValueClass())) { + final BlockLog.EnumAxis value = (BlockLog.EnumAxis) blockState.getValue(propertyAxis); + final BlockLog.EnumAxis valueRotated = getRotatedLogAxis(axis, value); + return blockState.withProperty(propertyAxis, valueRotated); + } + } else if (propertyAxis != null) { + Reference.logger.error("'{}': found 'axis' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); } - final Comparable value = blockState.getValue(facingProperty); - if (value instanceof EnumFacing) { - final EnumFacing facing = getRotatedFacing(axis, (EnumFacing) value); - if (facingProperty.getAllowedValues().contains(facing)) { - return blockState.withProperty(facingProperty, facing); + final IProperty propertyVariant = getProperty(blockState, "variant"); + if (propertyVariant instanceof PropertyEnum) { + if (BlockQuartz.EnumType.class.isAssignableFrom(propertyVariant.getValueClass())) { + final BlockQuartz.EnumType value = (BlockQuartz.EnumType) blockState.getValue(propertyVariant); + final BlockQuartz.EnumType valueRotated = getRotatedQuartzType(axis, value); + return blockState.withProperty(propertyVariant, valueRotated); } } - if (!forced) { + if (!forced && (propertyFacing != null || propertyAxis != null)) { throw new RotationException("'%s' cannot be rotated around '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axis); } return blockState; } - private PropertyDirection getFacingProperty(final IBlockState blockState) { + private IProperty getProperty(final IBlockState blockState, final String name) { for (final IProperty prop : (Set) blockState.getProperties().keySet()) { - if (prop.getName().equals("facing")) { - if (prop instanceof PropertyDirection) { - return (PropertyDirection) prop; - } - - Reference.logger.error("'{}': {} is not an instance of {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), prop.getClass().getSimpleName(), PropertyDirection.class.getSimpleName()); + if (prop.getName().equals(name)) { + return prop; } } return null; } - private static EnumFacing getRotatedFacing(final EnumFacing axis, final EnumFacing side) { - return ROTATION_MATRIX[axis.ordinal()][side.ordinal()]; + private static EnumFacing getRotatedFacing(final EnumFacing source, final EnumFacing side) { + return FACINGS[source.ordinal()][side.ordinal()]; + } + + private static EnumFacing.Axis getRotatedAxis(final EnumFacing source, final EnumFacing.Axis axis) { + return AXISES[source.getAxis().ordinal()][axis.ordinal()]; + } + + private static BlockLog.EnumAxis getRotatedLogAxis(final EnumFacing source, final BlockLog.EnumAxis axis) { + return AXISES_LOG[source.getAxis().ordinal()][axis.ordinal()]; + } + + private static BlockQuartz.EnumType getRotatedQuartzType(final EnumFacing source, final BlockQuartz.EnumType type) { + return AXISES_QUARTZ[source.getAxis().ordinal()][type.ordinal()]; + } + + private static BlockLever.EnumOrientation getRotatedLeverFacing(final EnumFacing source, final BlockLever.EnumOrientation side) { + final EnumFacing facing; + if (source.getAxis().isVertical() && side.getFacing().getAxis().isVertical()) { + facing = side == BlockLever.EnumOrientation.UP_X || side == BlockLever.EnumOrientation.DOWN_X ? EnumFacing.NORTH : EnumFacing.WEST; + } else { + facing = side.getFacing(); + } + + final EnumFacing facingRotated = getRotatedFacing(source, side.getFacing()); + return BlockLever.EnumOrientation.forFacings(facingRotated, facing); } static { - ROTATION_MATRIX[EnumFacing.DOWN.ordinal()] = new EnumFacing[] { + FACINGS[EnumFacing.DOWN.ordinal()] = new EnumFacing[] { EnumFacing.DOWN, EnumFacing.UP, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.NORTH }; - ROTATION_MATRIX[EnumFacing.UP.ordinal()] = new EnumFacing[] { + FACINGS[EnumFacing.UP.ordinal()] = new EnumFacing[] { EnumFacing.DOWN, EnumFacing.UP, EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH }; - ROTATION_MATRIX[EnumFacing.NORTH.ordinal()] = new EnumFacing[] { + FACINGS[EnumFacing.NORTH.ordinal()] = new EnumFacing[] { EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.DOWN, EnumFacing.UP }; - ROTATION_MATRIX[EnumFacing.SOUTH.ordinal()] = new EnumFacing[] { + FACINGS[EnumFacing.SOUTH.ordinal()] = new EnumFacing[] { EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP, EnumFacing.DOWN }; - ROTATION_MATRIX[EnumFacing.WEST.ordinal()] = new EnumFacing[] { + FACINGS[EnumFacing.WEST.ordinal()] = new EnumFacing[] { EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.EAST }; - ROTATION_MATRIX[EnumFacing.EAST.ordinal()] = new EnumFacing[] { + FACINGS[EnumFacing.EAST.ordinal()] = new EnumFacing[] { EnumFacing.SOUTH, EnumFacing.NORTH, EnumFacing.DOWN, EnumFacing.UP, EnumFacing.WEST, EnumFacing.EAST }; + + AXISES[EnumFacing.Axis.X.ordinal()] = new EnumFacing.Axis[] { + EnumFacing.Axis.X, EnumFacing.Axis.Z, EnumFacing.Axis.Y + }; + AXISES[EnumFacing.Axis.Y.ordinal()] = new EnumFacing.Axis[] { + EnumFacing.Axis.Z, EnumFacing.Axis.Y, EnumFacing.Axis.X + }; + AXISES[EnumFacing.Axis.Z.ordinal()] = new EnumFacing.Axis[] { + EnumFacing.Axis.Y, EnumFacing.Axis.X, EnumFacing.Axis.Z + }; + + AXISES_LOG[EnumFacing.Axis.X.ordinal()] = new BlockLog.EnumAxis[] { + BlockLog.EnumAxis.X, BlockLog.EnumAxis.Z, BlockLog.EnumAxis.Y, BlockLog.EnumAxis.NONE + }; + AXISES_LOG[EnumFacing.Axis.Y.ordinal()] = new BlockLog.EnumAxis[] { + BlockLog.EnumAxis.Z, BlockLog.EnumAxis.Y, BlockLog.EnumAxis.X, BlockLog.EnumAxis.NONE + }; + AXISES_LOG[EnumFacing.Axis.Z.ordinal()] = new BlockLog.EnumAxis[] { + BlockLog.EnumAxis.Y, BlockLog.EnumAxis.X, BlockLog.EnumAxis.Z, BlockLog.EnumAxis.NONE + }; + + AXISES_QUARTZ[EnumFacing.Axis.X.ordinal()] = new BlockQuartz.EnumType[] { + BlockQuartz.EnumType.DEFAULT, + BlockQuartz.EnumType.CHISELED, + BlockQuartz.EnumType.LINES_Z, + BlockQuartz.EnumType.LINES_X, + BlockQuartz.EnumType.LINES_Y + }; + AXISES_QUARTZ[EnumFacing.Axis.Y.ordinal()] = new BlockQuartz.EnumType[] { + BlockQuartz.EnumType.DEFAULT, + BlockQuartz.EnumType.CHISELED, + BlockQuartz.EnumType.LINES_Y, + BlockQuartz.EnumType.LINES_Z, + BlockQuartz.EnumType.LINES_X + }; + AXISES_QUARTZ[EnumFacing.Axis.Z.ordinal()] = new BlockQuartz.EnumType[] { + BlockQuartz.EnumType.DEFAULT, + BlockQuartz.EnumType.CHISELED, + BlockQuartz.EnumType.LINES_X, + BlockQuartz.EnumType.LINES_Y, + BlockQuartz.EnumType.LINES_Z + }; } public static class RotationException extends Exception { From ad93218776093f730837195c6b112e9b3777e64c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 10 Mar 2015 00:59:32 +0100 Subject: [PATCH 202/314] Updated gradle wrapper, merged gradle scripts and split a part of the README.md into CONTRIBUTING.md. --- CONTRIBUTING.md | 44 ++++++ README.md | 43 ------ build.gradle | 173 ++++++++++++++++++++++- gradle.properties | 2 +- gradle/scripts/artifacts.gradle | 37 ----- gradle/scripts/curseforge.gradle | 13 -- gradle/scripts/dependencies.gradle | 25 ---- gradle/scripts/forge.gradle | 48 ------- gradle/scripts/release.gradle | 17 --- gradle/scripts/signing.gradle | 36 ----- gradle/wrapper/gradle-wrapper.jar | Bin 51017 -> 52141 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- 12 files changed, 214 insertions(+), 228 deletions(-) create mode 100644 CONTRIBUTING.md delete mode 100644 gradle/scripts/artifacts.gradle delete mode 100644 gradle/scripts/curseforge.gradle delete mode 100644 gradle/scripts/dependencies.gradle delete mode 100644 gradle/scripts/forge.gradle delete mode 100644 gradle/scripts/release.gradle delete mode 100644 gradle/scripts/signing.gradle diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..3d9dd08d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,44 @@ +## Contributing +### Submitting a Pull Request (PR) +So you found a bug in the code? Think you can make it more efficient? Want to help in general? Great! + +1. If you haven't already, create a [GitHub account](https://github.com/signup/free). +2. Click the `Fork` icon located at the top-right of this page (below your username). +3. Make the changes that you want to and commit them. + * If you're making changes locally, you'll have to do `git add -A`, `git commit` and `git push` in your command line. +4. Click `Pull Request` at the right-hand side of the gray bar directly below your fork's name. +5. Click `Click to create a pull request for this comparison`, enter your pull request title, and create a detailed description explaining what you changed. +6. Click `Send pull request`, and wait for feedback! + +#### Instructions/Advice when submitting a Pull Request (PR) +I use [this](https://gist.github.com/460be5119b93d73c24ab) IDEA formatting. To be short: + +* spaces for indentation +* braces on same lines + +When you finish up your PR you'll want to [squash](http://davidwalsh.name/squash-commits-git) them into a single commit (unless it makes sense to have them split). + +1. Make sure your working directory is clean by executing `git status`. +2. Execute `git rebase -i HEAD~X` where `X` is the amount of your commits. This will make sure you squash only your own commits. +3. You should now see a list of all your commits, prefixed with `pick`. Change all instances of `pick` (excluding the first!) into `squash` or simply `s`. Then save/quit the editor once. +4. A second screen should show up, displaying all the commit messages (you may edit them, delete or add some). After your done save/quit the editor again. +5. If git successfully rebased things simply push your cleaned up commits by executing `git push -f`. + +#### Localization +You should always use `en_US.lang` as the base for localization to other languages. To modify the files you have two options: + +* Create or modify the file directly with your favorite text editor (make sure encoding is set to `UTF-8`!). +* Use [this](http://mc.lunatri.us/translate) website to load the base file (and optionally the target language if you're updating localizations). +_Note: you **must** use the link to the `Raw` file._ + +### Creating an Issue +Crashing? Have a suggestion? Found a bug? Create an issue now! + +1. Make sure your issue hasn't already been answered or fixed. Also think about whether your issue is a valid one before submitting it. +2. Click `New Issue` right below `Star` and `Fork`. +3. Enter your issue title (something that summarizes your issue), and then add a detailed description ("Hey, could you add/change stuff?" or "Hey, found an exploit: stuff"). + * If you are reporting a bug, make sure you include the following: + * The log file `fml-client-latest.log` (or `fml-server-latest.log`) uploaded to [gist](https://gist.github.com/). + * Detailed description of the bug. + * Include steps on how to reproduce the bug (if possible). +4. Click `Submit new issue`, and wait for feedback! diff --git a/README.md b/README.md index 91f391bc..503d6607 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ ## Welcome to Schematica! -[Compiling Schematica](#compile-schematica) - for those that want the latest unreleased features - -[Contributing](#contributing) - for those that want to help out - ### Compiling [Setup Java](#setup-java) @@ -73,43 +69,4 @@ In order to get the most up-to-date builds, you'll have to periodically update y * If you have, try reverting them to the status that they were when you last updated your repository. 4. Execute `git pull master`. This pulls all commits from the official repository that do not yet exist on your local repository and updates it. -### Contributing -#### Submitting a Pull Request (PR) -So you found a bug in the code? Think you can make it more efficient? Want to help in general? Great! - -1. If you haven't already, create a [GitHub account](https://github.com/signup/free). -2. Click the `Fork` icon located at the top-right of this page (below your username). -3. Make the changes that you want to and commit them. - * If you're making changes locally, you'll have to do `git add -A`, `git commit` and `git push` in your command line. -4. Click `Pull Request` at the right-hand side of the gray bar directly below your fork's name. -5. Click `Click to create a pull request for this comparison`, enter your pull request title, and create a detailed description explaining what you changed. -6. Click `Send pull request`, and wait for feedback! - -##### Instructions/Advice when submitting a Pull Request (PR) -I use [this](https://gist.github.com/460be5119b93d73c24ab) IDEA formatting. To be short: - -* spaces for indentation -* braces on same lines - -When you finish up your PR you'll want to [squash](http://davidwalsh.name/squash-commits-git) them into a single commit (unless it makes sense to have them split). - -1. Make sure your working directory is clean by executing `git status`. -2. Execute `git rebase -i HEAD~X` where `X` is the amount of your commits. This will make sure you squash only your own commits. -3. You should now see a list of all your commits, prefixed with `pick`. Change all instances of `pick` (excluding the first!) into `squash` or simply `s`. Then save/quit the editor once. -4. A second screen should show up, displaying all the commit messages (you may edit them, delete or add some). After your done save/quit the editor again. -5. If git successfuly rebased things simply push your cleaned up commits by executing `git push -f`. - -#### Creating an Issue -Crashing? Have a suggestion? Found a bug? Create an issue now! - -1. Make sure your issue hasn't already been answered or fixed. Also think about whether your issue is a valid one before submitting it. -2. Go to the issues page. -3. Click `New Issue` right below `Star` and `Fork`. -4. Enter your issue title (something that summarizes your issue), and then add a detailed description ("Hey, could you add/change xxx?" or "Hey, found an exploit: stuff"). - * If you are reporting a bug, make sure you include the following: - * Version (can be found in the mcmod.info file or in the mod list) - * ForgeModLoader log (please use [gists](https://gist.github.com/) for large amounts of text!) - * Detailed description of the bug -5. Click `Submit new issue`, and wait for feedback! - Shamelessly based this README off [pahimar's version](https://github.com/pahimar/Equivalent-Exchange-3). diff --git a/build.gradle b/build.gradle index bd8fbf13..08879a35 100644 --- a/build.gradle +++ b/build.gradle @@ -15,15 +15,176 @@ buildscript { } } +apply plugin: 'forge' +apply plugin: 'curseforge' + ext.build = System.getenv().BUILD_NUMBER ?: 'git' ext.modversion = "${project.version_major}.${project.version_minor}.${project.version_micro}.${build}" group = 'com.github.lunatrius' version = "${project.version_minecraft}-${modversion}" -apply from: 'gradle/scripts/forge.gradle' -apply from: 'gradle/scripts/dependencies.gradle' -apply from: 'gradle/scripts/artifacts.gradle' -apply from: 'gradle/scripts/signing.gradle' -apply from: 'gradle/scripts/release.gradle' -apply from: 'gradle/scripts/curseforge.gradle' +compileJava.options.encoding = 'UTF-8' + +idea { + module { + downloadSources = true + } +} + +minecraft { + version = "${project.version_minecraft}-${project.version_forge}" + + if (project.hasProperty('version_mappings')) + mappings = project.version_mappings + + if (!project.hasProperty('run_location')) + runDir = 'run' + else + runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft) + + replaceIn 'reference/Reference.java' + replace '${version}', modversion + replace '${mcversion}', project.version_minecraft + replace '${forgeversion}', project.version_forge +} + +processResources { + // this will ensure that this task is redone when the versions change. + inputs.property 'version', project.version + inputs.property 'mcversion', project.minecraft.version + + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + expand([ + 'modid' : project.name, + 'version' : modversion, + 'mcversion' : project.version_minecraft, + 'forgeversion' : project.version_forge, + 'minforgeversion': project.hasProperty('version_minforge') ? project.version_minforge : project.version_forge, + 'coreversion' : project.version_lunatriuscore + ]) + } + + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} + +repositories { + ivy { + name = 'lunatrius\' ivy repo' + url 'http://mc.lunatri.us/files' + } +} + +dependencies { + compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev' +} + +def commonManifest = { + if (project.hasProperty('extra_fmlat')) { + attributes 'FMLAT': project.extra_fmlat + } +} + +jar { + from sourceSets.api.output + classifier = project.hasProperty('extra_classifier') ? project.extra_classifier : 'universal' + manifest commonManifest +} + +task devJar(dependsOn: 'classes', type: Jar) { + from sourceSets.main.output + from sourceSets.api.output + classifier = 'dev' + manifest commonManifest +} + +task sourceJar(dependsOn: 'classes', type: Jar) { + from sourceSets.main.allSource + from sourceSets.api.allSource + classifier = 'sources' + manifest commonManifest +} + +task apiJar(dependsOn: 'classes', type: Jar) { + from sourceSets.api.output + classifier = 'api' + manifest commonManifest +} + +artifacts { + archives devJar + archives sourceJar + archives apiJar +} + +if (!project.hasProperty('keystore_location')) + ext.keystore_location = '.' + +if (!project.hasProperty('keystore_alias')) + ext.keystore_alias = '' + +if (!project.hasProperty('keystore_password')) + ext.keystore_password = '' + +task signJars(dependsOn: ['reobf', 'devJar', 'sourceJar', 'apiJar']) { + inputs.dir jar.destinationDir + inputs.file keystore_location + inputs.property 'keystore_alias', keystore_alias + inputs.property 'keystore_password', keystore_password + outputs.dir jar.destinationDir + + onlyIf { + return keystore_location != '.' + } + + doLast { + jar.destinationDir.eachFile { file -> + if (!file.getPath().endsWith('.jar')) + return; + + logger.lifecycle "signing ${file}" + ant.signjar( + destDir: file.getParentFile(), + jar: file, + keystore: keystore_location, + alias: keystore_alias, + storepass: keystore_password + ) + } + } +} + +if (!project.hasProperty('release_location')) + ext.release_location = '.' +else + ext.release_location = release_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft).replace('{version}', version) + +task release(dependsOn: 'signJars', type: Copy) { + from project.tasks.jar.destinationDir + into project.file(project.release_location) + + eachFile { file -> + logger.lifecycle "copying ${file}" + } + + onlyIf { + return project.release_location != '.' + } +} + +if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curseforge_id')) { + curse { + dependsOn signJars + releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release' + apiKey = project.api_key_curseforge + projectId = project.extra_curseforge_id + changelog = '' + + additionalArtifact devJar, sourceJar, apiJar + relatedProject 'lunatriuscore' + } +} diff --git a/gradle.properties b/gradle.properties index 0688bea5..1cadc2c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ version_minor=7 version_micro=6 version_minecraft=1.8 version_forge=11.14.1.1329 -version_minforge=11.14.0.1237 +version_minforge=11.14.1.1317 version_mappings=stable_16 version_lunatriuscore=1.1.2.26 diff --git a/gradle/scripts/artifacts.gradle b/gradle/scripts/artifacts.gradle deleted file mode 100644 index 853c8a62..00000000 --- a/gradle/scripts/artifacts.gradle +++ /dev/null @@ -1,37 +0,0 @@ -def commonManifest = { - if (project.hasProperty('extra_fmlat')) { - attributes 'FMLAT': project.extra_fmlat - } -} - -jar { - from sourceSets.api.output - classifier = project.hasProperty('extra_classifier') ? project.extra_classifier : 'universal' - manifest commonManifest -} - -task devJar(dependsOn: 'classes', type: Jar) { - from sourceSets.main.output - from sourceSets.api.output - classifier = 'dev' - manifest commonManifest -} - -task sourceJar(dependsOn: 'classes', type: Jar) { - from sourceSets.main.allSource - from sourceSets.api.allSource - classifier = 'sources' - manifest commonManifest -} - -task apiJar(dependsOn: 'classes', type: Jar) { - from sourceSets.api.output - classifier = 'api' - manifest commonManifest -} - -artifacts { - archives devJar - archives sourceJar - archives apiJar -} diff --git a/gradle/scripts/curseforge.gradle b/gradle/scripts/curseforge.gradle deleted file mode 100644 index 1fa71fa9..00000000 --- a/gradle/scripts/curseforge.gradle +++ /dev/null @@ -1,13 +0,0 @@ -apply plugin: 'curseforge' - -if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curseforge_id')) { - curse { - dependsOn signJars - releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release' - apiKey = project.api_key_curseforge - projectId = project.extra_curseforge_id - changelog = '' - - additionalArtifact devJar, sourceJar, apiJar - } -} diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle deleted file mode 100644 index 2144dc25..00000000 --- a/gradle/scripts/dependencies.gradle +++ /dev/null @@ -1,25 +0,0 @@ -repositories { - ivy { - name = 'lunatrius\' ivy repo' - url 'http://mc.lunatri.us/files' - } -} - -dependencies { - compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev' -} - -def addDependency(depFilter, depName, depPath) { - if (fileTree('libs').include(depFilter).getFiles().size() == 1) { - logger.lifecycle "Building with ${depName}..." - } else { - logger.warn "Building without ${depName}..." - - if (depPath != null) { - sourceSets.main.java.excludes += [depPath] - idea.module.excludeDirs += [file("src/main/java/${depPath}")] - } - } -} - -// addDependency('example.jar', 'example', 'com/github/lunatrius/example/integration/test') diff --git a/gradle/scripts/forge.gradle b/gradle/scripts/forge.gradle deleted file mode 100644 index 7964dc4c..00000000 --- a/gradle/scripts/forge.gradle +++ /dev/null @@ -1,48 +0,0 @@ -apply plugin: 'forge' - -compileJava.options.encoding = 'UTF-8' - -idea { - module { - downloadSources = true - } -} - -minecraft { - version = "${project.version_minecraft}-${project.version_forge}" - - if (project.hasProperty('version_mappings')) - mappings = project.version_mappings - - if (!project.hasProperty('run_location')) - runDir = 'run' - else - runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft) - - replaceIn 'reference/Reference.java' - replace '${version}', modversion - replace '${mcversion}', project.version_minecraft - replace '${forgeversion}', project.version_forge -} - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.version - inputs.property 'mcversion', project.minecraft.version - - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - expand(['modid' : project.name, - 'version' : modversion, - 'mcversion' : project.version_minecraft, - 'forgeversion' : project.version_forge, - 'minforgeversion': project.version_minforge ?: project.version_forge, - 'coreversion' : project.version_lunatriuscore - ]) - } - - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} diff --git a/gradle/scripts/release.gradle b/gradle/scripts/release.gradle deleted file mode 100644 index 4ca0e25b..00000000 --- a/gradle/scripts/release.gradle +++ /dev/null @@ -1,17 +0,0 @@ -if (!project.hasProperty('release_location')) - ext.release_location = '.' -else - ext.release_location = release_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft).replace('{version}', version) - -task release(dependsOn: 'signJars', type: Copy) { - from project.tasks.jar.destinationDir - into project.file(project.release_location) - - eachFile { file -> - logger.lifecycle "copying ${file}" - } - - onlyIf { - return project.release_location != '.' - } -} diff --git a/gradle/scripts/signing.gradle b/gradle/scripts/signing.gradle deleted file mode 100644 index 8cbc5b1b..00000000 --- a/gradle/scripts/signing.gradle +++ /dev/null @@ -1,36 +0,0 @@ -if (!project.hasProperty('keystore_location')) - ext.keystore_location = '.' - -if (!project.hasProperty('keystore_alias')) - ext.keystore_alias = '' - -if (!project.hasProperty('keystore_password')) - ext.keystore_password = '' - -task signJars(dependsOn: ['reobf', 'devJar', 'sourceJar', 'apiJar']) { - inputs.dir jar.destinationDir - inputs.file keystore_location - inputs.property 'keystore_alias', keystore_alias - inputs.property 'keystore_password', keystore_password - outputs.dir jar.destinationDir - - onlyIf { - return keystore_location != '.' - } - - doLast { - jar.destinationDir.eachFile { file -> - if (!file.getPath().endsWith('.jar')) - return; - - logger.lifecycle "signing ${file}" - ant.signjar( - destDir: file.getParentFile(), - jar: file, - keystore: keystore_location, - alias: keystore_alias, - storepass: keystore_password - ) - } - } -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b7612167031001b7b84baf2a959e8ea8ad03c011..085a1cdc27db1185342f15a00441734e74fe3735 100644 GIT binary patch delta 16210 zcmZvD19)9Q*KXL@wr$(Cou;vEpQKS^oY=N)qm6AljnSxWa#Q@@fBW6L^W>S?YrpHA zHM7^AGg@C_z^hWg5tZe@Az(p3prJubS(GK?5h-APrN$5UYC`e+nwTdzx6aqjpdkMR zD<+2c4IicYlYV3RodT&rw}0yoZH6qO15vs#aM@yF=qn_5J(H~*pAi-^D);a59qR~0kv==W3 z(DYhuND)VRn*)8|zhD_`m%R^dRpU36p6@R<)Gqf4^qdpm!MtG*x~DN-8hH1B)OL60 z4?veMZN_4$B)TJ`P`o!=Mp5-5CB1C?a9-XFow&43n+U&nN{n28cuS2s=%s^XHfATY zc^9$<>=aY?U^;{J|D2I=3#W;ltS5S|)@DGRVUmjV4jxaj?j;bgZ%>@aCs1a*EeI~% z&88;TmJfx-w_!v*E@R4!)L(7;Nh_OB32+ETYej>}s$GcdV#-3_ob)x3_xbZBDG369 zt@1}Xk1MFwZEMpJ;gx0HVaOO(_4+12?cCx3 za9Uqh_lr~pF;ZI-rIV-B+3OR0BJoUYz>(1G_aP1A-o#Wqv?K&W`5d^pSEC zXg=HAD(%hHE+s?A9ClfG%IDc-MCwE84DV0cVvJ50 z;+1i4zKAb$!P6nC=LG10hYlP2eph$%_T@iF9@c9Li3DI}w@@pRFH)L>8f)W=u_dmY z1gq|$X}JyF@h0}s*_Es!ely1vunRSv%I3utVjWyoeX&Ipm&e7yFOC=06=jR|X=U0G z!9`M$F8CxR%8$7Va{!aYIxzhD!{OONzW}Udk}ll3I--v0@j*~QU$79)M^**02W>!e za~4)#7XqLaHZT2>X|lR0tzA5ntKXP|vAZ)g_aU5SQmV@}1lI2-%yjO_3i@6lKr-_V zeo@B!3$JLfzp&~H3}uQx@l8@CG^cbmnd}X#@iL_>3eVI{XLvFczk;$=*0LyxVK;oL z&J!PLPW+EhOTW-%)>a4@v)LNPfCd-GWW{CyM-%`b=%WV6Yek!++09bA z^KzaHohh^Mv(~&JvmDfgIJ0sgyck{USG)JGp#OG$lg_6R7*HS}_J|;0Ae6t{5NObj z21wF;GQrbAd0AY<@B(s2xGXmX8B;~muVBikQOlrREr?guJku(!w%XW`InZ9VcT^09 zI-^lP_(6aret(ChOEcIA>c1Zg*1hsxubFo49;%D$(rR;@i)|~T<@IIiCl_euaL+Dx zL_cBXkShK=`$3v6VlkD_18Vt|X45*W85{D)7wkt)74p-dw) zAvJ?n8Y(a8@E@=;wvbOUSbXIU9Y(IQu)Fa_9-cHgKHP4VnBDhX4Na`}Pp`&Zh%9>s;@|SFqSICG#EOc+jbodU}-oZw6Tjt%IeQhD>vq7C` ztKd52(NndA<{;C$Z|l^70qHg|?^a6OoXhi^N*Nw?V6}*qVLN7w-P{u~N(9h{oW(Ga z==1zqwcvy0v{>fbXo|&TGl@!ZIGsXRy;pRx(>2z2GA0 z^0BFLhC1yl9?On@zzbPO*3KDZVqFvpCfdgr=u@yAdk)f;|y+$MZ%8~#@%iKWZlCOOm zw5RZW+oHN7Nr!d21A$n>3#9SD4a++?A~C>5cW1-M(rs21qM=;(zH9V#7%a_gqA1y1w)cs9dO_0&Na9$FCo&01ITM32AS=iIA7(IR3=;I z(pYinprea@XrW_^eAqC=Cqp=qvw%Iu7-uWOzSSQotLItoDes*u5uB(^0FV<${Tc00 z?#Gnw$KI++-;_erfFkh-StXh1b?a ziDBRq%HhNG1QxhNrj zZguceQGG|Xd$^jW1}+LN&gn^xyo;F#`E($FL7t(M2ypWCa|M6z5{_0m^93sVV2|GY zD5mn83%)QK3p~;l-v_gurVZb-sxEYrcUoo}M@w3ICAJYh{Gj^Tphu|dICP6# zG_1jYIs?eaAqiy4ST!z*emW*RM>))FUls`yI29nsI~tSL5+F1;HB>i}EMzS<9|jV? zSZk~{cQzXlPR&VShvj#|g?63-U?TENKUMWfI4H4Ix++xxTP@GQ=Tpy95^>V3$Nm`u&I_e9Kn{RacsaWTbprDY zh0|R!E%c5?{FOZSwQ{;Aai(Xshvx1Q^cgASg-zP+?t@5q;cN2GSD5M7(H{WVpMW^d z*$k2L+{-aXaB#HA)IP`*h-ET9gAhO1@8Ez+2ySA$B9ZcgTzE4PO|P{60}<;YF7Qr# zwi@Krqn>lZfTf+Fr7>hxPq8>&uY&$~ zVz=925C_<+Ll6fTXO5-B8_mskfvudqZmdgiP494UG3;SyjqH>2ilX$qI^g-xH*o-k zB9u7pFx&Pa57eDp(o_(f!ycm{9pd}V#Fu;SPqs)m8=W5nFXJ^j`X5+BI(!ga;qM6r z<_HM5y~$U3JlVZVU&nW13ZT+NyDXZdnv#Q)@$GPG8OV6rW36;j(&X24X9bHXSiJ-I zQh&g>xT?3LUL12&%_OVHMN-`*!^i>Tid-v-mUspygx52rDdia^8}qOY8~J<~)m764 z7ULC9_rzfOI@^{*211xy8#QzA6-{S{3!XvA@;u;?PETBOlIQU^bt8<9+fE>JZ(HzW z1~#W$+wbl6y?tctC)_t!C>>I8meP_RaAmrL*aQppq&V;+Ajgduoa7tepC$qJ-sdc2 z6OGl>W_1drpcg>{$<-^~E%D817qql}P9C8mQc*KeMJu6c>sm*+8_as*RK^iI{Vv7r zYm$)RyTlGSVmMEPji~YmjL(JkE%1clV5VlG;%AHjYOQE%U2rXF^OmeIxG)H#L16A1 zs%;CAaRIrc{BC%f*(p3K8exDGG)dX+Jki#$>;xODkd9Q%=&$Z1^<>2`8_kQ8QVrae zm}QOi$_yLc-pj12)t@$7jYJwTE)X)QbiF|%`D_k5`qgQV5aS_h&u`1lQ$EYJl7hRK zg0{Ft(s)VXpLC_0X$%BYVL4wa9LwN4CYBBM=DYS{D_FY^&tlP;kURrO$2E%FIxJL) zCYMR4j5ct&X02v;G7U+ZO+-d8?7GA8{}{!~yQfo+N4-nyQcWsiLqj+eXcoiP_fd zX^Q?T(sZ!ggh_53gde++2#{KKM4u+qp!eATq~o+O4KHNOhrjvS zt4tp3HafF>tE^xo;#5kG=g7tE?VwcJQYuy-f;`b8)g|sZ2f^ZzaK1n zpy_t8)jloGxz!y8P+eTK&CBB9)uO-IVk(C2?Sr_GO>s+-0yQ4RQQ1LQVZM_NDPI(M z*D0%Isaup&@6Rw; zB=0-^dVGI7)`})@6Ei%+n>T^|9NGY<*_@nA*BRC@SqPmflVlps#&^cITC(bQ46IldxbVSTK7eZqr9XmZs5J`;4r5GC@1bkFqfz0Kw1C zX`gTHd4I84RX;5D(Mm%j7%Y`Kp@l1nj~452U_H+36^b;vRb#hNYJ&Ex&F_kya3Q=Hs>oQmCS*D5I!a8agJz^4ut7N0# z`Dqt@$p4`EsFNhrzX1zSKR9|cp#@|L1v2+|75C~&g{FX&JF0#AF}Ha9M4My-H4Mg}WNgvY?vcXMA?^PQ{97;cn3L_sN= z@lRkcC%#eBVcE%I&cfrBY1$%4#k&`jr4nMjt{DiMfTvBlT9rCbNt9hR#+7T3sm zVP*tSk9_mGydDLE%6VBnOqo;^mHe&8pfK&Ya}*nSj~HR4?Sg4PlnBqAq27 z-p`BA5SN}m0nAlzq1%D}wAX?$S;Q>2@W0ehxdYi`DK7dhFLx<(y!RQ!v8}#P&CGMcW(7_52>RkAoxhWvy{SyMt!)`{nos@u^pSyOMpUt=AxXmC71e|s*Hz< zPr{)aW(>KD`Z1YSJcC-%i1fy2-YPg%@>)aG1U(^)Z;`}nh>vY^Ycgtt`w%0*FPJ{c z%2xme-e7#;8yk9QPSLD3b!$R5uNc5gOS;OTRrKX~m~OwqpyS596)keAi~d(y)~ zkNjAz_U0D50^MpSwpQ~~ZCR*a1A4?ln4giu9(+}L@xq6^2&VluJ@B+o)+~TUH6D(D z0ZGU8Gsotwp`0UItgM2O-k@0BV<&GU=EONoZ>BDy%&KB&zko@xigqtv;)T^OHZH3BeA>>?08P7(WEkfPC(ql$PZ~< z8-g1;RaaLg2V~8kx;v0@8fnKL!>&MS7D=p=kN7UukfQkfGu&!C20Mr?sez0EzsC{J z*^kmaY@tx0#`fyIM+9Y>p%*>J@9B~IUHozwb)nOXIID{zKO5BXZa);Xr&6g4A>W4L zzBBF~wz9@g%`4_~SmsjzOxShTI;87nmoPX=ztT5}>a2gCqZ6Em-;%I1?ej(t0GTbsS%KkP8 z&gWoUVWb~hH&X)4ovLd||L7Inb;fQ-iX4mU`e;y?Q>19|g6d`g5IbPkFvbtMN3c9I z(hb?J6xO~FueTIyKNc^?{y0nt@{_#rgabj+FyiJGx zleEhweRE?C`D<2jcfwS{)c1s=BHvwT9`nlim?^H2u{6xi>~Ps&iG33V6EQ+{=y-a4G`Fby}aGO?R4EFs{@-B zbCI_V6@^AABc{}V7_<%+MfjLU7&!gulE85{3fShmtaXfK1j3|UUOWbkgmhtB#MDpR zf3w-yem^@F(=NMTLddoF1ge}s+{!E$W+JWs(2?yXezO#?&jcP>5T(w3-2S~TQk^D& zeRRa>GphnpFF>w`MUJKQF?_kR0f(1I45|6)biiPR7vp|v+REvHEyXhJ^wFY!^qU-) zAdNUt!bCs=EL8P}Q1KFF7J5eu5jxf}z_{Q+>Jg5Gdy^Z8OwhKZNb3Y_s|QzL);XRrR55e!3b9Nw%+DnOpK={$}%WV=Afs(VuRndv5+ zmw-V)WJlUJu=?)S4cOLa4sV2Xq<*_+Of86Gu45Y=rVG$0s0P)ofYI{t1@)dF$0{-A-H+1_ z<}kE(dOBIucWbJ40XH7U9u3rb%wuWl_5i2ga=2~M!GkR^a;EOHj;^tu*x+pg`?1jO zt+LS}hmO4Ssj*!TGtg{@St9fSwKzt5q$#3VQ6jT*p$}~oDUqb!J_iv47`hj+CrS}4 zUxu8vf@RKL%D`VOKCdT0${`bONfb+ZZ1>I}{nv!LA&DLi^3Uc;AxjAC?=6#H+`@|b zxBWd)Y!DFI-)q&%{5Sw8PxKLt7bwNmIcp7Wn8JZXaJc!n$$;p(USu6q;yC17^FX`K zOw5z36V3H=mEC0HlI8F@={g{{fZ{HCCO6eegu)p*m7<6D<-|!B-;;%h8}9~#=!b5k ziStgcpIu&;2ugytR|O!8k=T#`tnv;qR-^w^YR7@#O%|f1MG~b28GR?u)mja`j%Qn<~7g zW*6!)Pv5_AcjPfVB4^hE*1tL*sRy}q)hoBDt76X);4lIR9O&?F=RQ*;P=})KF0%Fi_Gjv9h(bGLsU> zm;pIKM!Sw1EmdU)26y@u3c}a!khv(yO=53&bAB0xY^H=L97k1#Eq~=F^9+FQOeFF3{;Nmkz}+EMR^r*;uFnKdxqfv zj-1J^J|ktHSnL!-1o<;h!2^@r8VXo^sK6_Djq#(k_H&nxhMnUp6q=)M+WFZ<48{ly z*K7L$KcRSiltvhSs!JN}KAOnuJ!Q$@U}?0^Vz3#KCvZw0G)84sc=n4pUVv-JV9T&2 zeZsDi*~NZN?cI&C&$_-&JP42}CyD`K+?X9ofMx;Qdvb)H!8uorYCar}mn6PI1sY?{ zXjU5bAFw@|S9l0LLzkai^mDg8X|1O%@Lpr-N_QR}gF=ONm0({gcbFdOfYyhi=d-|q zjpx?To}EkFw+(4)>0LyGl51N8%nS7^CWO~v07SBPYmM6Cfp!$uO{wDZi-lhDm#^iUmb9J~dlDX09Qxz?^iy9MAX&nm{4dBo8`c9Yw$@ z*m{ZFCc~o0YAW7Da&UGKwoX+R-pV)$9SeSqtBqzy|3F7jmx0mT@*$lBk77R`5L{dV zp&>mKMpHCfQD~DdSvfPPt3p>B&cCjU7O^%&nTXFtI#Zxx!i^rC69#A?{mQNqYon7b zFbYSuWL_-IwI((v=ybp#XM%@5QyT7;AHJj#XQz#pvdt+`newoQ$-C1zB(CZZcTR%I zrgT5z@aY!!PM#||z5V%#eN%J}u<+nKb!~`N$I3*w0IUj+pHD?;VJy@Q zt;vLmk(5$}F{tG5GUM99Ub%riD>La{^o)VjF?F9Yp~GdVJge3g*r>aKf*i^+fv8TG zD)_wHKiXO(Xu%X#nz%q)VUWv+l`>r2eMK!|=7k02!q=fzq?4^P20( zI8dT*IG;H2eyY17l)ySbqzQh{MP*W>$+CgSuVkU&uNPpvtT{~*)>%KS7CaZtKh@bD z!f>>E+rc*mi9ks2(s9X1sVt8ufiXS~rxg0+WoFTsy=~{pnn&G`!Z2TZ|JB)a9(CAL zKBYjG^h?l$+bwLt60;T`Ku9(H11Gp0@O-c?eo@C3xf1TY_%>Zfzz+%-^`6u^3-M@I z`7EN11z+fMOA1@U^-A)H+hO95@+psDSSiK#X=Pk&Tzm{IHe+{%+ZQ^e^uQ`^BsIm) z3oDaf@f1?2vV6FiGh|B8nm0d}8uds=?a>HG0vIMKJ#bHxpM%5=0VLRSI3slYADuo2 z4b#O%3Rs@=nNr1Zd<{Mo-Yhk^l<>&D-Z+YKUU17kQq{ed7ZIEYyL$4P((LXJA|gWx zPpda$AI~ai0FPh0y|LyC8p!6_c;(+1PPP4}{!_G*jllW*2lEqg!NB_K>=mw~$E5d$ zd)gsFnbUCIh2c*SO@I-2Gw2n`r?;II@$U2vNa|gGYMUBo0JF`9{-1f3el#?}zKf1s zF>%cMtqADs^1}Rv1^9=$mf%|3-qqK?}EBNN^KMAVpD%5xPhGCWRIAeHt(f)`~9Wu3sR#dGxL%YsTH1O zgnh=Hg>FPw%+HsAp$*1V%uAq-oYPK_)QF>6V0g*xu|gGT(^*w*WYlI4kJO#dU1bh2 z6YI;Tp+CaaW(iM1gH|wFP@WbFTtI8}gyq<8qKs~0OTLs0IK}1lX0WR&8u+Rb@{V4L zjB$wfOqA_@&JLhuBGA=<@-DBW7N*6R&0Y%5;A0hc5ZyJluH9ucA0g?c3ZHN64G)iO zEanc0_!EWL4KY!2fwnZy!`{2WPfbK4ETP<8{sLY0334Pn`f`?Fux3q8)C3_pvz*s6 z$)qi8^QRDstfVEjJYX9?4l5=RT!T9?uUeA3Geysp#c~1mVBdhbK^6MSCYYAPBt`1* zmQs+s#|Z?@DsuRmt?{zGFTCb>MWa~tbXTlg4G~|eXP!Jbsd{)DZYq}V;Xdyk!bfUi z)r@L#N4x#7fn|s4x6)?~{ML5X-mt7;wtW5VqP`=g8t8pl-5bizS?pwmn^II~HRVTr zlHPxqHw**NcZy-v1=E{d_C_kFV0J9JM6t!wU7qF(KS%RizrqWEWZtRuC2k|)D6TtG=2o9S*0INzp`%@J0vYqlBcT1= z>a69~+!chZtsgHwg*&sGhdYNV@O^aPB)hvuO~x=_nT%!e{6Ix(ZUxgTto>uRi_cj@ zSLd<7(Pux3=IOrKFLw7#wOL=bCN4MbYfPrzJ)`}g%|E1|2i1@-Op+hMEp{RE!z)gy zF`RE!dSKQmibhDBmX>oUIj@&(+J*Ea*`b5+Ljh_dH>47J))5qtUpSs`T9h#U zTt=qWmo?eiD0NLp%J^x8A19b2eks47b=F8t5>h1png*|J^a1b7Mt>IL!vy2QEX`fK z6%2)Zt`JwO{rIlxS7($?Yt+-CSMYyNW$acvnj*ae0ePG4NwNXRS)y>A=+KiiS3?b< zBUWK8C4`G4)sdAes>E1BXN)Mb5u|oL+ADZ28=dZ1t=|)M9EKcqvK~>Rg?s@4mLhF@^2)o}#b(+yfUj>p9B|4sj4=o$!LBsCVO0qo zF-#(X$&eY1G%}C%befG+;}tCSAu{rv4JzUHTn(~-_%RS+P>`V_Ayi1w zY|~C#OYE$VquHO1bLiF}jB`5JSh!KG0~YB*Cx<7!l5PdK(|sy-0PMVV+OU)SqQ$FL^ zZ4#9-jHgWj2xaBX=P~vMlPo#FRiBdl&z}OAoKAc3p4&O7uKvEH`YaB@`7v`Yy?)^Yksd(Lg8V! zW%^oQSTiJ!YLuNu*I8@1Etpfy(t?>f2?IKZ2$RJgN*UVFR5) zx*D$pE6i=Qtuy+KVJcIbbc1b1P3!p}XdQ^c09TR>8g&cq)~taF60vSQY|UxIEDYKC zYQhE?7WkxE0Z6w$TCFcNu#@LV2z5PZ#H@_~ydej4A%1wSj-r8SyJ?s!n#5u?cD(d~ z3xUQS^4Vk`HH#_MToy)qi-2Dj6A&juf*ah3t-jLeZB#4=C1O+HY5-m7IH$X?({BB= z0H%0qZO$XDfcY|F8y@NFv!jpmm}rvYp8UY*&NH*Ad)t+Y)+#pHXnR%F6wC^#E%bdi z_%^ePI6fDP+9ysb!>^3rhAB%bz@Ct#{3UTxQqp5^?RscxOLK`@XL**RUlBTbJrB>j zh;zj1n$AvzwY+niA1hP@fpQ}z$};X{0IDw`rlz6zH-iQIgDQUS57oQk<)H(k4WrX0i57!35Iez0NH!!>;aUmk+*DGZ9H+YmN$>lB2yp$L zfayhlLItol&guYt=-Zy6mKksX-waw}p3-@mrKU>>FJyVe_2WiaN*eB0sVtQn5Q;Dx zL>_mAh@?~&Jk)+>>L+{uaeq~xBVw=N`2+t+4_)GLg8w~FV3E$yjTt#*a^kS_tn415 zltEwTw3~W6vUBFfN{$#?U^ydd6#&^Xfwu5eo8~xvZM;DPtfy~7T^G3^-B>+w_8mU; z3Nc0zT5HAYtWXc8<<>bdt<&9@7N49}9!~|grFC&p_`MTSQJKuBcpRl8Q_)TL3#=8r znj@nDQ8KEXaKNe|8i#0bgj=etSE8(EHaFIE@R<5|hWhB%HL<-B-HT`iHDH8OC4{pM z_S~3=cTnXFnbSRj?HJvnj&2Tq<1X4i+qPMGpzU*c%pr+&kWg7yb3O)Yi&(P;*e-N) zy!v)+sf1oJsKX8|Z!H1iO(!&;G_8?E^A~&_swcls+^A0OPkJyWgH~MD_VHFjvxc~V zbvoWn>~My&2s0ZvKN-)yMA7@yF_E20B2j=}#cMLK_5l9t2%j~vbzCDT2#6*)2nhGz z6MP6j^G<9aj{*Xq!l|iwRj<+Olg;VsuAZC-Dg;Sm2quv)wR{4JV*3gLP$BYFwomyg zPpFqjgP$#QwiMZSInCueqs#JG4;BEVbEtx6+^`B7NlD>u9DmBM^G=2G(T?MDta=Xf z)^S7*sisb64eFEsdO4lK)r|>9>01Ngrdu^aqD3( zBK7i{*x;_Och@pAUuNks;2l@aVvP|MW`Hk*(@>dw3DSKcdHhL-nB{&;H9P zc_#7-XDbLmf*%^$P@osz9Q-l$Tb+of2O#!rSXV}THC%|Rqdo}@R-<9`hMlwWHfQHr zNKM$1-w_>GOt{RHeihLH73nGS=!_4))t5<1k4*UvPw~z>SoF>u;vwo35tBYFO=W!E zY#xc8L?oQf%-n7gD%pgrz`l{t$gC3MR>453uB-f;eG{QZ zp#g?oY;v~{PPiXU!5VXtJbI*+Q;;WiAQgc z%_;GYj}E1tU|Z_f44LY+YVzF-QJJU-YOvYrR|Jq-8dn04TUuA(07#`Tk9iSukMU6@ zX8dG(BdEk8k!i(7vF2_gEch@4*Jv>|^k*$qnMNHr13Sl$;X9pt4ypE(WgW>3c}}nM z`vhv=cdy9`JQS7I8AKvvv<0lwVk$B&qOvFO5J+WVDkO_XhVK;!!bcF#3oP{-f(;jC zOAvHdxb0U?0voGJ0QJMY`Bg{9PKN7x_zBa4UYgwF+K0j2hSJcnL<_Me;5r-fNQ3YB zOp4nW^qcI4YYE(4oot53TYbo*#B28UbX}HY+s(-zrK-?3xS}oOO-Or~ZI+?#Rw}XL zlI9!O+Otq@6Q(aGEmB7mzTsasVNO&Qm0&+0$c$x<72Y=20a*JsVQ};N8xm+~q?b_{ z-dW&Y^xmmgqFWE+Vvm_3Fv;sE71<8tT@J5SiIbRd+Yi&P*jFwj#u=9QX z=%K34EOzm7FR5glX{IyF5{GcATGvH_F*`O;|HX} z=f{e-)vUKZc;poKg#`7YZ~g6DRJ&$+Qm-woA{H&`iu1Dql50`{Zrw#+cikM$vFmC< z)@0nnng+){LWQ!U^F8$m{T>5?!yYY04LGw=SpxvKg5IH>kgu7kWb#%oslD7X0^XQ+ zHdJqS1_nm2z>U_V%Vu7sWmA*%3RXk!iMQslvNUGrg5&VcHyO*#M5C`_)(V@YcRQxT z^muxzth=F%uKjkn=>=H~guZ?Qy;zC#vmN1fX@5cAm5d8B~_ zWL{Tp^tpq7wB>SoFb}SUjJ6!Xm25;LXa&-3Nbr5yVZ5wr-@Ik=B0~wB!VAa7B7-~OSydkK~I|<1p#8DJLD+ejoH0Cu{tv&N} zebrMwYiY21S-h|~jiH~h#pefd$|(}n-cYLPXMWC52WrDPNL$6=7W%xOsu`=e0B`NB zqUJIir#;c*Ycx3FYoW3jY)}!@dg3%f~;%-9!41M#$@jCXqS|- z9c`?iXOP<*@#41zf;VFzyz+o(fQNVl#I{G`l}Bi`Cu$>Z8FPLKdwwzY910L77{dPm(rwP0iLZH>fKc9 z1MZ~jWA4*L7ijN^*O}T4J%wGJACt`w%xsm|l`BZHuO0@`0;P$wp(Q_F2jj=@!4z?2 zTO!`qk=X4XUBw)YmR(-qPflNV$%}w7@Naq(y1^l}C5@czk%&hWM+7Dz;%|S&SL;&} zaGTp4vNZxb?24qRb_gXC60VBcrhWx$S-z1maJ1Smn1+BSoN(rXa!n#FUz&oPsJdyBafd11ozYYpuGYJAw)`D>M56 za7mK}M(Hg+iBbNFWfTabMFHS*7$8R8ysS|d;WxH?mu#O@PG8loX~B(83XW-5A=IM? zT)*#f+rza07|cm8945dF<6UE*HN{xfB}4|w`h8E20XZXE|B5yyi*v3 z5;1L@F@Ok%4H63PD=mmSgie|D9u{Amqg+;>nHrSMB5t0FlIuvc2iKa6-j2ZYSF@`# zrAsyX5hh1{?h6MP?0mV{E~BHw5wdhirB;hZOxCU5Z|_19c8eV`v{Qe5=or{ohqQf& z;j%TQP*eH=eKtX_v4#s6XipB@GI$4+?L}@#vswD9=4#Iij`#~q>itDG z;Vs%L4FL!UAqFD#!8aT`WkUX;{N(ZUmpsJF8tRYiHemX%Y~*A4UpBXpMASb|5mK-I z%0M%={^s_xnjro>&B_M@|7~J(Z>>w}n~CLbCJOw=#H~ThhO46dziP>)`hN?$FBASt zz*{}_SB6ll_7`Vbp8$^Vt16Q%NRg6n4kZo*Z|41f9IBR;^Z#-vy=Ic%`?$b>X14#0 z#{_mZ^Kkx(gL`9n3qAUCLHtcYK#)Oxilo2YIXGLq#omE}p@aW#TqlsO1(&z`??Ve` zBU4+m{|EDn=zmz>!uI}NzgSOx4W{Y-o73{6sd>R0YT@ml?0?{IX=5Nh5T%s}xYdG2 z{L9+kv7m3nj&G)l|APYo1NOBL0-0Oc|J2s9RsK(=wN>j+2CeP=pNwnUU&&OP?*Ati zkhh&2@^>sCP^I-xssC4$76|1(rN&^tm5T8evqkjVy#GCh4gx~_5AcZSH!y+#0oc<}$_dmPu|8UO>{#H=t#{z!- z3;xdvCOilT=|A8}ncv`cNhBb4=O5;OX0ZQ&36y_>4cdQAXvu$@@z2EQA25~b8<+q% z(uw*T_@7Si4fO9T1?U0;G%0|DUGT)eocVW8_Xfgwn?%2zEcnmW7>KL~l_g4q3>%s*S(g#j-3H`Z8?#2ZhH2~HXkpY#u(S8%Dioy_- zzA-(#eUJSA!}FFl1~z~A4cySf1NL^q{~?%uBWN{#lhXh(dPx7s_o|) zI^BMkjMRtyN13h<7c9Z&O-2KB?EBjc@o%zNKVVfK`){&H5e{45x5kBgTcP0n$BLi9 zK+t~aKST=sxL`A(zpaSsXZa)Rdy@ge-(;k~*M8LBWFL?OXA9oikLE3Ek?kKctV|%w zfXHu<)QtIA!W$^_t-Jjf1ef#M)Q$n{-#|~wU3J5^Zy6U31cdJ&wu`*C*N6jzA7uVx zitr#VSV{3)ok)THgMaIu{wAv`dm|JA`VIeaCMpPN_+O4>@yo=22y-ieBtu+($n=MB z!9c2i*EM5^>bE685Wciujr8M9k>?*p@p_80W~na9s^j~`p2OEbk%R1ME~$Yv;(1=Nidb=Am3aO1cc@74;cjnB&_|{-Twgv Cb9&1F delta 15122 zcmZv@19)9Q*9IEfw#~+AY};(q*lDcO*gRol+qRPijT_r)+!!~-{l357y*bZ$_R2f& zT5GV*>^(DkRV0HCM}s3N$$~?`fq=lkfLzLNip3#O!v4C}MrmO1$MI=k_|;!Jfr9)G zsh9-fH+hWu&-Ir1_Z3J7x`FzuAV&8(8Vd{r!~p^XL<|@Qfdv$3X8{_65dsGL15>EJ zQw1ZN!Q*p(>LB-uNB|TV*yM!?b`zVXLzY5Fvs?(AjE%ERjMde73HtgzBV|VpQBBjN zR4cu!PU@9MKVFbBVhb|;vBp{xv`n?-fMA2)+!yP;2bsBK8p=BW9xTRa0~=h>iXA%N zkta&JelD6t=E`s5^!iy=@eDB36L{o~+V}86qOxV77_3j4NKJMb4gEdyC{)NpzEWh^ zumcW^)LI~hOgMf2r&8l;;|`-iv(Ipwn2SN+b2qYw^(WsRxIQP{Vt%@LWK(OftKQE> zeYA6e=P@gYfllVs>If^QAj59s-&HCPditZ?aNs_n;f_65Q>See6b%7@?*n9X!h;a7 zN(KqE5h4f+S_>)#E|;aGz;786Hl_)mK*yW$7Fm=U9f*;gLqed4SWaHn9dMnx)D=L> z_7y&p@=`qTS+wN|AXxe+=GlPq78(+_lsA}E?sypVJ75|X3RmAf>T%M444 z_0n=$A>89K;&J$_((eNZ(5Y-SbWN^Lz67_;|s8Zf_|X)3jonYlje5bEp&_P zR49Yl=#i!gA>FgI$S6ncc9Fh}E2JCuC@c-qsu(zILhKclIGs_C>`Ly!jBPA6uc+46 z)L?Py%GxEoo6GIM)FYnO2)XBSNG+HDfG4i!A6E7;PW~C}Er{U%PpAO{A@+WUO`RQN z9@rlV69x_Hk3^4D^cR~$VTSx2Rd&ZDeR$9yAdW~NAXLAjstX4b@MyBEf%%fKkW^M| zdsGT*I+s6Q&xhJiL@&A&wv0gSA#mJ3st%wRP2tcQ){3IfHqX@`d#d_=^x zakX54d-_TYnNCjYdO~aS*rR#-ALH4{g&MP|)r&`LMA`Pu5AdWv$#!V+6u1e&NFT0)@<6H=*f% z^Npr+V8UMVB7>%re$(qtV7nQ806F)LG^?F_tMW5Aa4=j2kU7b)Jex$Q%jOK~q%g0} zrmDdp+WMGmWVvX0^SU>qD50S*5R)!LVAmsmq$mH+qR6Mn0}DalU%=Wjkb-DTUTIl%PMt zdLTh_B9$rX0MEcLl?v|@O~0qBCXLb!nV-Xlms~8ZBP^ET<(y`*kEtxdCw7|BSzDK; zW-6b2XBjCKNuq+}iM2rbHg%J%)|MJmAQoFy)J|>crBDC9u(uH#dY$DctO<2Iz2fAW zjAT;YPzZF&bU>vDgNjv$qG_$Zj~zj#?^=WGRhS;&3Q*TYf0yCz^>a-$6EqQB1lT$hgkh35QeE!;|5Mml3srqmSv;3|^AWq^gli#%ifo@+5Anac*tV!6Q) z6s*9*B4qyLA-r`@6{BVaMNL<=0*CASNo&PX(x|hP8!TEV3aMoM{lKlo@on63X+~z& zw;%BwYycknq+_17Myh>lHIJAmN4j|3&o8Ts7J8pi<`a;x5Qg-WJ%Igd6nUruq$U{2 zANBf8$b2ctBZx=uxHFS#La9x?Ayl1{-8_>n(A()uaOs`Pbd@7{by|wQu=mlyKgb4g`&@P`NgSZL|^Zqu`MuODQs(5nfj$Y9lwS1KGd~3Ms)YDhZ%zw zt?impI*0XWSQ6PBI&D{Ow4(W;*>hw%ni6g*c`A3Gx3z9`b~c+VO7wKaf-@p=cTf4d z`4yXc;5-L~7%^0Ha5dd$!|>vFwgbOVNdxTiBK5fB(9%C6Lw)qLtyS;q@!86Gof&H% z1b$jiqfgjAT*X~&z?Wzlbw^}Lz}ZQ{ahwYemp|vqsE8bImDva7=W08-Micf{l&&azVXzi*pa3-C?I0^ z)WI!3xbmAP4}a)nO12tQ4Y4!lKA(*Gd96feV!p|Nn`%obEQnF z;|x5!%3OQ+AuQ3rT_28q-fe(7!TOlJks*t#zm@Z)-|;;+W?NTSgQO*243dfo^vMs)B9dl2@4&yL(v6Vx)4^;P9v5=JD2x?X^YEKqfsG^3acth{S+TyYgA2z6`+f zMMdNbmK0*+-SpO3Nzf3^kOz?owKy9wKDkssI%2B9d+PP7R4ObY@0_8hc8)EU9bq+tG2-_j}8W88u*|$ z0slV0-K}nioxj~hGf051#MA&SSZ|Dd7l5MIm=y<%Gb!VqmISX1LluEm<#R|V%KudpbovRHHAH6Uv$27DIeGes0jn8bzeW^ zoFz{QP72apD}p|l2fa{AMO{}3>&U-SUA+=zzs9}@Vm?%nR1|RqsL8)FetVU=0@r>t zh}(JvyB1AtDSbyf2Fe70t%gQFL7XZo{Xo2d z2#N&VbG)ar_O(ffz7p9X;5sdE*~}6T(++N$hD&xvWw2s}O1=%yODK$2M4Y{;u-GiV zSpjDcKdroozxl(-5c+yALwIeVZTFK~to<(2{R(;BD%_bV+|Qq9XGFw&&b9W2CzCyX znHQqqxOgV~vsh*F=Sw9cE;f*07J&Sh9zpol&$X91~Q= zg;=IKf)+Y6gfmG1tf)gmb4FV;i6$PXhv{P{Z;3iZ7iyrVH(8;s9DW2L&bRddQS0l) zVJ$k#^r>5XmJTl`6-BC$`an)b44!c1gRVW$*sC)RwBU}IlBSCv109_<@*%119cF6g zI`1tgt~b@ZMVgQ-wJ;u2fjTGEX1JFbnb%82krXpax#~=C9!P>y>*qv z*8xPA&N$cDU`-&%Xd%3(U`Fmphzyj71#vI{w9#O``R8cp=NvNDpST(tN$I7fA#q=a^LIuF`~@hI4AI{FLkT>(|hPv4nv>$eJ?52Bc6v$6Tr$L^Oak0y|uN#n94 zqfK=0j&gks&!j{~g_5Y{UIe;?d@?2hP13L$oXfk{^=C3ePH~*n-t@ixa?zY5^rGt6 zTOZsFfN6mmy)Mlf@J4j5Kd z8lMKOFEtrZsiUUr_b%yw4?bc~6Mo`tes>*c`_1%ua{*717e(Z`mW&0`d@SFlda|Lp zn_KiFh5ZLDUWN{3{mVo$XGGY`CBBj8Fg3jiz#i7F9+iT1@+U=6m)-pLY+SKlx7Rag zXzhI!9ZU4uDdEyHXi%1fzW{ncNpFabd-UW^@Mj5@=iOXgSrM_S&<^!{`VR9xHmZJM zoVNK^vqV;Y)5%zt+rrz`Y-VBGAy9F=7l%+`D^m7D!h-M{;TluO?Mn6YrSKQhhV9_p zSU{hN*~ph!{p^xMpC7gI1zFiyYKQRG?J`|r6Q$S64=FNG85)Ou&cc+yGmtj?R_(7j zc8OaFN{0gBv@3Z|%(t{F%+J1wXFK3@mrQmV)>Rea{GWwIj`-=ilA%dmJ2l{tOZem_ zNbYxIUEd{EM>S{4tH|B19Zn+cYnGnx1p{{W9A;;Mn}L=gj?C2@V*3Hv39Kai$@_$1V0kb)rpW)F-Ay*{VO2+TkF`4MA*95ZE7%+-m0d4wRdPK!b^uKlw$Wk+1iaVvZ6*@(3lbMU) z)peUKPM79>$P|LIm*S-82i}@DVgiz+5*Zg8Uw)KPsD7$S4HqZOrmV`NJ8jBi(U%3I zG1Foi@(;xzGh(ul3)&x3yJPr(?;nJ5vru&HfTy_){yE2(Y8joTn2vf;gS+4oSD@^Y zA+M6we08bp^1W}?2=aLVU6+B9l4|`{H%~ko);(#EVD=?6 zrWfmxm3$%`g-fGf5flSb(Li1mclWm zbN%oVl&~A5PJn7i@wm;#Y1|{YE7p3IqUS34zA;@(wFcfyKCW&Yp4&2ghOl`hnW6{EUjn_t3&|*&NG7-hwfy8`F6HP^+l}v=>}q$JOTDhZt^vR12K{Pb*k9 zBM@jX#KNP&T+d272B$7p5m2T^f*+R?yO~&+qg0gemcdbcx>|~R@r^_iU0{QUC(kbUL8>?Mk#cLR~2HP%@@at^9W4g$HGwiefL^HFb8B0L|` zLnS)K6mU7Bi$b%sm+gUt3oTAJL=I3?CW0%C5#VKYiE74mAgYtbmKR_DD(w>+V?&C|zCU8!HK{a4OQbwOeSq+`rStx@1%l&wsxI@1cub?37vhq3CFW zInEq?NrJA3>g%kWb@BH&^DJ3G`U%%B1@FIZBo8XYu1 z0f>9QO70W(vGV(8xZ@Yd--xTclVx97sTEq=Y)mc=K1BP@IDI5#T5*e68sV-p^dWx| ztil7ajH@RiOM$sczxBi;Y%Wnrhdd^43QzI~wLZ^bPG3#YWL6=hI2nmohofz!P6v_K zsgBJP1BIq%7#who>WOeoMD3yC=(z_wmhjb!`G?=SWL5Urhy0&$kW23%paYqwIGwqW zn>t!&ju#KhF21{G^N-W%lV${c+4AU5cH_%WA$eoW{uxw&M5 z@40dm8x0_j6w{AhHC^?>>SF+LBNGHaC*g!^gdKb_StrMH}+ zUe8-$0WvGr5nt|kI);)(n!Ts zJ>p|yURn`=@T&fb^@l;eew_FcVcd@ABUIB(;o<$D`ZiRe?&M#u4OO9s(7@) z2PqlaWS(+6-5x?=R|u#8{-KIZnNpuI-JgZhD9sXaKeaCCP2 zdP3QNM?pb}afvp?7jKWX7%ombAY~;OV=}0JG9W)2(4%Kw{YaYf#Deo|j#8#L6Ohd* zIYDA95OVP;G;JT1jd|wrQ2pcyD|esQA%fdAc*LQTu;-jY?gfQovgn|w`vR;YFAM4n zqi3{fic#+ zsA=$#;+}6J^HwU`@K{PAH0m7;DFG%#ez-+3K!Sjs1nmndWX0VY90YYn{cc~oNS9m} zSj{LZewL_>yMr0JPi7@I+1bb!YizyiYVu2LLnZ3Tdpn1CnC51wJk*aBZF+iy2|FBA z!=v3BDCEddZCZlfVOHWmjeBk|{k=mw!|US+4AAZv3Aj0|g9WhFnO%D%57Q&}uU$ga z0EiQ6<{3Eb8*0%J>*Ok5m6SDlAgDP8T)QhI9w9VFKM|I5tN_e`o)7?3p(VCq&i5k% zSfu~wZ*<)h5MO8ea4SFtY(MuAI(&EJK4dTd*eind0Bx8RVia~( z5Zi*Nkw5yfUWl2;^454R8vC%oS*HW08UTNyk)tp6a4Qrnd5GD)p2mpEuQkNRnW05I zlrEH?(<^I$fY6lv#WF5qO;OpyI;{w*R8g<rx9x{a5 zpCsv^V4-H>HrWOR2A{-ivYCZJhoA5d<`20@jNflPBT}cDiR)ozujextDX+xvs{kqz z_plPw0hQSgg#Ol-aIGR;iDt!ZK|FDJ$TNHG!we7kXGdC_JqYgi zK6G?%!a3R7kx3912ngM;edzcOC?LEbIsn!keF*afdh~-w2NXHJjc_&QyA5y#DG@Xq z5n~%@n?PHe>f_j?%7Oun*!t-DEh%83re~4c%$~&;PRp4#3R_byJCTWe`LoB)v+K^Y z`qvYgS_a0UdE}JuW9|3r&ua)Vg7=f;AdTTa>0CFkFm=zp-?s}PF{_=EVeUG$5CE7p z&e51Z91T=B-LPUZ57A?^tB5zOR1KExT$ZV~Lsh9eq`_s?J@H_6xOa%P=_9$R#cwEJ zx@{uDoobv*FrUU9+pE;z*=smdg;T8*8Dp;HZdB0C$t1Knbon=VT)1K$Um#(g^|$R* zxs7h}JGob37qz1p-ypV>yre!A5Jhv!3vBlM12XYh+O$Q5Q@3`Bq`<=ch8Q2rOZA7u7Hn_qiG}K4K zx_genATz;>qYoPL2v|}e9{^cIFWLG$ZR8XscKO;4Y6|mc{SZmn-eacA9L1%e@@3AN zn?-(fXyPYyGkd(Y@W1rfdIG?e+q_q!>-eUxsDN5EXR0gojSTrf+OGgfd=}vYVHEC) zJ`a$+#Zo*fK@U|azR>cggtRV89$8X2a zb^uyJv5|LfiRF>lj|G=FPo;AzdqLNj5M7%ih4id9{^#opMy|C}zn( zX3yw4eOb;P#Al@=^A)0IjynRj4~~f7keENU`WoHCPkK9wg=qK8o8hB$K~$~HVC2V< z!s5{j8kuAhBtP^63`&4y{+KhXjdPKd$$_IErpMv~I-BLF_MWmWD`AwlL}WE;M$P3% zPVbxq?1uE^SIVQZyhaoSoGOOlJS6E#BZO@{XM&m7-~v*xa8zzhZ|ghGPEqlQDB-j# zgQ!o=pS~od6&25cDh^N8MndbFDJfU8cFxWHqL}*Iv_7a{QBPCnC7sedVm~GJ zC?6=59;csZ6)OSIZtUS+DmRJmih=>s%rCm(H^eJnJzW^}(`~Sdb)0vkpORaA1QIoJ zU_?SG!)ay$B@^g#MbN{~>2g)jON(g?1*xO|%oRrWt&!PKG5!cIN@AoLEMzqZBN-zWB}MXu8{9X9Ov8E$EV3@Cbr#IC za!BrK#TXv2YZJdaPnxKo7b+po9tKjUs8<}?@I@;GA9IR9bvuROdrgYRli`+yKd3+g z{l+&2$Ni~Qy0LQZ`a-$5{dcI1VcFA1TLkd+h zAL&&Fb&19-r?!TyD$dG|ri~Q+@dd0xgtBT;j-6J3q$QU|Z8D^v{=V`dypq;ct4_q; zWnp|{t116g1ICQXA}gCMrfa^DRm)`DTxQ#$DkjyIyCbq|>Fj6gswTu4`3Etv5BFHh z*JExGQH%wr4qcaw%$;lw6-5J4vTwI1x0WAFrK_Cb#tWB94Wf2anab?u0F42ngSDzLk5UrJx=h+!8$NHT; zdZY@Q9q;e&M}B}c*ceqv&Us2Yjo8$9vXyzs@Ar0bCJWPgQs6cyKt))>%(=V5N%G$F zIaW%7VJBoWouE~1%6XM5ioxxk#oXf;&mfBe^jnZJGwQ~)s2)GU7PMP)V(6T8J5TeS z?hG#&$NCQ8=51Pvwr2M>3sekQRAB}UWmL|8_e6wEDR#_QTRh#$5M?r7S*h#YEziJp z)zX@YZj+E<>Zq{WA9p~#;npk<#+vsTuCU5U&)m_y7+Z)4s&eVcqwZx<#d>P2gZ^O* zki>8+j~|iSuQu6jO)gtJ01{T_X2J8WuXCmoQ)Y3pYu$jJxn8Vv9Dw4me#<+=)eB`@ z05ybt!s(%bKw7Ai8Arw%+kMr5xp&>T!>EL~$9zg^`X<6>2$XXuug1oAM3nqS+D)oA zYEPLNUKAG|A|7Z+H-DPe7q9e4FmmGvI7b-I^ESr9%pmHb1~*+fqXposg|Qm!9s~{* zMVl!l`f&=xSgA1nV7N_|Z8h~()P>^6!2G1OR&s|~sWH|k8NY;Z#HzKqKR%*Rwch4| z^fQe}tdHO+Bk^UV(WCrJ%Fq$)I^-uUwunIwcKN%GI+(GoUXOCh-d2P!*v`vA0KDkq z4Pmwh?U;gvP|tcpL>))iB}Yik9Be|Esr<*9MCP&xM~vk=iWUT}4W|`ZQQ0;EN9Q3U zz6=B8(@kre_{P%y44A8VG_v)<86XY$OT|0)UeRmXm()Uj(Rw3{`Kh_b!|c3J;mziZ zY&erY^m)mtTfaB(Os7dE-aW`Lv9>O@+gSFpV=9JXR{(zK)KVmN6 z?oKQoP+$0Lr<<6FgrV{g@lms1Lp*U}grU!NQK}?2O(&zPD157+iR446jrC`gLq0LL zq{=lc?f}jg>s#AP+wp7@tRCZLen^L(9^3*Rbq;PbhAO9iIyS?G)==1{4gg1}QcNJW~P@qYA*G-OeAl&TD>9EeFS!e369crnY&XnvJn|70rWMoUk-AYCXPBaxT}# zv&Tcf``YlVM<_xVj7vj~kf?m}(QLO|Q&N&}2sX1ym|9`lCma2KWo+aDLSJkA49E1R zi+Q!R{jy1M&*s}hA&YH;6)!;YH| zp{Drz;^4C6w+jY`+n`YLT$1-L*Dawp5CxSVc{JH_j#J0v5jM=08ZxkuSgRY^ z)Y@?J!4W1p5R^(x@ZZ;~&ZHGLmD8=dQ`zl#qHAUiOeSt>i^KCR-=NB6oojc5{Fp2t zT=q`HMOcgGq1JkjJ7TD{N>#bQNS(fLt3gu!8hx((?)0xLwo35F8Y%lxV5TEYj;bmxD<&{Swd@}=TW$uFkj9RP0xDq?)fLaWR8zf@fD(W|AD zf=r( z{4!Un737JDxDr^SGr-d>2cycREWr| zLYSD}M8ve;Di3dJ_DC~5+t3HK7Zs@^#5~&slp~*&-GLBK2e+u9+93u+-8m=>NZx4; zP~XjlOsIKBGpl)rRjGML*?Zq<40w3&_d#N=Um*#Sh)|cw<4qf(lwybHnCCg!ic5mqd z&P2WQ8fOU>C0wYgYYv7_T^=>ZD8eJOd8b)W+I$Z;Xk}gm*vxa zh);@h+9CROSk!GXRV+6>(EO!x@T;u>z(af`B~slo@>p_jx7myP@GB^pSpf}tBD(Ai zN}#Ba3cdwHsLBn_1V+KVxFHQaY$mQ6e&Rsx8r$JB-c6^a#MyB;-6!gb3oI7_56cG= z^gh#`Cu}l7yRlKl0`cAY3A7Z=SeJ40=$ob2Lj7v@2M&H}0}-#|Mf1<6r-u3$fc+ff z)`Z^GDoWm6X@8|Lx#YZ-Xv?{Eq;IqWmHPuxuaAs-7Nx3r{9)~zjg}X~Zp`rt@B7JS zC--GTiH;JLMn>;%po{Il-dw-E9pQ<00RBz%^|(5-oNKZek@8%ni@V+lfvnyNfimZT z#a%>w1Seq<)15iK5#m-^SH@cC0C1~XW;Pgc0fN_)1>-yvk4c(zLeZ{*hG-yp*fVLG zkiXf6^x8w8vO5lDnV?=go6qtH=R+Dd3mjZQRjZQA^M-(zCeb>e+l$IGp4Hd(MH1NM z!ENy8a+yI#+B=TJlvz+5}ZQ-x2zZE1E9pyTO1lGT=x*o7d}; z++a;UQ0+TdS_0iJT@qZRA$d#^>{Il#{2J{YN1(wjB{2J3T!2vojA5D9XRI2SWieiz0fG7mUmI-dYEgt- za#axhYf#@W@#}KpdpYX#)j<*;p28}wt^Il_V;N(z7b0x)F}WE^r@qj(rd{_oneg%j z@*(p|m2LFc7`3z__4suQvTUVpt%_kZ4}J1NxQssp}LQUZK$?yxv!l=cZ-9@RKZQ$ZPUf>bN?$fG^}nyXixzWzS`FjX zsaM4XOyvURfjk0O;%-&z$(qu19NX>si6vWvMpY~x-g?e_%Y5X`j~=>cduepQkbp9= zBh?-uk%ci`GJbTORBtusDCJ)NAB5FD74gD3mysymUs+3TRePrSE?sjQq5x8Nwnmaz zfaDWTx~Ok$ZS+?J_TN9Ir|*ET#y3fGQ(Z1?fF%GfNQ6G?e8!c7K4h&dV5 zkrtl|i;0(Aq=P94);4uP!?$`ecYm5lK*2*M2pU9DD#3|p>`Uus$oiD7-|aVgn|CmP zg7N$ry@MbZqXVz^dC&#=DyeVG`(vSEB$|6D1ZJgLYE+HZ1~MnBPIOdc>y&3CHF-sf z{g#(7-9z;Byx>kIqbsA41MfRB3Wha!*E9bsuWqEIllz2K|8<2G?d{}A`+o;;IVgns z{oDJEo`^s}6&iqsr7r&4;gh7)m#KGHB=2h89-p?vPblq7Bo)%}BGCsRR57GXn_Qp| z!DVWbWDnYLO!oxQ(h zxa!=`YWh#S6SY*Mkik&5>{=b z;YsXl={l{Ksa%!@+grQK_qnlqYxdo;zpdbp>3p-dL)=9N(&&8iw}#-dyQQ>~9H`(5 zkKr_h4ITic$6;HMCdq-@yFsIiiDlFyYqizw-gDPBlEThrH)Cvdz{BhNF!TLFMS3L_ zI9Iuaq~p{iE_2Rb5dJ8t$0{`oTrV7hC8jSuzrj+Ed zDSu1Gs6u{fdq%>%YNO?L2R#9dz^pM{kF#cf(J;WH?P>D$1U-zx!uvssv=Lq7Ry{qG zarixvo)|0hZ@uk@JG-rP2%e)Jxz%nXu1ONf1Z4SL^&dOEFIlg=gf%~ZduUELg%cnjZImYOl`!z9<_={BMDr8{)A ztN#QLu3D7|Wwpm+QkFQYKZyxHnk^*k!Va;*j}@I@G``QwHLX8^+wYGrR*`VW9*KzX zhkzcBVxuh6OUGn=Zj3i!9zLNusdbj=&C1hkJE1+O-2GH|k~l(?gKZYK7SJDhf4YR0 z$YC5-E|?R0X8Oa5RVFtw+}ZUcw0ZUaZr z0eSGVO?#*h-HaOjq2bF=bXw|;L*46+^WAtFh~=_c-b4~i>e?)&Wpqon_@l=9xl5;^ zyLGvr8pUlM+OG*5B$1mt!oW{iUc0&gMkC}(RdHP)n2-xjD$sPEy1h73uEEQBPaDPA9B5a1Q+IS z_agYZ}OWLU!x{Q?B7uef(1tD=j5Ipi8xVwoupf9y|(gL{Qp1-g`z~ z^|jYQoGVuf&Q<#ouq<-Fj~QMYHVkI97(z%9J3ppqV| zHQ=0IY(Cp8LEXX)rDQ1LL4Y_Y`1#stGRDMaL4BJhrCa(mNnpQO_tYN0RH!QZ=YU^N zjylfr>d%=~ko^Ee%ck$sc6}5;)u%-^_oO7+@qh%rq5H#ch9iQo14veLiI$YOc;$wY ztnI-TW{9@961E27L(Y790AU7Pir@@s4x&hxf$wmxg8`V%)S`qTOY;r+SnqR(L>(*q zLs(-Z!R)td?0n33Os_)MD%^}TSuO{454@4vO!zTRF2uJ&1qkMKTqWohyq>#m^G`S7 zZU#hevj;>muaVY8UmYN0^dt?YElM>Cc^K|#I$s=Gto9wVS*`bPOlvJk(g8_MT75V^I*an>G znbHlDDHlzf_#$5BZ7L0m4E@=Gs$K~0uDBdq@DbamU{rQ1q;2%_LzoW1Anp7dStzTO ziuq>UDkto2eP4Q0fYJ4Z!aKz*;m!%VPv6cLzcL86f1iHh;`qXc3f?ryig|3}BS7qx zus!%=CfbbX&@eK%sZ6H1gwyzp;*B%@KUaIql01uJvxG z;-h(azz2aoZTKIm+!NZd9|kY9$3?DPBIhJw&)&i6pKl_@vZqQ$JCE+6WZR)w%opSL zOJ=_!|9gwQKrV1q1_1$4eEX7v0QGw)f!#V7L`byq>gROdl;6Emdski0%F@Kjsp;T~ zh@||E^&R^r@Ir?cZRsto1>$I)a_mhL7Zd~p2LxEzg9qSH6t?RlL1{nJEF~dXpnzs- zQ7?6pp0#f1ULs{R1Z{kH;*n=0SPW`+w1yqF|Xv^b?hzmOTXuh5`QHBr9NYE8BmwtbjAE z?|+{#0#VxV*izmc**lpt|F6y)4D!~ozyIL>UO_-mK%Rx$f%@|N4b*%*oA`*v>ZbC?eo8H9fN?7{Nq!b@U4POze%gza$)^%X=917 zARvtYkU|)Kx5Abg59r(Vw{_87cwk8^zwxdv(%%ODIi3B-05RV$;;+M6{BFYE-2ZO3 zfq;fAWN^{?`p6bn8p;o z6&}2OY5pPA>Hvj@$bhxI7{7maz>!`&uuR?G7)&3{Z{_xKdDgf$4*_o;`2SJP{_vYP z=>-i`%7Ov{`Uw6Q$?C%ci!^#GBLJ?LVgpb65dPpVZ#bFBZymmV+TX?rtg&joy%}GA z+dJj@$GDjFe~ef5|1~_`j|XOE_ZvqT_%p`=c?a;o@*RIW`!s;_$5G51=IQoV9|uT3 zfbiQHIeV}Y-P<~?8Rabx?H^}u9zfJV_TQukVGbMbx7iRL90Y{tAJXn;AZ`#JuzL7! zb7}_hz*_u&dpR3q{jE#`tFNwx1_Dw-_rD&@gWiaLJQyGgOy|9|nf9$JZ2x$8P5y0- zc@zrRF@*c4ElWdqU{_!Mw&hnxBLL~Y{;dJ;S3Iz}jJILN1v-3v_qztbjCRcSH{&F4 zqs8!#@tEAVHj)AV(@8IH%83R4F)TVv_S*n8gcQQB`=t4=8vbJ-wD^ro0F10f{%;?2 z595Iyl>9dGGEDQQ#&jciU<{Q&!&=_|^5WjG*Q(#Vi4medyo)zXqxLt(JWBoB`G02Y kH^;>PI6r9slC+XyDak^ Date: Wed, 11 Mar 2015 14:27:03 +0100 Subject: [PATCH 203/314] Do not reset client settings when connecting to a server. --- .../lunatrius/schematica/handler/client/TickHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index ed3899fe..32a56d64 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -22,8 +22,10 @@ private TickHandler() {} @SubscribeEvent public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { + /* TODO: is this still needed? Reference.logger.info("Scheduling client settings reset."); ClientProxy.isPendingReset = true; + */ } @SubscribeEvent @@ -52,6 +54,7 @@ public void onClientTick(TickEvent.ClientTickEvent event) { if (ClientProxy.isPendingReset) { Schematica.proxy.resetSettings(); ClientProxy.isPendingReset = false; + Reference.logger.info("Client settings have been reset."); } this.minecraft.mcProfiler.endSection(); From 29346b509c7ea7885be58a7fd32211ffec9a7c87 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 11 Mar 2015 14:35:58 +0100 Subject: [PATCH 204/314] Tweaked logging messages and log levels. --- .../lunatrius/schematica/client/gui/GuiSchematicLoad.java | 2 +- .../schematica/client/renderer/shader/ShaderProgram.java | 8 ++++---- .../schematica/command/CommandSchematicaDownload.java | 2 +- .../schematica/command/CommandSchematicaList.java | 4 ++-- .../schematica/command/CommandSchematicaRemove.java | 2 +- .../schematica/command/CommandSchematicaSave.java | 6 +++--- .../lunatrius/schematica/handler/DownloadHandler.java | 6 +++--- .../schematica/handler/client/ChatEventHandler.java | 2 +- .../schematica/network/message/MessageCapabilities.java | 2 +- .../github/lunatrius/schematica/proxy/ClientProxy.java | 4 ++-- .../github/lunatrius/schematica/proxy/CommonProxy.java | 6 +++--- .../github/lunatrius/schematica/proxy/ServerProxy.java | 2 +- .../github/lunatrius/schematica/world/SchematicWorld.java | 2 +- .../schematica/world/chunk/SchematicContainer.java | 2 +- .../schematica/world/schematic/SchematicAlpha.java | 6 +++--- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index ca19cd0b..739d6d4b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -128,7 +128,7 @@ protected void reloadSchematics() { File[] filesFolders = this.currentDirectory.listFiles(FILE_FILTER_FOLDER); if (filesFolders == null) { - Reference.logger.error(String.format("listFiles returned null (directory: %s)!", this.currentDirectory)); + Reference.logger.error("listFiles returned null (directory: {})!", this.currentDirectory); } else { for (File file : filesFolders) { if (file == null) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java index 673a92ae..1bfd738c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java @@ -52,7 +52,7 @@ private void init(String domain, String vertShaderFilename, String fragShaderFil GL20.glLinkProgram(this.program); if (GL20.glGetProgrami(this.program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) { - Reference.logger.error(String.format("Could not link shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); + Reference.logger.error("Could not link shader: {}", GL20.glGetProgramInfoLog(this.program, 1024)); GL20.glDeleteProgram(this.program); this.program = 0; return; @@ -61,7 +61,7 @@ private void init(String domain, String vertShaderFilename, String fragShaderFil GL20.glValidateProgram(this.program); if (GL20.glGetProgrami(this.program, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) { - Reference.logger.error(String.format("Could not validate shader: %s", GL20.glGetProgramInfoLog(this.program, 1024))); + Reference.logger.error("Could not validate shader: {}", GL20.glGetProgramInfoLog(this.program, 1024)); GL20.glDeleteProgram(this.program); this.program = 0; } @@ -75,7 +75,7 @@ private int loadAndCompileShader(String domain, String filename, int shaderType) final int handle = GL20.glCreateShader(shaderType); if (handle == 0) { - Reference.logger.error(String.format("Could not create shader of type %d for %s: %s", shaderType, filename, GL20.glGetProgramInfoLog(this.program, 1024))); + Reference.logger.error("Could not create shader of type {} for {}: {}", shaderType, filename, GL20.glGetProgramInfoLog(this.program, 1024)); return 0; } @@ -89,7 +89,7 @@ private int loadAndCompileShader(String domain, String filename, int shaderType) GL20.glCompileShader(handle); if (GL20.glGetShaderi(handle, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) { - Reference.logger.error(String.format("Could not compile shader %s: %s", filename, GL20.glGetShaderInfoLog(this.program, 1024))); + Reference.logger.error("Could not compile shader {}: {}", filename, GL20.glGetShaderInfoLog(this.program, 1024)); GL20.glDeleteShader(handle); return 0; } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index fd1fb4f2..d9642ba4 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -71,7 +71,7 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE final EntityPlayerMP player = (EntityPlayerMP) sender; final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (!FileUtils.contains(directory, filename)) { - Reference.logger.error(player.getDisplayName().getFormattedText() + " has tried to download the file " + filename); + Reference.logger.error("{} has tried to download the file {}", player.getCommandSenderName(), filename); throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index c41d2289..4987dcbd 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -61,13 +61,13 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (schematicDirectory == null) { - Reference.logger.info(String.format("Unable to determine the schematic directory for player %s", player)); + Reference.logger.warn("Unable to determine the schematic directory for player {}", player); throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); } if (!schematicDirectory.exists()) { if (!schematicDirectory.mkdirs()) { - Reference.logger.info(String.format("Could not create player schematic directory %s", schematicDirectory.getAbsolutePath())); + Reference.logger.warn("Could not create player schematic directory {}", schematicDirectory.getAbsolutePath()); throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 2f122340..66719d46 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -68,7 +68,7 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); File file = new File(schematicDirectory, filename); if (!FileUtils.contains(schematicDirectory, file)) { - Reference.logger.error(player.getDisplayName().getFormattedText() + " has tried to download the file " + filename); + Reference.logger.error("{} has tried to download the file {}", player.getCommandSenderName(), filename); throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 924b119f..7275a6d8 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -56,17 +56,17 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com throw new WrongUsageException(getCommandUsage(sender)); } - Reference.logger.info(String.format("Saving schematic from %s to %s to %s", from, to, filename)); + Reference.logger.debug("Saving schematic from {} to {} to {}", from, to, filename); final File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (schematicDirectory == null) { //Chances are that if this is null, we could not retrieve their UUID. - Reference.logger.info(String.format("Unable to determine the schematic directory for player %s", player)); + Reference.logger.warn("Unable to determine the schematic directory for player {}", player); throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); } if (!schematicDirectory.exists()) { if (!schematicDirectory.mkdirs()) { - Reference.logger.info(String.format("Could not create player schematic directory %s", schematicDirectory.getAbsolutePath())); + Reference.logger.warn("Could not create player schematic directory {}", schematicDirectory.getAbsolutePath()); throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java index 22b0c25c..9e91423e 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -48,11 +48,11 @@ private void processQueue() { if (!transfer.state.isWaiting()) { if (++transfer.timeout >= Constants.Network.TIMEOUT) { if (++transfer.retries >= Constants.Network.RETRIES) { - Reference.logger.warn(String.format("%s's download was dropped!", player.getDisplayName().getFormattedText())); + Reference.logger.warn("{}'s download was dropped!", player.getCommandSenderName()); return; } - Reference.logger.warn(String.format("%s's download timed out, retrying (#%d)", player.getDisplayName().getFormattedText(), transfer.retries)); + Reference.logger.warn("{}'s download timed out, retrying (#{})", player.getCommandSenderName(), transfer.retries); sendChunk(player, transfer); transfer.timeout = 0; @@ -79,7 +79,7 @@ private void sendBegin(EntityPlayerMP player, SchematicTransfer transfer) { private void sendChunk(EntityPlayerMP player, SchematicTransfer transfer) { transfer.setState(SchematicTransfer.State.CHUNK); - Reference.logger.trace("Sending chunk " + transfer.baseX + "," + transfer.baseY + "," + transfer.baseZ); + Reference.logger.trace("Sending chunk {},{},{}", transfer.baseX, transfer.baseY, transfer.baseZ); MessageDownloadChunk message = new MessageDownloadChunk(transfer.schematic, transfer.baseX, transfer.baseY, transfer.baseZ); PacketHandler.INSTANCE.sendTo(message, player); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 25915f43..498274cb 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -19,7 +19,7 @@ public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { if (this.chatLines < 20) { this.chatLines++; String message = event.message.getFormattedText(); - Reference.logger.debug(String.format("Message #%d: %s", this.chatLines, message)); + Reference.logger.debug("Message #{}: {}", this.chatLines, message); if (message.contains(Names.SBC.DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); SchematicPrinter.INSTANCE.setEnabled(false); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java index 1e89987a..27b7ab79 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java @@ -43,7 +43,7 @@ public IMessage onMessage(MessageCapabilities message, MessageContext ctx) { Schematica.proxy.isSaveEnabled = message.isSaveEnabled; Schematica.proxy.isLoadEnabled = message.isLoadEnabled; - Reference.logger.info(String.format("Server capabilities{printer=%s, save=%s, load=%s}", message.isPrinterEnabled, message.isSaveEnabled, message.isLoadEnabled)); + Reference.logger.info("Server capabilities{printer={}, save={}, load={}}", message.isPrinterEnabled, message.isSaveEnabled, message.isLoadEnabled); return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 9b4984b5..597715d3 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -211,7 +211,7 @@ public File getDataDirectory() { try { return file.getCanonicalFile(); } catch (IOException e) { - Reference.logger.info("Could not canonize path!", e); + Reference.logger.debug("Could not canonize path!", e); } return file; } @@ -248,7 +248,7 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam SchematicWorld world = new SchematicWorld(schematic); - Reference.logger.info(String.format("Loaded %s [w:%d,h:%d,l:%d]", filename, world.getWidth(), world.getHeight(), world.getLength())); + Reference.logger.debug("Loaded {} [w:{},h:{},l:{}]", filename, world.getWidth(), world.getHeight(), world.getLength()); setActiveSchematic(world); MINECRAFT.theWorld.addWorldAccess(RenderSchematic.INSTANCE); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 36e3be5a..d1ecb4d2 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -65,7 +65,7 @@ public void serverStarting(FMLServerStartingEvent event) { public void createFolders() { if (!ConfigurationHandler.schematicDirectory.exists()) { if (!ConfigurationHandler.schematicDirectory.mkdirs()) { - Reference.logger.info("Could not create schematic directory [%s]!", ConfigurationHandler.schematicDirectory.getAbsolutePath()); + Reference.logger.warn("Could not create schematic directory [{}]!", ConfigurationHandler.schematicDirectory.getAbsolutePath()); } } } @@ -110,7 +110,7 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); schematic.setTileEntity(localPos, reloadedTileEntity); } catch (NBTConversionException nce) { - Reference.logger.error(String.format("Error while trying to save tile entity '%s'!", tileEntity), nce); + Reference.logger.error("Error while trying to save tile entity '{}'!", tileEntity, nce); schematic.setBlockState(localPos, Blocks.bedrock.getDefaultState()); } } @@ -133,7 +133,7 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, final Entity reloadedEntity = NBTHelper.reloadEntity(entity, minX, minY, minZ); schematic.addEntity(reloadedEntity); } catch (NBTConversionException nce) { - Reference.logger.error(String.format("Error while trying to save entity '%s'!", entity), nce); + Reference.logger.error("Error while trying to save entity '{}'!", entity, nce); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index f410b44f..6a6d44f7 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -98,7 +98,7 @@ private int getSpaceUsedByDirectory(File directory) { public File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory) { final UUID playerId = player.getUniqueID(); if (playerId == null) { - Reference.logger.warn("Unable to identify player", player.toString()); + Reference.logger.warn("Unable to identify player {}", player.toString()); return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 4e631829..1ed9442a 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -193,7 +193,7 @@ public void initializeTileEntity(TileEntity tileEntity) { tileEntity.invalidate(); tileEntity.validate(); } catch (Exception e) { - Reference.logger.error(String.format("TileEntity validation for %s failed!", tileEntity.getClass()), e); + Reference.logger.error("TileEntity validation for {} failed!", tileEntity.getClass(), e); } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java index dbcfd463..59a2276e 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java @@ -61,7 +61,7 @@ public void next() { return; } - Reference.logger.debug(String.format("Copying chunk at [%d,%d] into %s", this.curChunkX, this.curChunkZ, this.file.getName())); + Reference.logger.debug("Copying chunk at [{},{}] into {}", this.curChunkX, this.curChunkZ, this.file.getName()); Schematica.proxy.copyChunkToSchematic(this.schematic, this.world, this.curChunkX, this.curChunkZ, this.minX, this.maxX, this.minY, this.maxY, this.minZ, this.maxZ); this.processedChunks++; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 338a4bc6..437b331d 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -84,7 +84,7 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { final IBlockState blockState = block.getStateFromMeta(meta); schematic.setBlockState(pos, blockState); } catch (Exception e) { - Reference.logger.error(String.format("Could not set block state at %s to %s with metadata %d", pos, BLOCK_REGISTRY.getNameForObject(block), meta), e); + Reference.logger.error("Could not set block state at {} to {} with metadata {}", pos, BLOCK_REGISTRY.getNameForObject(block), meta, e); } } } @@ -160,7 +160,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { if (--count > 0) { final IBlockState blockState = schematic.getBlockState(tePos); Block block = blockState.getBlock(); - Reference.logger.error(String.format("Block %s[%s] with TileEntity %s failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName()), e); + Reference.logger.error("Block {}[{}] with TileEntity {} failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName(), e); } localBlocks[index] = (byte) BLOCK_REGISTRY.getId(Blocks.bedrock); localMetadata[index] = 0; @@ -185,7 +185,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { entityList.appendTag(entityCompound); } } catch (Throwable t) { - Reference.logger.error(String.format("Entity %s failed to save, skipping!", entity), t); + Reference.logger.error("Entity {} failed to save, skipping!", entity, t); } } From 7851d772af2f3c07ce0c55b4c1c4e8aff79f32ed Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 11 Mar 2015 14:44:25 +0100 Subject: [PATCH 205/314] Use the FileUtils from the core. --- .../command/CommandSchematicaDownload.java | 2 +- .../command/CommandSchematicaList.java | 2 +- .../command/CommandSchematicaRemove.java | 2 +- .../lunatrius/schematica/util/FileUtils.java | 36 ------------------- 4 files changed, 3 insertions(+), 39 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/util/FileUtils.java diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index d9642ba4..951b6eb5 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.command; +import com.github.lunatrius.core.util.FileUtils; import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.api.ISchematic; @@ -7,7 +8,6 @@ import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.util.FileUtils; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 4987dcbd..0676f0c8 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -1,10 +1,10 @@ package com.github.lunatrius.schematica.command; +import com.github.lunatrius.core.util.FileUtils; import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.util.FileUtils; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 66719d46..1f152fc0 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -1,9 +1,9 @@ package com.github.lunatrius.schematica.command; +import com.github.lunatrius.core.util.FileUtils; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.util.FileUtils; import com.google.common.base.Charsets; import com.google.common.hash.Hashing; import joptsimple.internal.Strings; diff --git a/src/main/java/com/github/lunatrius/schematica/util/FileUtils.java b/src/main/java/com/github/lunatrius/schematica/util/FileUtils.java deleted file mode 100644 index 7db37813..00000000 --- a/src/main/java/com/github/lunatrius/schematica/util/FileUtils.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.github.lunatrius.schematica.util; - -import com.github.lunatrius.schematica.reference.Reference; - -import java.io.File; -import java.io.IOException; - -public class FileUtils { - // http://stackoverflow.com/a/3758880/1166946 - public static String humanReadableByteCount(final long bytes) { - final int unit = 1024; - if (bytes < unit) { - return bytes + " B"; - } - - int exp = (int) (Math.log(bytes) / Math.log(unit)); - final String pre = "KMGTPE".charAt(exp - 1) + "i"; - - return String.format("%3.0f %sB", bytes / Math.pow(unit, exp), pre); - } - - public static boolean contains(final File root, final String filename) { - return contains(root, new File(root, filename)); - } - - // http://stackoverflow.com/q/18227634/1166946 - public static boolean contains(final File root, final File file) { - try { - return file.getCanonicalPath().startsWith(root.getCanonicalPath() + File.separator); - } catch (IOException e) { - Reference.logger.error("", e); - } - - return false; - } -} From 6efdf57f538305c7b468debd54d1ed8bd57b720c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 12 Mar 2015 18:49:23 +0100 Subject: [PATCH 206/314] Fixed the printer being disabled on the first world load. --- .../com/github/lunatrius/schematica/SchematicPrinter.java | 4 ++-- .../com/github/lunatrius/schematica/proxy/ClientProxy.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java index 09cefe17..76341210 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java @@ -54,8 +54,8 @@ public class SchematicPrinter { private final Minecraft minecraft = Minecraft.getMinecraft(); - private boolean isEnabled; - private boolean isPrinting; + private boolean isEnabled = true; + private boolean isPrinting = false; private SchematicWorld schematic = null; private byte[][][] timeout = null; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 597715d3..cd74ffce 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -203,6 +203,8 @@ public void postInit(FMLPostInitializationEvent event) { dispatcherVanilla = MINECRAFT.getBlockRendererDispatcher(); dispatcherSchematic = new SchematicBlockRendererDispatcher(dispatcherVanilla.getBlockModelShapes(), MINECRAFT.gameSettings); ((IReloadableResourceManager) MINECRAFT.getResourceManager()).registerReloadListener(dispatcherSchematic); + + resetSettings(); } @Override From a735c217baa8b2a2b25d4e45e20d601486347c03 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 13 Mar 2015 15:58:23 +0100 Subject: [PATCH 207/314] Moved the block list creation to a separate class. --- .../client/gui/GuiSchematicMaterials.java | 15 +-- .../client/gui/GuiSchematicMaterialsSlot.java | 22 ++-- .../lunatrius/schematica/util/BlockList.java | 93 ++++++++++++++ .../schematica/world/SchematicWorld.java | 116 ------------------ 4 files changed, 113 insertions(+), 133 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/util/BlockList.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java index 0f6a6dde..3caebdcc 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java @@ -2,6 +2,7 @@ import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.util.BlockList; import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -9,7 +10,6 @@ import net.minecraft.item.ItemStack; import java.io.IOException; -import java.util.ArrayList; import java.util.List; public class GuiSchematicMaterials extends GuiScreenBase { @@ -24,12 +24,8 @@ public class GuiSchematicMaterials extends GuiScreenBase { public GuiSchematicMaterials(GuiScreen guiScreen) { super(guiScreen); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); - if (schematic != null) { - this.blockList = schematic.getBlockList(); - } else { - this.blockList = new ArrayList(); - } + final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + this.blockList = new BlockList().getList(schematic); } @Override @@ -59,6 +55,11 @@ protected void actionPerformed(GuiButton guiButton) { } } + @Override + public void renderToolTip(ItemStack stack, int x, int y) { + super.renderToolTip(stack, x, y); + } + @Override public void drawScreen(int x, int y, float partialTicks) { this.guiSchematicMaterialsSlot.drawScreen(x, y, partialTicks); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java index 0d3e42fa..62e1e42e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java @@ -2,8 +2,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; class GuiSchematicMaterialsSlot extends GuiSlot { @@ -13,8 +13,6 @@ class GuiSchematicMaterialsSlot extends GuiSlot { protected int selectedIndex = -1; - private final String strUnknownBlock = I18n.format("schematica.gui.unknownblock"); - public GuiSchematicMaterialsSlot(GuiSchematicMaterials par1) { super(Minecraft.getMinecraft(), par1.width, par1.height, 16, par1.height - 34, 24); this.guiSchematicMaterials = par1; @@ -44,22 +42,26 @@ protected void drawBackground() { protected void drawContainerBackground(Tessellator tessellator) { } + @Override + protected int getScrollBarX() { + return this.width / 2 + getListWidth() / 2 + 2; + } + @Override protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouseY) { ItemStack itemStack = this.guiSchematicMaterials.blockList.get(index); - String itemName; + String itemName = itemStack.getItem().getItemStackDisplayName(itemStack); String amount = Integer.toString(itemStack.stackSize); - if (itemStack.getItem() != null) { - itemName = itemStack.getItem().getItemStackDisplayName(itemStack); - } else { - itemName = this.strUnknownBlock; - } - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRendererObj, x, y, itemStack); this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, itemName, x + 24, y + 6, 0xFFFFFF); this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amount, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amount), y + 6, 0xFFFFFF); + + if (mouseX > x && mouseY > y && mouseX <= x + 18 && mouseY <= y + 18) { + this.guiSchematicMaterials.renderToolTip(itemStack, mouseX, mouseY); + GlStateManager.disableLighting(); + } } } diff --git a/src/main/java/com/github/lunatrius/schematica/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/util/BlockList.java new file mode 100644 index 00000000..3b04b933 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/util/BlockList.java @@ -0,0 +1,93 @@ +package com.github.lunatrius.schematica.util; + +import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.SchematicWorld; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class BlockList { + private static final Comparator BLOCK_COMPARATOR = new Comparator() { + @Override + public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { + final String nameA = itemStackA.getItem().getItemStackDisplayName(itemStackA); + final String nameB = itemStackB.getItem().getItemStackDisplayName(itemStackB); + + return nameA.compareTo(nameB); + } + }; + + private final Minecraft minecraft = Minecraft.getMinecraft(); + + public List getList(final SchematicWorld world) { + final List blockList = new ArrayList(); + + if (world == null) { + return blockList; + } + + final MovingObjectPosition movingObjectPosition = new MovingObjectPosition(this.minecraft.thePlayer); + + for (final MBlockPos pos : MBlockPos.getAllInRange(BlockPos.ORIGIN, new BlockPos(world.getWidth() - 1, world.getHeight() - 1, world.getLength() - 1))) { + if (world.isRenderingLayer && pos.getY() != world.renderingLayer) { + continue; + } + + final IBlockState blockState = world.getBlockState(pos); + final Block block = blockState.getBlock(); + + if (block == Blocks.air || world.isAirBlock(pos)) { + continue; + } + + ItemStack stack = null; + + try { + stack = block.getPickBlock(movingObjectPosition, world, pos); + } catch (final Exception e) { + Reference.logger.debug("Could not get the pick block for: {}", blockState, e); + } + + if (stack != null && stack.getItem() != null) { + final ItemStack itemStack = findItemStack(blockList, stack); + if (itemStack != null) { + itemStack.stackSize++; + } else { + final ItemStack stackCopy = stack.copy(); + stackCopy.stackSize = 1; + blockList.add(stackCopy); + } + } else { + Reference.logger.debug("Could not find the item for: {}", blockState); + } + } + + try { + Collections.sort(blockList, BLOCK_COMPARATOR); + } catch (final Exception e) { + Reference.logger.error("Could not sort the block list", e); + } + + return blockList; + } + + private ItemStack findItemStack(final List blockList, final ItemStack pickBlock) { + for (final ItemStack itemStack : blockList) { + if (itemStack.isItemEqual(pickBlock)) { + return itemStack; + } + } + + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java index 1ed9442a..f5a1e4c9 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java @@ -2,24 +2,15 @@ import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; -import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; -import net.minecraft.block.Block; -import net.minecraft.block.BlockDoublePlant; -import net.minecraft.block.BlockLeavesBase; -import net.minecraft.block.BlockLog; -import net.minecraft.block.BlockSlab; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntitySkull; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.EnumDifficulty; @@ -31,19 +22,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.List; public class SchematicWorld extends WorldClient { private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); - private static final Comparator BLOCK_COMPARATOR = new Comparator() { - @Override - public int compare(ItemStack itemStackA, ItemStack itemStackB) { - return itemStackA.getUnlocalizedName().compareTo(itemStackB.getUnlocalizedName()); - } - }; private ISchematic schematic; @@ -209,104 +191,6 @@ public List getTileEntities() { return this.schematic.getTileEntities(); } - public List getBlockList() { - final List blockList = new ArrayList(); - final MBlockPos pos = new MBlockPos(); - - int itemDamage; - IBlockState blockState; - Block block; - Item item; - ItemStack itemStack; - - final int width = this.schematic.getWidth(); - final int height = this.schematic.getHeight(); - final int length = this.schematic.getLength(); - - for (pos.y = 0; pos.y < height; pos.y++) { - if (this.isRenderingLayer && pos.y != this.renderingLayer) { - continue; - } - - for (pos.z = 0; pos.z < length; pos.z++) { - for (pos.x = 0; pos.x < width; pos.x++) { - blockState = getBlockState(pos); - block = blockState.getBlock(); - item = Item.getItemFromBlock(block); - itemDamage = block.getMetaFromState(blockState); - - if (block == Blocks.air || isAirBlock(pos)) { - continue; - } - - if (BlockInfo.BLOCK_LIST_IGNORE_BLOCK.contains(block)) { - continue; - } - - if (BlockInfo.BLOCK_LIST_IGNORE_METADATA.contains(block)) { - itemDamage = 0; - } - - Item tmp = BlockInfo.BLOCK_ITEM_MAP.get(block); - if (tmp != null) { - item = tmp; - Block blockFromItem = Block.getBlockFromItem(item); - if (blockFromItem != Blocks.air) { - block = blockFromItem; - } else { - itemDamage = 0; - } - } - - if (block instanceof BlockLog || block instanceof BlockLeavesBase) { - itemDamage &= 0x03; - } - - if (block instanceof BlockSlab) { - itemDamage &= 0x07; - } - - if (block instanceof BlockDoublePlant) { - if ((itemDamage & 0x08) == 0x08) { - continue; - } - } - - if (block == Blocks.cocoa) { - itemDamage = 0x03; - } - - if (item == Items.skull) { - TileEntity tileEntity = getTileEntity(pos); - if (tileEntity instanceof TileEntitySkull) { - itemDamage = ((TileEntitySkull) tileEntity).getSkullType(); - } - } - - itemStack = null; - for (ItemStack stack : blockList) { - if (stack.getItem() == item && stack.getItemDamage() == itemDamage) { - itemStack = stack; - itemStack.stackSize++; - break; - } - } - - if (itemStack == null) { - itemStack = new ItemStack(item, 1, itemDamage); - if (itemStack.getItem() != null) { - blockList.add(itemStack); - } - } - } - } - } - - Collections.sort(blockList, BLOCK_COMPARATOR); - - return blockList; - } - public boolean toggleRendering() { this.isRendering = !this.isRendering; return this.isRendering; From cd48b1530005e9bfb369c83df1f0c941146c294a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 15 Mar 2015 14:48:39 +0100 Subject: [PATCH 208/314] Moved classes into appropriate packages. --- .../client/gui/GuiSchematicControl.java | 9 +++--- .../client/gui/GuiSchematicLoad.java | 6 ++-- .../client/gui/GuiSchematicMaterials.java | 8 ++--- .../printer}/SchematicPrinter.java | 4 +-- .../client/renderer/RenderSchematic.java | 5 ++- .../SchematicBlockRendererDispatcher.java | 6 ++-- .../renderer/chunk/overlay/RenderOverlay.java | 2 +- .../chunk/proxy/SchematicRenderChunkList.java | 2 +- .../chunk/proxy/SchematicRenderChunkVbo.java | 2 +- .../{ => client}/util/BlockList.java | 4 +-- .../{ => client}/util/RotationHelper.java | 4 +-- .../{ => client}/world/SchematicWorld.java | 4 +-- .../world/chunk/ChunkProviderSchematic.java | 6 ++-- .../world/chunk/ChunkSchematic.java | 6 +--- .../command/CommandSchematicaDownload.java | 2 +- .../command/CommandSchematicaList.java | 2 +- .../handler/client/ChatEventHandler.java | 2 +- .../handler/client/InputHandler.java | 9 +++--- .../handler/client/OverlayHandler.java | 6 ++-- .../handler/client/RenderTickHandler.java | 5 ++- .../handler/client/TickHandler.java | 6 ++-- .../network/message/MessageCapabilities.java | 2 +- .../schematica/proxy/ClientProxy.java | 32 ++++--------------- .../schematica/proxy/CommonProxy.java | 9 ------ .../schematica/proxy/ServerProxy.java | 19 ----------- .../schematica/tooltip/TooltipHandler.java | 2 +- .../{ => util}/FileFilterSchematic.java | 2 +- 27 files changed, 54 insertions(+), 112 deletions(-) rename src/main/java/com/github/lunatrius/schematica/{ => client/printer}/SchematicPrinter.java (99%) rename src/main/java/com/github/lunatrius/schematica/{ => client}/util/BlockList.java (96%) rename src/main/java/com/github/lunatrius/schematica/{ => client}/util/RotationHelper.java (99%) rename src/main/java/com/github/lunatrius/schematica/{ => client}/world/SchematicWorld.java (97%) rename src/main/java/com/github/lunatrius/schematica/{ => client}/world/chunk/ChunkProviderSchematic.java (91%) rename src/main/java/com/github/lunatrius/schematica/{ => client}/world/chunk/ChunkSchematic.java (86%) rename src/main/java/com/github/lunatrius/schematica/{ => util}/FileFilterSchematic.java (90%) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java index c4d90d56..db1aeb9e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java @@ -2,13 +2,12 @@ import com.github.lunatrius.core.client.gui.GuiNumericField; import com.github.lunatrius.core.client.gui.GuiScreenBase; -import com.github.lunatrius.schematica.SchematicPrinter; -import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.client.util.RotationHelper; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; -import com.github.lunatrius.schematica.util.RotationHelper; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -57,7 +56,7 @@ public class GuiSchematicControl extends GuiScreenBase { public GuiSchematicControl(GuiScreen guiScreen) { super(guiScreen); - this.schematic = Schematica.proxy.getActiveSchematic(); + this.schematic = ClientProxy.schematic; this.printer = SchematicPrinter.INSTANCE; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java index 739d6d4b..f4755d09 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java @@ -1,12 +1,12 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.core.client.gui.GuiScreenBase; -import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.util.FileFilterSchematic; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -163,7 +163,7 @@ private void loadSchematic() { if (selectedIndex >= 0 && selectedIndex < this.schematicFiles.size()) { GuiSchematicEntry schematicEntry = this.schematicFiles.get(selectedIndex); if (Schematica.proxy.loadSchematic(null, this.currentDirectory, schematicEntry.getName())) { - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + SchematicWorld schematic = ClientProxy.schematic; if (schematic != null) { ClientProxy.moveSchematicToPlayer(schematic); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java index 3caebdcc..bc3d93d6 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java @@ -1,9 +1,9 @@ package com.github.lunatrius.schematica.client.gui; import com.github.lunatrius.core.client.gui.GuiScreenBase; -import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.util.BlockList; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.client.util.BlockList; +import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -24,7 +24,7 @@ public class GuiSchematicMaterials extends GuiScreenBase { public GuiSchematicMaterials(GuiScreen guiScreen) { super(guiScreen); - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; this.blockList = new BlockList().getList(schematic); } diff --git a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java similarity index 99% rename from src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java rename to src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 76341210..d53a73ef 100644 --- a/src/main/java/com/github/lunatrius/schematica/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -1,13 +1,13 @@ -package com.github.lunatrius.schematica; +package com.github.lunatrius.schematica.client.printer; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.config.BlockInfo; import com.github.lunatrius.schematica.config.PlacementData; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.state.IBlockState; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 6b974581..d6ad4c16 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -4,7 +4,6 @@ import com.github.lunatrius.core.client.renderer.GeometryTessellator; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; -import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.chunk.OverlayRenderDispatcher; import com.github.lunatrius.schematica.client.renderer.chunk.container.SchematicChunkRenderContainer; import com.github.lunatrius.schematica.client.renderer.chunk.container.SchematicChunkRenderContainerList; @@ -15,9 +14,9 @@ import com.github.lunatrius.schematica.client.renderer.chunk.proxy.SchematicRenderChunkList; import com.github.lunatrius.schematica.client.renderer.chunk.proxy.SchematicRenderChunkVbo; import com.github.lunatrius.schematica.client.renderer.shader.ShaderProgram; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.world.SchematicWorld; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import net.minecraft.client.Minecraft; @@ -208,7 +207,7 @@ public void onRenderWorldLast(final RenderWorldLastEvent event) { if (player != null) { this.profiler.startSection("schematica"); ClientProxy.setPlayerData(player, event.partialTicks); - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; final boolean isRenderingSchematic = schematic != null && schematic.isRendering; this.profiler.startSection("schematic"); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java index 61442f3a..32a13d59 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.renderer; -import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; @@ -21,7 +21,7 @@ public SchematicBlockRendererDispatcher(final BlockModelShapes blockModelShapes, @Override public boolean renderBlock(final IBlockState blockState, final BlockPos pos, final IBlockAccess blockAccess, final WorldRenderer worldRenderer) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; final BlockPos realPos = new BlockPos(pos.getX() + schematic.position.x, pos.getY() + schematic.position.y, pos.getZ() + schematic.position.z); final WorldClient world = this.minecraft.theWorld; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 9ca429a8..fceaa1ee 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -4,8 +4,8 @@ import com.github.lunatrius.core.client.renderer.GeometryTessellator; import com.github.lunatrius.core.client.renderer.vertex.VertexFormats; import com.github.lunatrius.schematica.client.renderer.chunk.CompiledOverlay; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java index 75a3bc44..cf5b775d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.renderer.chunk.proxy; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java index 5490f0b0..1ac96b70 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.renderer.chunk.proxy; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; diff --git a/src/main/java/com/github/lunatrius/schematica/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java similarity index 96% rename from src/main/java/com/github/lunatrius/schematica/util/BlockList.java rename to src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 3b04b933..2d8e2e97 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -1,8 +1,8 @@ -package com.github.lunatrius.schematica.util; +package com.github.lunatrius.schematica.client.util; import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java similarity index 99% rename from src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java rename to src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index 871514e0..a61b1add 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -1,9 +1,9 @@ -package com.github.lunatrius.schematica.util; +package com.github.lunatrius.schematica.client.util; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.storage.Schematic; import net.minecraft.block.Block; import net.minecraft.block.BlockLever; diff --git a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java similarity index 97% rename from src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java rename to src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index f5a1e4c9..c7599f47 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -1,9 +1,9 @@ -package com.github.lunatrius.schematica.world; +package com.github.lunatrius.schematica.client.world; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.client.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.chunk.ChunkProviderSchematic; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java similarity index 91% rename from src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java rename to src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index 1dab7186..f6831dff 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -1,6 +1,6 @@ -package com.github.lunatrius.schematica.world.chunk; +package com.github.lunatrius.schematica.client.world.chunk; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import net.minecraft.entity.EnumCreatureType; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; @@ -17,13 +17,11 @@ public class ChunkProviderSchematic implements IChunkProvider { private final SchematicWorld world; private final Chunk emptyChunk; - // private final ChunkSchematic chunks[][]; private final Map chunks = new HashMap(); public ChunkProviderSchematic(SchematicWorld world) { this.world = world; this.emptyChunk = new EmptyChunk(world, 0, 0); - // this.chunks = new ChunkSchematic[this.width][this.length]; } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java similarity index 86% rename from src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java rename to src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java index 87d5584f..a72f6526 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/ChunkSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.world.chunk; +package com.github.lunatrius.schematica.client.world.chunk; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; @@ -8,14 +8,10 @@ public class ChunkSchematic extends Chunk { private final World world; - private final int x; - private final int z; public ChunkSchematic(World world, int x, int z) { super(world, x, z); this.world = world; - this.x = x; - this.z = z; } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 951b6eb5..55eca1be 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -1,13 +1,13 @@ package com.github.lunatrius.schematica.command; import com.github.lunatrius.core.util.FileUtils; -import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.network.transfer.SchematicTransfer; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.util.FileFilterSchematic; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 0676f0c8..1c50631b 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -1,10 +1,10 @@ package com.github.lunatrius.schematica.command; import com.github.lunatrius.core.util.FileUtils; -import com.github.lunatrius.schematica.FileFilterSchematic; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.util.FileFilterSchematic; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 498274cb..27bf9709 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import net.minecraftforge.client.event.ClientChatReceivedEvent; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 1a595f19..94e0276e 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -1,14 +1,13 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.settings.KeyBinding; @@ -52,7 +51,7 @@ public void onKeyInput(InputEvent event) { } if (KEY_BINDING_LAYER_INC.isPressed()) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null && schematic.isRenderingLayer) { schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); @@ -60,7 +59,7 @@ public void onKeyInput(InputEvent event) { } if (KEY_BINDING_LAYER_DEC.isPressed()) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null && schematic.isRenderingLayer) { schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); @@ -75,7 +74,7 @@ private void handlePickBlock() { final KeyBinding keyPickBlock = this.minecraft.gameSettings.keyBindPickBlock; if (keyPickBlock.isPressed()) { try { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; boolean revert = true; if (schematic != null && schematic.isRendering) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index 5b261b0c..9f8f1f82 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -1,8 +1,8 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; -import com.github.lunatrius.schematica.world.SchematicWorld; +import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -13,7 +13,7 @@ public class OverlayHandler { @SubscribeEvent public void onText(RenderGameOverlayEvent.Text event) { if (this.minecraft.gameSettings.showDebugInfo) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null) { event.left.add(""); event.left.add("[§6Schematica§r] " + schematic.getDebugDimensions()); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 5a28d3ab..db06d070 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -1,10 +1,9 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.tooltip.TooltipHandler; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; @@ -21,7 +20,7 @@ private RenderTickHandler() {} @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent event) { - final SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + final SchematicWorld schematic = ClientProxy.schematic; ClientProxy.movingObjectPosition = schematic != null ? rayTrace(schematic, 1.0f) : null; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 32a56d64..5bf1ed6d 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -1,11 +1,11 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -38,7 +38,7 @@ public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEven public void onClientTick(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { this.minecraft.mcProfiler.startSection("schematica"); - SchematicWorld schematic = Schematica.proxy.getActiveSchematic(); + SchematicWorld schematic = ClientProxy.schematic; if (this.minecraft.thePlayer != null && schematic != null && schematic.isRendering) { this.minecraft.mcProfiler.startSection("printer"); SchematicPrinter printer = SchematicPrinter.INSTANCE; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java index 27b7ab79..aacb7324 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.network.message; -import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.Schematica; +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.reference.Reference; import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index cd74ffce..24a6f9a2 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -2,10 +2,11 @@ import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; -import com.github.lunatrius.schematica.SchematicPrinter; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.renderer.SchematicBlockRendererDispatcher; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.InputHandler; @@ -13,7 +14,6 @@ import com.github.lunatrius.schematica.handler.client.RenderTickHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; @@ -43,6 +43,8 @@ public class ClientProxy extends CommonProxy { public static EnumFacing orientation = null; public static int rotationRender = 0; + public static SchematicWorld schematic = null; + public static final MBlockPos pointA = new MBlockPos(); public static final MBlockPos pointB = new MBlockPos(); public static final MBlockPos pointMin = new MBlockPos(); @@ -56,8 +58,6 @@ public class ClientProxy extends CommonProxy { private static BlockRendererDispatcher dispatcherVanilla = null; private static BlockRendererDispatcher dispatcherSchematic = null; - private SchematicWorld schematicWorld = null; - public static void setPlayerData(EntityPlayer player, float partialTicks) { playerPosition.x = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; playerPosition.y = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; @@ -227,7 +227,7 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setEnabled(true); SchematicPrinter.INSTANCE.setSchematic(null); - setActiveSchematic(null); + schematic = null; if (MINECRAFT.theWorld != null) { MINECRAFT.theWorld.removeWorldAccess(RenderSchematic.INSTANCE); } @@ -252,7 +252,7 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam Reference.logger.debug("Loaded {} [w:{},h:{},l:{}]", filename, world.getWidth(), world.getHeight(), world.getLength()); - setActiveSchematic(world); + ClientProxy.schematic = world; MINECRAFT.theWorld.addWorldAccess(RenderSchematic.INSTANCE); SchematicPrinter.INSTANCE.setSchematic(world); world.isRendering = true; @@ -260,26 +260,6 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam return true; } - @Override - public void setActiveSchematic(SchematicWorld world) { - this.schematicWorld = world; - } - - @Override - public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { - setActiveSchematic(world); - } - - @Override - public SchematicWorld getActiveSchematic() { - return this.schematicWorld; - } - - @Override - public SchematicWorld getActiveSchematic(EntityPlayer player) { - return getActiveSchematic(); - } - @Override public boolean isPlayerQuotaExceeded(EntityPlayer player) { return false; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index d1ecb4d2..b6bbbd89 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -13,7 +13,6 @@ import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.network.PacketHandler; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import com.github.lunatrius.schematica.world.chunk.SchematicContainer; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; import com.github.lunatrius.schematica.world.storage.Schematic; @@ -176,14 +175,6 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam public abstract boolean loadSchematic(EntityPlayer player, File directory, String filename); - public abstract void setActiveSchematic(SchematicWorld world); - - public abstract void setActiveSchematic(SchematicWorld world, EntityPlayer player); - - public abstract SchematicWorld getActiveSchematic(); - - public abstract SchematicWorld getActiveSchematic(EntityPlayer player); - public abstract boolean isPlayerQuotaExceeded(EntityPlayer player); public abstract File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 6a6d44f7..6d246b35 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -4,7 +4,6 @@ import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.PlayerHandler; import com.github.lunatrius.schematica.reference.Reference; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -45,24 +44,6 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam return false; } - @Override - public void setActiveSchematic(SchematicWorld world) { - } - - @Override - public void setActiveSchematic(SchematicWorld world, EntityPlayer player) { - } - - @Override - public SchematicWorld getActiveSchematic() { - return null; - } - - @Override - public SchematicWorld getActiveSchematic(EntityPlayer player) { - return null; - } - @Override public boolean isPlayerQuotaExceeded(EntityPlayer player) { int spaceUsed = 0; diff --git a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java b/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java index a1888b7f..87bb0db5 100644 --- a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java @@ -1,8 +1,8 @@ package com.github.lunatrius.schematica.tooltip; import com.github.lunatrius.core.client.gui.FontRendererHelper; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.world.SchematicWorld; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java similarity index 90% rename from src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java rename to src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java index 9d644583..46ce105b 100644 --- a/src/main/java/com/github/lunatrius/schematica/FileFilterSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica; +package com.github.lunatrius.schematica.util; import java.io.File; import java.io.FileFilter; From ff34f79644260e92118c03b92e4c2c2c78ceac83 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 15 Mar 2015 15:12:49 +0100 Subject: [PATCH 209/314] Missed one class. --- .../schematica/{ => client}/tooltip/TooltipHandler.java | 2 +- .../lunatrius/schematica/handler/client/RenderTickHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/main/java/com/github/lunatrius/schematica/{ => client}/tooltip/TooltipHandler.java (99%) diff --git a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java b/src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java similarity index 99% rename from src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java rename to src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java index 87bb0db5..aac20dd2 100644 --- a/src/main/java/com/github/lunatrius/schematica/tooltip/TooltipHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.tooltip; +package com.github.lunatrius.schematica.client.tooltip; import com.github.lunatrius.core.client.gui.FontRendererHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index db06d070..355a9090 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -1,9 +1,9 @@ package com.github.lunatrius.schematica.handler.client; +import com.github.lunatrius.schematica.client.tooltip.TooltipHandler; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.tooltip.TooltipHandler; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; From db0c1b8868578411c7455993609236714545c987 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 19 Mar 2015 21:44:19 +0100 Subject: [PATCH 210/314] Fixed a NPE/race condition. --- .../java/com/github/lunatrius/schematica/proxy/ClientProxy.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 24a6f9a2..749e2155 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -253,6 +253,7 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam Reference.logger.debug("Loaded {} [w:{},h:{},l:{}]", filename, world.getWidth(), world.getHeight(), world.getLength()); ClientProxy.schematic = world; + RenderSchematic.INSTANCE.setWorldAndLoadRenderers(world); MINECRAFT.theWorld.addWorldAccess(RenderSchematic.INSTANCE); SchematicPrinter.INSTANCE.setSchematic(world); world.isRendering = true; From ae364902977910769853430f5dec33eca8466bf8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 24 Mar 2015 00:36:05 +0100 Subject: [PATCH 211/314] Added extra key bindings (unbound by default). Moved around the GUI classes. Organized the localization files. --- .../{ => control}/GuiSchematicControl.java | 39 ++++++------ .../{ => control}/GuiSchematicMaterials.java | 9 +-- .../GuiSchematicMaterialsSlot.java | 3 +- .../gui/{ => load}/GuiSchematicEntry.java | 2 +- .../gui/{ => load}/GuiSchematicLoad.java | 14 +++-- .../gui/{ => load}/GuiSchematicLoadSlot.java | 3 +- .../gui/{ => save}/GuiSchematicSave.java | 21 ++++--- .../client/printer/SchematicPrinter.java | 2 +- .../handler/client/InputHandler.java | 54 ++++++++++++++-- .../lunatrius/schematica/reference/Names.java | 51 +++++++++++++++ .../assets/schematica/lang/ca_ES.lang | 36 ++++++----- .../assets/schematica/lang/cs_CZ.lang | 38 +++++++----- .../assets/schematica/lang/da_DK.lang | 36 ++++++----- .../assets/schematica/lang/de_DE.lang | 39 +++++++----- .../assets/schematica/lang/en_GB.lang | 43 +++++++------ .../assets/schematica/lang/en_PT.lang | 38 +++++++----- .../assets/schematica/lang/en_US.lang | 62 +++++++++++-------- .../assets/schematica/lang/es_ES.lang | 38 +++++++----- .../assets/schematica/lang/es_MX.lang | 36 ++++++----- .../assets/schematica/lang/fi_FI.lang | 38 +++++++----- .../assets/schematica/lang/fr_FR.lang | 38 +++++++----- .../assets/schematica/lang/hu_HU.lang | 38 +++++++----- .../assets/schematica/lang/it_IT.lang | 36 ++++++----- .../assets/schematica/lang/ko_KR.lang | 43 +++++++------ .../assets/schematica/lang/la_LA.lang | 12 +++- .../assets/schematica/lang/lt_LT.lang | 36 ++++++----- .../assets/schematica/lang/nl_NL.lang | 36 ++++++----- .../assets/schematica/lang/no_NO.lang | 38 +++++++----- .../assets/schematica/lang/pl_PL.lang | 38 +++++++----- .../assets/schematica/lang/pt_PT.lang | 38 +++++++----- .../assets/schematica/lang/ru_RU.lang | 38 +++++++----- .../assets/schematica/lang/sk_SK.lang | 38 +++++++----- .../assets/schematica/lang/sl_SI.lang | 38 +++++++----- .../assets/schematica/lang/th_TH.lang | 38 +++++++----- .../assets/schematica/lang/tr_TR.lang | 38 +++++++----- .../assets/schematica/lang/uk_UA.lang | 38 +++++++----- .../assets/schematica/lang/zh_CN.lang | 38 +++++++----- 37 files changed, 745 insertions(+), 476 deletions(-) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => control}/GuiSchematicControl.java (86%) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => control}/GuiSchematicMaterials.java (86%) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => control}/GuiSchematicMaterialsSlot.java (94%) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => load}/GuiSchematicEntry.java (95%) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => load}/GuiSchematicLoad.java (91%) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => load}/GuiSchematicLoadSlot.java (94%) rename src/main/java/com/github/lunatrius/schematica/client/gui/{ => save}/GuiSchematicSave.java (92%) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java similarity index 86% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index db1aeb9e..622f19fb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.control; import com.github.lunatrius.core.client.gui.GuiNumericField; import com.github.lunatrius.core.client.gui.GuiScreenBase; @@ -8,6 +8,7 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; +import com.github.lunatrius.schematica.reference.Names; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -40,19 +41,19 @@ public class GuiSchematicControl extends GuiScreenBase { private GuiButton btnMaterials = null; private GuiButton btnPrint = null; - private final String strMoveSchematic = I18n.format("schematica.gui.moveschematic"); - private final String strOperations = I18n.format("schematica.gui.operations"); - private final String strAll = I18n.format("schematica.gui.all"); - private final String strLayers = I18n.format("schematica.gui.layers"); - private final String strX = I18n.format("schematica.gui.x"); - private final String strY = I18n.format("schematica.gui.y"); - private final String strZ = I18n.format("schematica.gui.z"); - private final String strMaterials = I18n.format("schematica.gui.materials"); - private final String strPrinter = I18n.format("schematica.gui.printer"); - private final String strHide = I18n.format("schematica.gui.hide"); - private final String strShow = I18n.format("schematica.gui.show"); - private final String strOn = I18n.format("schematica.gui.on"); - private final String strOff = I18n.format("schematica.gui.off"); + private final String strMoveSchematic = I18n.format(Names.Gui.Control.MOVE_SCHEMATIC); + private final String strOperations = I18n.format(Names.Gui.Control.OPERATIONS); + private final String strAll = I18n.format(Names.Gui.Control.MODE_ALL); + private final String strLayers = I18n.format(Names.Gui.Control.MODE_LAYERS); + private final String strMaterials = I18n.format(Names.Gui.Control.MATERIALS); + private final String strPrinter = I18n.format(Names.Gui.Control.PRINTER); + private final String strHide = I18n.format(Names.Gui.Control.HIDE); + private final String strShow = I18n.format(Names.Gui.Control.SHOW); + private final String strX = I18n.format(Names.Gui.X); + private final String strY = I18n.format(Names.Gui.Y); + private final String strZ = I18n.format(Names.Gui.Z); + private final String strOn = I18n.format(Names.Gui.ON); + private final String strOff = I18n.format(Names.Gui.OFF); public GuiSchematicControl(GuiScreen guiScreen) { super(guiScreen); @@ -87,16 +88,16 @@ public void initGui() { this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, this.schematic != null && this.schematic.isRendering ? this.strHide : this.strShow); this.buttonList.add(this.btnHide); - this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format("schematica.gui.movehere")); + this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format(Names.Gui.Control.MOVE_HERE)); this.buttonList.add(this.btnMove); - this.btnFlip = new GuiButton(id++, this.width - 90, this.height - 55, 80, 20, I18n.format("schematica.gui.flip")); + this.btnFlip = new GuiButton(id++, this.width - 90, this.height - 55, 80, 20, I18n.format(Names.Gui.Control.FLIP)); this.buttonList.add(this.btnFlip); - this.btnRotateDirection = new GuiButton(id++, this.width - 180, this.height - 30, 80, 20, I18n.format("schematica.gui." + ClientProxy.axisRotation.getName())); + this.btnRotateDirection = new GuiButton(id++, this.width - 180, this.height - 30, 80, 20, I18n.format(Names.Gui.Control.TRANSFORM_PREFIX + ClientProxy.axisRotation.getName())); this.buttonList.add(this.btnRotateDirection); - this.btnRotate = new GuiUnicodeGlyphButton(id++, this.width - 90, this.height - 30, 80, 20, " " + I18n.format("schematica.gui.rotate"), "\u21bb", 2.0f); + this.btnRotate = new GuiUnicodeGlyphButton(id++, this.width - 90, this.height - 30, 80, 20, " " + I18n.format(Names.Gui.Control.ROTATE), "\u21bb", 2.0f); this.buttonList.add(this.btnRotate); this.btnMaterials = new GuiButton(id++, 10, this.height - 70, 80, 20, this.strMaterials); @@ -183,7 +184,7 @@ protected void actionPerformed(GuiButton guiButton) { } else if (guiButton.id == this.btnRotateDirection.id) { final EnumFacing[] values = EnumFacing.values(); ClientProxy.axisRotation = values[((ClientProxy.axisRotation.ordinal() + 1) % values.length)]; - guiButton.displayString = I18n.format("schematica.gui." + ClientProxy.axisRotation.getName()); + guiButton.displayString = I18n.format(Names.Gui.Control.TRANSFORM_PREFIX + ClientProxy.axisRotation.getName()); } else if (guiButton.id == this.btnRotate.id) { if (RotationHelper.INSTANCE.rotate(this.schematic, ClientProxy.axisRotation, isShiftKeyDown())) { setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java similarity index 86% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index bc3d93d6..b511b4ca 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -1,9 +1,10 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.control; import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.schematica.client.util.BlockList; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Names; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -17,8 +18,8 @@ public class GuiSchematicMaterials extends GuiScreenBase { private GuiButton btnDone = null; - private final String strMaterialName = I18n.format("schematica.gui.materialname"); - private final String strMaterialAmount = I18n.format("schematica.gui.materialamount"); + private final String strMaterialName = I18n.format(Names.Gui.Control.MATERIAL_NAME); + private final String strMaterialAmount = I18n.format(Names.Gui.Control.MATERIAL_AMOUNT); protected final List blockList; @@ -32,7 +33,7 @@ public GuiSchematicMaterials(GuiScreen guiScreen) { public void initGui() { int id = 0; - this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 30, 150, 20, I18n.format("schematica.gui.done")); + this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 30, 150, 20, I18n.format(Names.Gui.DONE)); this.buttonList.add(this.btnDone); this.guiSchematicMaterialsSlot = new GuiSchematicMaterialsSlot(this); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java similarity index 94% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java index 62e1e42e..4d7ed004 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java @@ -1,5 +1,6 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.control; +import com.github.lunatrius.schematica.client.gui.GuiHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.GlStateManager; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java similarity index 95% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java index 1414ad19..7df8d896 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicEntry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.load; import net.minecraft.block.Block; import net.minecraft.item.Item; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java similarity index 91% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java index f4755d09..ae2de327 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java @@ -1,10 +1,11 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.load; import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.util.FileFilterSchematic; import com.github.lunatrius.schematica.world.schematic.SchematicUtil; @@ -31,8 +32,9 @@ public class GuiSchematicLoad extends GuiScreenBase { private GuiButton btnOpenDir = null; private GuiButton btnDone = null; - private final String strTitle = I18n.format("schematica.gui.title"); - private final String strFolderInfo = I18n.format("schematica.gui.folderInfo"); + private final String strTitle = I18n.format(Names.Gui.Load.TITLE); + private final String strFolderInfo = I18n.format(Names.Gui.Load.FOLDER_INFO); + private String strNoSchematic = I18n.format(Names.Gui.Load.NO_SCHEMATIC); protected File currentDirectory = ConfigurationHandler.schematicDirectory; protected final List schematicFiles = new ArrayList(); @@ -45,10 +47,10 @@ public GuiSchematicLoad(GuiScreen guiScreen) { public void initGui() { int id = 0; - this.btnOpenDir = new GuiButton(id++, this.width / 2 - 154, this.height - 36, 150, 20, I18n.format("schematica.gui.openFolder")); + this.btnOpenDir = new GuiButton(id++, this.width / 2 - 154, this.height - 36, 150, 20, I18n.format(Names.Gui.Load.OPEN_FOLDER)); this.buttonList.add(this.btnOpenDir); - this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 36, 150, 20, I18n.format("schematica.gui.done")); + this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 36, 150, 20, I18n.format(Names.Gui.DONE)); this.buttonList.add(this.btnDone); this.guiSchematicLoadSlot = new GuiSchematicLoadSlot(this); @@ -146,7 +148,7 @@ protected void reloadSchematics() { File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); if (filesSchematics == null || filesSchematics.length == 0) { - this.schematicFiles.add(new GuiSchematicEntry(I18n.format("schematica.gui.noschematic"), Blocks.dirt, 0, false)); + this.schematicFiles.add(new GuiSchematicEntry(strNoSchematic, Blocks.dirt, 0, false)); } else { for (File file : filesSchematics) { name = file.getName(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java similarity index 94% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java index 9f71be33..0966d3bb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java @@ -1,5 +1,6 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.load; +import com.github.lunatrius.schematica.client.gui.GuiHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java similarity index 92% rename from src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java rename to src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index 1bb1856e..441adfee 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.client.gui; +package com.github.lunatrius.schematica.client.gui.save; import com.github.lunatrius.core.client.gui.GuiNumericField; import com.github.lunatrius.core.client.gui.GuiScreenBase; @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; +import com.github.lunatrius.schematica.reference.Names; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; @@ -36,12 +37,12 @@ public class GuiSchematicSave extends GuiScreenBase { private String filename = ""; - private final String strSaveSelection = I18n.format("schematica.gui.saveselection"); - private final String strX = I18n.format("schematica.gui.x"); - private final String strY = I18n.format("schematica.gui.y"); - private final String strZ = I18n.format("schematica.gui.z"); - private final String strOn = I18n.format("schematica.gui.on"); - private final String strOff = I18n.format("schematica.gui.off"); + private final String strSaveSelection = I18n.format(Names.Gui.Save.SAVE_SELECTION); + private final String strX = I18n.format(Names.Gui.X); + private final String strY = I18n.format(Names.Gui.Y); + private final String strZ = I18n.format(Names.Gui.Z); + private final String strOn = I18n.format(Names.Gui.ON); + private final String strOff = I18n.format(Names.Gui.OFF); public GuiSchematicSave(GuiScreen guiScreen) { super(guiScreen); @@ -56,7 +57,7 @@ public void initGui() { int id = 0; - this.btnPointA = new GuiButton(id++, this.centerX - 130, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.red")); + this.btnPointA = new GuiButton(id++, this.centerX - 130, this.centerY - 55, 100, 20, I18n.format(Names.Gui.Save.POINT_RED)); this.buttonList.add(this.btnPointA); this.numericAX = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY - 30); @@ -68,7 +69,7 @@ public void initGui() { this.numericAZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY + 20); this.buttonList.add(this.numericAZ); - this.btnPointB = new GuiButton(id++, this.centerX + 30, this.centerY - 55, 100, 20, I18n.format("schematica.gui.point.blue")); + this.btnPointB = new GuiButton(id++, this.centerX + 30, this.centerY - 55, 100, 20, I18n.format(Names.Gui.Save.POINT_BLUE)); this.buttonList.add(this.btnPointB); this.numericBX = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY - 30); @@ -86,7 +87,7 @@ public void initGui() { this.tfFilename = new GuiTextField(id++, this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); this.textFields.add(this.tfFilename); - this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format("schematica.gui.save")); + this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format(Names.Gui.Save.SAVE)); this.btnSave.enabled = ClientProxy.isRenderingGuide; this.buttonList.add(this.btnSave); diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index d53a73ef..fc3c162c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -69,7 +69,7 @@ public void setEnabled(boolean isEnabled) { } public boolean togglePrinting() { - this.isPrinting = !this.isPrinting; + this.isPrinting = !this.isPrinting && this.schematic != null; return this.isPrinting; } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 94e0276e..f941b72c 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -1,8 +1,9 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.client.gui.GuiSchematicControl; -import com.github.lunatrius.schematica.client.gui.GuiSchematicLoad; -import com.github.lunatrius.schematica.client.gui.GuiSchematicSave; +import com.github.lunatrius.schematica.client.gui.control.GuiSchematicControl; +import com.github.lunatrius.schematica.client.gui.load.GuiSchematicLoad; +import com.github.lunatrius.schematica.client.gui.save.GuiSchematicSave; +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; @@ -10,7 +11,9 @@ import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.resources.I18n; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.common.ForgeHooks; @@ -26,9 +29,21 @@ public class InputHandler { private static final KeyBinding KEY_BINDING_CONTROL = new KeyBinding(Names.Keys.CONTROL, Keyboard.KEY_SUBTRACT, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_LAYER_INC = new KeyBinding(Names.Keys.LAYER_INC, Keyboard.KEY_NONE, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_LAYER_DEC = new KeyBinding(Names.Keys.LAYER_DEC, Keyboard.KEY_NONE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_LAYER_TOGGLE = new KeyBinding(Names.Keys.LAYER_TOGGLE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_RENDER_TOGGLE = new KeyBinding(Names.Keys.RENDER_TOGGLE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_PRINTER_TOGGLE = new KeyBinding(Names.Keys.PRINTER_TOGGLE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_MOVE_HERE = new KeyBinding(Names.Keys.MOVE_HERE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { - KEY_BINDING_LOAD, KEY_BINDING_SAVE, KEY_BINDING_CONTROL, KEY_BINDING_LAYER_INC, KEY_BINDING_LAYER_DEC + KEY_BINDING_LOAD, + KEY_BINDING_SAVE, + KEY_BINDING_CONTROL, + KEY_BINDING_LAYER_INC, + KEY_BINDING_LAYER_DEC, + KEY_BINDING_LAYER_TOGGLE, + KEY_BINDING_RENDER_TOGGLE, + KEY_BINDING_PRINTER_TOGGLE, + KEY_BINDING_MOVE_HERE }; private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -66,6 +81,37 @@ public void onKeyInput(InputEvent event) { } } + if (KEY_BINDING_LAYER_TOGGLE.isPressed()) { + final SchematicWorld schematic = ClientProxy.schematic; + if (schematic != null) { + schematic.isRenderingLayer = !schematic.isRenderingLayer; + RenderSchematic.INSTANCE.refresh(); + } + } + + if (KEY_BINDING_RENDER_TOGGLE.isPressed()) { + final SchematicWorld schematic = ClientProxy.schematic; + if (schematic != null) { + schematic.isRendering = !schematic.isRendering; + RenderSchematic.INSTANCE.refresh(); + } + } + + if (KEY_BINDING_PRINTER_TOGGLE.isPressed()) { + if (ClientProxy.schematic != null) { + final boolean printing = SchematicPrinter.INSTANCE.togglePrinting(); + this.minecraft.thePlayer.addChatComponentMessage(new ChatComponentTranslation(Names.Messages.TOGGLE_PRINTER, I18n.format(printing ? Names.Gui.ON : Names.Gui.OFF))); + } + } + + if (KEY_BINDING_MOVE_HERE.isPressed()) { + final SchematicWorld schematic = ClientProxy.schematic; + if (schematic != null) { + ClientProxy.moveSchematicToPlayer(schematic); + RenderSchematic.INSTANCE.refresh(); + } + } + handlePickBlock(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 79cd736e..ed916857 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -124,6 +124,53 @@ public static final class Message { } } + public static final class Messages { + public static final String TOGGLE_PRINTER = "schematica.message.togglePrinter"; + } + + public static final class Gui { + public static final class Load { + public static final String TITLE = "schematica.gui.title"; + public static final String FOLDER_INFO = "schematica.gui.folderInfo"; + public static final String OPEN_FOLDER = "schematica.gui.openFolder"; + public static final String NO_SCHEMATIC = "schematica.gui.noschematic"; + } + + public static final class Save { + public static final String POINT_RED = "schematica.gui.point.red"; + public static final String POINT_BLUE = "schematica.gui.point.blue"; + public static final String SAVE = "schematica.gui.save"; + public static final String SAVE_SELECTION = "schematica.gui.saveselection"; + } + + public static final class Control { + public static final String MOVE_SCHEMATIC = "schematica.gui.moveschematic"; + public static final String MATERIALS = "schematica.gui.materials"; + public static final String PRINTER = "schematica.gui.printer"; + public static final String OPERATIONS = "schematica.gui.operations"; + + public static final String MODE_ALL = "schematica.gui.all"; + public static final String MODE_LAYERS = "schematica.gui.layers"; + public static final String HIDE = "schematica.gui.hide"; + public static final String SHOW = "schematica.gui.show"; + public static final String MOVE_HERE = "schematica.gui.movehere"; + public static final String FLIP = "schematica.gui.flip"; + public static final String ROTATE = "schematica.gui.rotate"; + public static final String TRANSFORM_PREFIX = "schematica.gui."; + + public static final String MATERIAL_NAME = "schematica.gui.materialname"; + public static final String MATERIAL_AMOUNT = "schematica.gui.materialamount"; + } + + public static final String X = "schematica.gui.x"; + public static final String Y = "schematica.gui.y"; + public static final String Z = "schematica.gui.z"; + public static final String ON = "schematica.gui.on"; + public static final String OFF = "schematica.gui.off"; + public static final String DONE = "schematica.gui.done"; + + } + public static final class ModId { public static final String MINECRAFT = "minecraft"; } @@ -135,6 +182,10 @@ public static final class Keys { public static final String CONTROL = "schematica.key.control"; public static final String LAYER_INC = "schematica.key.layerInc"; public static final String LAYER_DEC = "schematica.key.layerDec"; + public static final String LAYER_TOGGLE = "schematica.key.layerToggle"; + public static final String RENDER_TOGGLE = "schematica.key.renderToggle"; + public static final String PRINTER_TOGGLE = "schematica.key.printerToggle"; + public static final String MOVE_HERE = "schematica.key.moveHere"; } public static final class NBT { diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index d22af414..6e3e475f 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -1,29 +1,33 @@ # gui - general -schematica.gui.openFolder=Obrir carpeta d'esquemes +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Fet + +# gui - general - load schematica.gui.title=Seleccionar arxiu d'esquemes schematica.gui.folderInfo=(Posar l'arxiu d'esquemes aquí) +schematica.gui.openFolder=Obrir carpeta d'esquemes schematica.gui.noschematic=-- Sense esquemes -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Ocultar + +# gui - general - save +schematica.gui.point.red=Punt Vermell +schematica.gui.point.blue=Punt Blau +schematica.gui.save=Guardar +schematica.gui.saveselection=Guardar la selecció com un esquema + +# gui - general - control +schematica.gui.moveschematic=Moure esquema +schematica.gui.printer=Imprimir +schematica.gui.operations=Operacions schematica.gui.all=Tots +schematica.gui.layers=Capes +schematica.gui.hide=Ocultar schematica.gui.show=Mostrar schematica.gui.movehere=Moure aquí schematica.gui.flip=Voltejar schematica.gui.rotate=Gurar -schematica.gui.save=Guardar -schematica.gui.moveschematic=Moure esquema -schematica.gui.layers=Capes -schematica.gui.operations=Operacions -schematica.gui.point.red=Punt Vermell -schematica.gui.point.blue=Punt Blau -schematica.gui.saveselection=Guardar la selecció com un esquema -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: schematica.gui.materialamount=Quantitat -schematica.gui.printer=Imprimir # gui - config - categories @@ -53,3 +57,5 @@ schematica.key.control=Manipular esquema # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 9af27617..091076a4 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Otevřít složku se schématy +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Hotovo + +# gui - general - load schematica.gui.title=Vyberte soubor schématu schematica.gui.folderInfo=(Sem dávejte soubory schémat) +schematica.gui.openFolder=Otevřít složku se schématy schematica.gui.noschematic=-- Žádné schéma -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Schovat + +# gui - general - save +schematica.gui.point.red=Rudý bod +schematica.gui.point.blue=Modrý bod +schematica.gui.save=Uložit +schematica.gui.saveselection=Uložit výběr jako schéma + +# gui - general - control +schematica.gui.moveschematic=Přesunout schéma +schematica.gui.materials=Materiály +schematica.gui.printer=Tiskárna +schematica.gui.operations=Operace schematica.gui.all=VŠECHNY +schematica.gui.layers=Vrstvy +schematica.gui.hide=Schovat schematica.gui.show=Zobrazit schematica.gui.movehere=Přesunout sem schematica.gui.flip=Převrátit schematica.gui.rotate=Otočit -schematica.gui.save=Uložit -schematica.gui.moveschematic=Přesunout schéma -schematica.gui.layers=Vrstvy -schematica.gui.operations=Operace -schematica.gui.point.red=Rudý bod -schematica.gui.point.blue=Modrý bod -schematica.gui.saveselection=Uložit výběr jako schéma -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiály schematica.gui.materialname=Materiál schematica.gui.materialamount=Množství -schematica.gui.printer=Tiskárna # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Manipulovat se schématem # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 952f0a15..c54d04fe 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -1,28 +1,32 @@ # gui - general -schematica.gui.openFolder=Åbn schematics mappe +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Færdig + +# gui - general - load schematica.gui.title=Vælg schematic-fil schematica.gui.folderInfo=(Placér schematic-filer her) +schematica.gui.openFolder=Åbn schematics mappe schematica.gui.noschematic=-- Ingen schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Skjul + +# gui - general - save +schematica.gui.point.red=Rødt punkt +schematica.gui.point.blue=Blåt punkt +schematica.gui.save=Gem +schematica.gui.saveselection=Gem markeringen som en schematic + +# gui - general - control +schematica.gui.moveschematic=Flyt schematic +schematica.gui.materials=Materialer +schematica.gui.operations=Operationer schematica.gui.all=ALLE +schematica.gui.layers=Lag +schematica.gui.hide=Skjul schematica.gui.show=Vis schematica.gui.movehere=Flyt hertil schematica.gui.flip=Vend schematica.gui.rotate=Rotér -schematica.gui.save=Gem -schematica.gui.moveschematic=Flyt schematic -schematica.gui.layers=Lag -schematica.gui.operations=Operationer -schematica.gui.point.red=Rødt punkt -schematica.gui.point.blue=Blåt punkt -schematica.gui.saveselection=Gem markeringen som en schematic -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materialer schematica.gui.materialname=Materiale schematica.gui.materialamount=Antal @@ -54,3 +58,5 @@ schematica.key.control=Manipulér schematic # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index ca08eb4e..41cb0a39 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -1,32 +1,35 @@ # gui - general -schematica.gui.openFolder=Öffne Schematic-Ordner +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Fertig + +# gui - general - load schematica.gui.title=Wähle Schematic-Datei schematica.gui.folderInfo=(Füge Schematic-Dateien hier ein) +schematica.gui.openFolder=Öffne Schematic-Ordner schematica.gui.noschematic=-- Keine Schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Verstecken + +# gui - general - save +schematica.gui.point.red=Roter Punkt +schematica.gui.point.blue=Blauer Punkt +schematica.gui.save=Speichern +schematica.gui.saveselection=Auswahl als Schematic speichern + +# gui - general - control +schematica.gui.moveschematic=Schematic bewegen +schematica.gui.materials=Materialien +schematica.gui.printer=Drucker +schematica.gui.operations=Aktionen schematica.gui.all=ALLE +schematica.gui.layers=Ebenen +schematica.gui.hide=Verstecken schematica.gui.show=Zeigen schematica.gui.movehere=Hierhin bewegen schematica.gui.flip=Spiegeln schematica.gui.rotate=Drehen -schematica.gui.save=Speichern -schematica.gui.moveschematic=Schematic bewegen -schematica.gui.layers=Ebenen -schematica.gui.operations=Aktionen -schematica.gui.point.red=Roter Punkt -schematica.gui.point.blue=Blauer Punkt -schematica.gui.saveselection=Auswahl als Schematic speichern -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materialien schematica.gui.materialname=Material schematica.gui.materialamount=Menge -schematica.gui.printer=Drucker -schematica.gui.unknownblock=Unbekannter Block # gui - config - categories schematica.config.category.render.tooltip=Render Einstellungen @@ -97,3 +100,5 @@ schematica.command.list.noSchematics=Es sind keine Schematics verfügbar. # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index 27b2f917..e39d40f5 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -1,34 +1,37 @@ # gui - general -schematica.gui.openFolder=Open schematic folder +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: +schematica.gui.on=ON +schematica.gui.off=OFF schematica.gui.done=Done + +# gui - general - load schematica.gui.title=Select schematic file schematica.gui.folderInfo=(Place schematic files here) +schematica.gui.openFolder=Open schematic folder schematica.gui.noschematic=-- No schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Hide + +# gui - general - save +schematica.gui.point.red=Red point +schematica.gui.point.blue=Blue point +schematica.gui.save=Save +schematica.gui.saveselection=Save the selection as a schematic + +# gui - general - control +schematica.gui.moveschematic=Move schematic +schematica.gui.materials=Materials +schematica.gui.printer=Printer +schematica.gui.operations=Operations schematica.gui.all=ALL +schematica.gui.layers=Layers +schematica.gui.hide=Hide schematica.gui.show=Show schematica.gui.movehere=Move here schematica.gui.flip=Flip schematica.gui.rotate=Rotate -schematica.gui.save=Save -schematica.gui.moveschematic=Move schematic -schematica.gui.layers=Layers -schematica.gui.operations=Operations -schematica.gui.point.red=Red point -schematica.gui.point.blue=Blue point -schematica.gui.saveselection=Save the selection as a schematic -schematica.gui.on=ON -schematica.gui.off=OFF -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materials schematica.gui.materialname=Material schematica.gui.materialamount=Amount -schematica.gui.printer=Printer -schematica.gui.unknownblock=Unknown Block # gui - config - categories schematica.config.category.render=Rendering @@ -97,3 +100,5 @@ schematica.key.control=Manipulate schematic # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index f80dfc66..ac2e876d 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Open ye Blueprints +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Plundered + +# gui - general - load schematica.gui.title=Select ye Blueprint schematica.gui.folderInfo=Place ye blueprints here +schematica.gui.openFolder=Open ye Blueprints schematica.gui.noschematic=No Blueprints here mate -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Make Tiny + +# gui - general - save +schematica.gui.point.red=Red dot +schematica.gui.point.blue=Blue dot +schematica.gui.save=Keep it safe +schematica.gui.saveselection=Save it as a blueprint + +# gui - general - control +schematica.gui.moveschematic=Move yer blueprint +schematica.gui.materials=Stuff +schematica.gui.printer=Printing thing +schematica.gui.operations=Plans schematica.gui.all=ALL +schematica.gui.layers=Layers +schematica.gui.hide=Make Tiny schematica.gui.show=Make it large schematica.gui.movehere=Bring the loot 'ere schematica.gui.flip=Flip schematica.gui.rotate=Fling it round -schematica.gui.save=Keep it safe -schematica.gui.moveschematic=Move yer blueprint -schematica.gui.layers=Layers -schematica.gui.operations=Plans -schematica.gui.point.red=Red dot -schematica.gui.point.blue=Blue dot -schematica.gui.saveselection=Save it as a blueprint -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Stuff schematica.gui.materialname=Stuff schematica.gui.materialamount=Number -schematica.gui.printer=Printing thing # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Change yer blueprint # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 400876ef..a19dff3d 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -1,40 +1,43 @@ # gui - general -schematica.gui.openFolder=Open schematic folder +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: +schematica.gui.on=ON +schematica.gui.off=OFF schematica.gui.done=Done +schematica.gui.down=Down +schematica.gui.up=Up +schematica.gui.north=North +schematica.gui.south=South +schematica.gui.west=West +schematica.gui.east=East + +# gui - general - load schematica.gui.title=Select schematic file schematica.gui.folderInfo=(Place schematic files here) +schematica.gui.openFolder=Open schematic folder schematica.gui.noschematic=-- No schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Hide + +# gui - general - save +schematica.gui.point.red=Red point +schematica.gui.point.blue=Blue point +schematica.gui.save=Save +schematica.gui.saveselection=Save the selection as a schematic + +# gui - general - control +schematica.gui.moveschematic=Move schematic +schematica.gui.materials=Materials +schematica.gui.printer=Printer +schematica.gui.operations=Operations schematica.gui.all=ALL +schematica.gui.layers=Layers +schematica.gui.hide=Hide schematica.gui.show=Show schematica.gui.movehere=Move here schematica.gui.flip=Flip schematica.gui.rotate=Rotate -schematica.gui.save=Save -schematica.gui.moveschematic=Move schematic -schematica.gui.layers=Layers -schematica.gui.operations=Operations -schematica.gui.point.red=Red point -schematica.gui.point.blue=Blue point -schematica.gui.saveselection=Save the selection as a schematic -schematica.gui.on=ON -schematica.gui.off=OFF -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materials schematica.gui.materialname=Material schematica.gui.materialamount=Amount -schematica.gui.printer=Printer -schematica.gui.unknownblock=Unknown Block -schematica.gui.down=Down -schematica.gui.up=Up -schematica.gui.north=North -schematica.gui.south=South -schematica.gui.west=West -schematica.gui.east=East # gui - config - categories schematica.config.category.debug=Debug @@ -132,7 +135,11 @@ schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic schematica.key.layerInc=Next Layer -schematica.key.layerDec=Previous layer +schematica.key.layerDec=Previous Layer +schematica.key.layerToggle=Toggle All/Layer Mode +schematica.key.renderToggle=Toggle Rendering +schematica.key.printerToggle=Toggle Printer +schematica.key.moveHere=Move here # commands - save schematica.command.save.usage=/schematicaSave @@ -163,3 +170,6 @@ schematica.command.download.usage=/schematicaDownload schematica.command.download.started=Started downloading %s... schematica.command.download.downloadSucceeded=Successfully downloaded %s. schematica.command.download.downloadFail=Download failed. + +# messages +schematica.message.togglePrinter=Printer: %s diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index aeca395c..aa87d701 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -1,30 +1,34 @@ # gui - general -schematica.gui.openFolder=Abrir carpeta de esquemas +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Hecho + +# gui - general - load schematica.gui.title=Seleccionar archivo de esquema schematica.gui.folderInfo=Pon aquí los esquemas +schematica.gui.openFolder=Abrir carpeta de esquemas schematica.gui.noschematic=-- No hay esquemas -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Esconder + +# gui - general - save +schematica.gui.point.red=Punto rojo +schematica.gui.point.blue=Punto Azul +schematica.gui.save=Guardar +schematica.gui.saveselection=Guardar selección como esquema + +# gui - general - control +schematica.gui.moveschematic=Mover esquema +schematica.gui.materials=Materiales +schematica.gui.printer=Impresora +schematica.gui.operations=Acciones schematica.gui.all=Todas +schematica.gui.layers=Capas +schematica.gui.hide=Esconder schematica.gui.show=Mostrar schematica.gui.movehere=Mover aquí schematica.gui.flip=Voltear schematica.gui.rotate=Girar -schematica.gui.save=Guardar -schematica.gui.moveschematic=Mover esquema -schematica.gui.layers=Capas -schematica.gui.operations=Acciones -schematica.gui.point.red=Punto rojo -schematica.gui.point.blue=Punto Azul -schematica.gui.saveselection=Guardar selección como esquema -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiales schematica.gui.materialamount=Cantidad -schematica.gui.printer=Impresora # gui - config - categories @@ -54,3 +58,5 @@ schematica.key.control=Editar esquema # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 7dd400f2..cb8bf11d 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -1,28 +1,32 @@ # gui - general -schematica.gui.openFolder=Abrir carpeta de esquemas +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Listo + +# gui - general - load schematica.gui.title=Seleccionar archivo de esquema schematica.gui.folderInfo=(Colocar archivos de esquema aquí) +schematica.gui.openFolder=Abrir carpeta de esquemas schematica.gui.noschematic=-- Sin esquema -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Ocultar + +# gui - general - save +schematica.gui.point.red=Punto rojo +schematica.gui.point.blue=Punto azul +schematica.gui.save=Guardar +schematica.gui.saveselection=Guardar lo seleccionado como un esquema + +# gui - general - control +schematica.gui.moveschematic=Mover esquema +schematica.gui.materials=Materiales +schematica.gui.operations=Operaciones schematica.gui.all=TODO +schematica.gui.layers=Capas +schematica.gui.hide=Ocultar schematica.gui.show=Mostrar schematica.gui.movehere=Mover aquí schematica.gui.flip=Voltear schematica.gui.rotate=Girar -schematica.gui.save=Guardar -schematica.gui.moveschematic=Mover esquema -schematica.gui.layers=Capas -schematica.gui.operations=Operaciones -schematica.gui.point.red=Punto rojo -schematica.gui.point.blue=Punto azul -schematica.gui.saveselection=Guardar lo seleccionado como un esquema -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiales schematica.gui.materialamount=Cantidad # gui - config - categories @@ -53,3 +57,5 @@ schematica.key.control=Manipular esquema # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 0f1c6976..d1ff8257 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Avaa kaavion sijainti +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Valmis + +# gui - general - load schematica.gui.title=Valitse kaavio tiedosto schematica.gui.folderInfo=(Sijoita kaavio tiedostot tänne) +schematica.gui.openFolder=Avaa kaavion sijainti schematica.gui.noschematic=-- Ei kaaviota -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Piilota + +# gui - general - save +schematica.gui.point.red=Punainen piste +schematica.gui.point.blue=Sininen piste +schematica.gui.save=Tallenna +schematica.gui.saveselection=Tallenna valinta kaavana + +# gui - general - control +schematica.gui.moveschematic=Siirrä kaaviota +schematica.gui.materials=Materiaalit +schematica.gui.printer=Tulostin +schematica.gui.operations=Toiminnot schematica.gui.all=KAIKKI +schematica.gui.layers=Kerrokset +schematica.gui.hide=Piilota schematica.gui.show=Näytä schematica.gui.movehere=Siirrä tänne schematica.gui.flip=Käännä schematica.gui.rotate=Pyöritä -schematica.gui.save=Tallenna -schematica.gui.moveschematic=Siirrä kaaviota -schematica.gui.layers=Kerrokset -schematica.gui.operations=Toiminnot -schematica.gui.point.red=Punainen piste -schematica.gui.point.blue=Sininen piste -schematica.gui.saveselection=Tallenna valinta kaavana -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiaalit schematica.gui.materialname=Materiaali schematica.gui.materialamount=Määrä -schematica.gui.printer=Tulostin # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Käsittele kaavaa # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 1f853dd7..81d5c579 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Ouvrir le dossier schematic +schematica.gui.x=X : +schematica.gui.y=Y : +schematica.gui.z=Z : schematica.gui.done=Terminé + +# gui - general - load schematica.gui.title=Sélectionner un schematic schematica.gui.folderInfo=(Placez vos schematics ici) +schematica.gui.openFolder=Ouvrir le dossier schematic schematica.gui.noschematic=-- Aucun schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Cacher + +# gui - general - save +schematica.gui.point.red=Point rouge +schematica.gui.point.blue=Point bleu +schematica.gui.save=Enregistrer +schematica.gui.saveselection=Sauvegarder la sélection en tant que schematic + +# gui - general - control +schematica.gui.moveschematic=Déplacer le schematic +schematica.gui.materials=Matériaux +schematica.gui.printer=Mode imprimante +schematica.gui.operations=Opérations schematica.gui.all=TOUTES +schematica.gui.layers=Couches +schematica.gui.hide=Cacher schematica.gui.show=Montrer schematica.gui.movehere=Déplacer ici schematica.gui.flip=Retourner schematica.gui.rotate=Pivoter -schematica.gui.save=Enregistrer -schematica.gui.moveschematic=Déplacer le schematic -schematica.gui.layers=Couches -schematica.gui.operations=Opérations -schematica.gui.point.red=Point rouge -schematica.gui.point.blue=Point bleu -schematica.gui.saveselection=Sauvegarder la sélection en tant que schematic -schematica.gui.x=X : -schematica.gui.y=Y : -schematica.gui.z=Z : -schematica.gui.materials=Matériaux schematica.gui.materialname=Matériau schematica.gui.materialamount=Quantité -schematica.gui.printer=Mode imprimante # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Manipuler le schematic # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index a6818c6d..b93ec685 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Klisé könyvtár megnyitása +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Kész + +# gui - general - load schematica.gui.title=Klisé megnyitása schematica.gui.folderInfo=(Helyezd ide a klisé fájlokat) +schematica.gui.openFolder=Klisé könyvtár megnyitása schematica.gui.noschematic=-- Nem található klisé -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Elrejt + +# gui - general - save +schematica.gui.point.red=Piros pont +schematica.gui.point.blue=Kék pont +schematica.gui.save=Mentés +schematica.gui.saveselection=Kijelölés mentése kliséként + +# gui - general - control +schematica.gui.moveschematic=Klisé mozgatása +schematica.gui.materials=Anyagfelhasználás +schematica.gui.printer=Nyomtató +schematica.gui.operations=Műveletek schematica.gui.all=MIND +schematica.gui.layers=Szeletek +schematica.gui.hide=Elrejt schematica.gui.show=Mutat schematica.gui.movehere=Mozgatás ide schematica.gui.flip=Tükröz schematica.gui.rotate=Forgat -schematica.gui.save=Mentés -schematica.gui.moveschematic=Klisé mozgatása -schematica.gui.layers=Szeletek -schematica.gui.operations=Műveletek -schematica.gui.point.red=Piros pont -schematica.gui.point.blue=Kék pont -schematica.gui.saveselection=Kijelölés mentése kliséként -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Anyagfelhasználás schematica.gui.materialname=Anyag schematica.gui.materialamount=Mennyiség -schematica.gui.printer=Nyomtató # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Klisé módosítása # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index f91728c0..588953c2 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -1,28 +1,32 @@ # gui - general -schematica.gui.openFolder=Apri cartella schematiche +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Fatto + +# gui - general - load schematica.gui.title=Seleziona file schematico schematica.gui.folderInfo=(Posiziona qui i file schematici) +schematica.gui.openFolder=Apri cartella schematiche schematica.gui.noschematic=-- Nessuna Schematica -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Nascondi + +# gui - general - save +schematica.gui.point.red=Punto rosso +schematica.gui.point.blue=Punto blu +schematica.gui.save=Salva +schematica.gui.saveselection=Salva la selezione come schematica + +# gui - general - control +schematica.gui.moveschematic=Movi schematica +schematica.gui.materials=Materiali +schematica.gui.operations=Operazioni schematica.gui.all=TUTTI +schematica.gui.layers=Livelli +schematica.gui.hide=Nascondi schematica.gui.show=Visualizza schematica.gui.movehere=Posiziona qui schematica.gui.flip=Specchia schematica.gui.rotate=Ruota -schematica.gui.save=Salva -schematica.gui.moveschematic=Movi schematica -schematica.gui.layers=Livelli -schematica.gui.operations=Operazioni -schematica.gui.point.red=Punto rosso -schematica.gui.point.blue=Punto blu -schematica.gui.saveselection=Salva la selezione come schematica -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiali schematica.gui.materialname=Materiale schematica.gui.materialamount=Quantità @@ -54,3 +58,5 @@ schematica.key.control=Manipola schematica # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index d1132c8a..2b410d33 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -1,34 +1,37 @@ # gui - general -schematica.gui.openFolder=Schematic 폴더 열기 +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: +schematica.gui.on=켜기 +schematica.gui.off=끄기 schematica.gui.done=완료 + +# gui - general - load schematica.gui.title=Schematic 파일 선택 schematica.gui.folderInfo=(여기에 schematic 파일을 놓으세요) +schematica.gui.openFolder=Schematic 폴더 열기 schematica.gui.noschematic=-- Schematic 없음 -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=숨기기 + +# gui - general - save +schematica.gui.point.red=빨간 점 +schematica.gui.point.blue=푸른 점 +schematica.gui.save=저장 +schematica.gui.saveselection=선택 영역을 schematic으로 저장 + +# gui - general - control +schematica.gui.moveschematic=Schematic 이동 +schematica.gui.materials=재료 +schematica.gui.printer=프린터 +schematica.gui.operations=동작 schematica.gui.all=모두 +schematica.gui.layers=레이어 +schematica.gui.hide=숨기기 schematica.gui.show=표시 schematica.gui.movehere=여기에 옮기기 schematica.gui.flip=뒤집기 schematica.gui.rotate=회전 -schematica.gui.save=저장 -schematica.gui.moveschematic=Schematic 이동 -schematica.gui.layers=레이어 -schematica.gui.operations=동작 -schematica.gui.point.red=빨간 점 -schematica.gui.point.blue=푸른 점 -schematica.gui.saveselection=선택 영역을 schematic으로 저장 -schematica.gui.on=켜기 -schematica.gui.off=끄기 -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=재료 schematica.gui.materialname=재료 schematica.gui.materialamount=양 -schematica.gui.printer=프린터 -schematica.gui.unknownblock=알 수 없는 블럭 # gui - config - categories schematica.config.category.render=렌더링 @@ -109,3 +112,5 @@ schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제 # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index 19b2b8b9..f4879288 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -1,9 +1,15 @@ # gui - general schematica.gui.done=Perfectus -schematica.gui.all=OMNES -schematica.gui.show=Ostende + +# gui - general - load + +# gui - general - save schematica.gui.point.red=Rubra res schematica.gui.point.blue=Caerulea res + +# gui - general - control +schematica.gui.all=OMNES +schematica.gui.show=Ostende schematica.gui.materialamount=Numerus # gui - config - categories @@ -31,3 +37,5 @@ schematica.gui.materialamount=Numerus # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index ba768c1b..58140f6b 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -1,28 +1,32 @@ # gui - general -schematica.gui.openFolder=Atidaryti schemø aplankà +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Baigta + +# gui - general - load schematica.gui.title=Pasirinkite schemos failà schematica.gui.folderInfo=(Dëkite schemø failus èia\!) +schematica.gui.openFolder=Atidaryti schemø aplankà schematica.gui.noschematic=-- Nëra schemos -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Slëpti + +# gui - general - save +schematica.gui.point.red=Raudonasis taðkas +schematica.gui.point.blue=Mëlynasis taðkas +schematica.gui.save=Iðsaugoti +schematica.gui.saveselection=Iðsaugoti paþymëta plotà kaip schemà? + +# gui - general - control +schematica.gui.moveschematic=Patraukti schemà +schematica.gui.materials=Medþiagos +schematica.gui.operations=Veiksmas schematica.gui.all=VISI +schematica.gui.layers=Sluoksnis +schematica.gui.hide=Slëpti schematica.gui.show=Rodyti schematica.gui.movehere=Perkelti èia schematica.gui.flip=Veidrodinis vaizdas schematica.gui.rotate=Pasukti -schematica.gui.save=Iðsaugoti -schematica.gui.moveschematic=Patraukti schemà -schematica.gui.layers=Sluoksnis -schematica.gui.operations=Veiksmas -schematica.gui.point.red=Raudonasis taðkas -schematica.gui.point.blue=Mëlynasis taðkas -schematica.gui.saveselection=Iðsaugoti paþymëta plotà kaip schemà? -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Medþiagos schematica.gui.materialname=Medþiaga schematica.gui.materialamount=Kiekis @@ -54,3 +58,5 @@ schematica.key.control=Manipuliuoti schemà # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 335a1166..ac6aa1fb 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -1,28 +1,32 @@ # gui - general -schematica.gui.openFolder=Open schematic map +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Klaar + +# gui - general - load schematica.gui.title=Selecteer schematic bestand schematica.gui.folderInfo=(Plaats schematic bestanden hier) +schematica.gui.openFolder=Open schematic map schematica.gui.noschematic=-- Geen schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Verberg + +# gui - general - save +schematica.gui.point.red=Rood punt +schematica.gui.point.blue=Blauw punt +schematica.gui.save=Opslaan +schematica.gui.saveselection=Sla de selectie op als schematic + +# gui - general - control +schematica.gui.moveschematic=Verplaats schematic +schematica.gui.materials=Materialen +schematica.gui.operations=Handelingen schematica.gui.all=ALLE +schematica.gui.layers=Lagen +schematica.gui.hide=Verberg schematica.gui.show=Geef weer schematica.gui.movehere=Verplaats hiernaartoe schematica.gui.flip=Spiegelen schematica.gui.rotate=Roteer -schematica.gui.save=Opslaan -schematica.gui.moveschematic=Verplaats schematic -schematica.gui.layers=Lagen -schematica.gui.operations=Handelingen -schematica.gui.point.red=Rood punt -schematica.gui.point.blue=Blauw punt -schematica.gui.saveselection=Sla de selectie op als schematic -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materialen schematica.gui.materialname=Materiaal schematica.gui.materialamount=Hoeveelheid @@ -54,3 +58,5 @@ schematica.key.control=Bewerk schematic # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 1e92cf6e..ac2b20f6 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Åpne tegningsmappen +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Ferdig + +# gui - general - load schematica.gui.title=Velg tegningsfil schematica.gui.folderInfo=(Plasser tegningsfiler her) +schematica.gui.openFolder=Åpne tegningsmappen schematica.gui.noschematic=-- Ingen tegninger -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Skjul + +# gui - general - save +schematica.gui.point.red=Rødt punkt +schematica.gui.point.blue=Blått punkt +schematica.gui.save=Lagre +schematica.gui.saveselection=Lagre utvalget som en tegning + +# gui - general - control +schematica.gui.moveschematic=Flytt tegning +schematica.gui.materials=Materialer +schematica.gui.printer=Printer +schematica.gui.operations=Operasjoner schematica.gui.all=ALLE +schematica.gui.layers=Lag +schematica.gui.hide=Skjul schematica.gui.show=Vis schematica.gui.movehere=Flytt hit schematica.gui.flip=Vend schematica.gui.rotate=Roter -schematica.gui.save=Lagre -schematica.gui.moveschematic=Flytt tegning -schematica.gui.layers=Lag -schematica.gui.operations=Operasjoner -schematica.gui.point.red=Rødt punkt -schematica.gui.point.blue=Blått punkt -schematica.gui.saveselection=Lagre utvalget som en tegning -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materialer schematica.gui.materialname=Materiale schematica.gui.materialamount=Mengde -schematica.gui.printer=Printer # gui - config - categories schematica.config.category.render=Gjengivelse @@ -82,3 +86,5 @@ schematica.key.control=Manipuler tegning # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 207f77d5..2659ed19 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -1,30 +1,34 @@ # gui - general -schematica.gui.openFolder=Otworz folder z schematami +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Gotowe + +# gui - general - load schematica.gui.title=Wybierz plik schematu schematica.gui.folderInfo=(Tutaj wrzucaj schematy) +schematica.gui.openFolder=Otworz folder z schematami schematica.gui.noschematic=-- Nie ma schematu -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Schowaj + +# gui - general - save +schematica.gui.point.red=Czerwony znacznik +schematica.gui.point.blue=Niebieski znacznik +schematica.gui.save=Zapisz +schematica.gui.saveselection=Zapisz zaznaczenie jako schemat + +# gui - general - control +schematica.gui.moveschematic=Przenies schemat +schematica.gui.materials=Materialy +schematica.gui.printer=Drukarka +schematica.gui.operations=Operacje schematica.gui.all=Wszystko +schematica.gui.layers=Warstwy +schematica.gui.hide=Schowaj schematica.gui.show=Pokarz schematica.gui.movehere=Przenies tutaj schematica.gui.flip=Odwroc schematica.gui.rotate=Obroc -schematica.gui.save=Zapisz -schematica.gui.moveschematic=Przenies schemat -schematica.gui.layers=Warstwy -schematica.gui.operations=Operacje -schematica.gui.point.red=Czerwony znacznik -schematica.gui.point.blue=Niebieski znacznik -schematica.gui.saveselection=Zapisz zaznaczenie jako schemat -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materialy schematica.gui.materialamount=Ilosc -schematica.gui.printer=Drukarka # gui - config - categories @@ -54,3 +58,5 @@ schematica.key.control=Manipulacja schematem # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 465c8cfc..aa45f38a 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Abrir pasta das schematicas +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Feito + +# gui - general - load schematica.gui.title=Selecionar schematica schematica.gui.folderInfo=(Colocar schematcas aqui) +schematica.gui.openFolder=Abrir pasta das schematicas schematica.gui.noschematic=-- Năo tens schematicas -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Esconder + +# gui - general - save +schematica.gui.point.red=Ponto Vermelho +schematica.gui.point.blue=Ponto Azul +schematica.gui.save=Guardar +schematica.gui.saveselection=Guardar selecçăo como uma schematica + +# gui - general - control +schematica.gui.moveschematic=Mover schematica +schematica.gui.materials=Materiais +schematica.gui.printer=Modo de construçăo automática +schematica.gui.operations=Operaçőes schematica.gui.all=TODAS +schematica.gui.layers=Camadas +schematica.gui.hide=Esconder schematica.gui.show=Mostrar schematica.gui.movehere=Mover para aqui schematica.gui.flip=Virar schematica.gui.rotate=Rodar -schematica.gui.save=Guardar -schematica.gui.moveschematic=Mover schematica -schematica.gui.layers=Camadas -schematica.gui.operations=Operaçőes -schematica.gui.point.red=Ponto Vermelho -schematica.gui.point.blue=Ponto Azul -schematica.gui.saveselection=Guardar selecçăo como uma schematica -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiais schematica.gui.materialname=Material schematica.gui.materialamount=Quantidade -schematica.gui.printer=Modo de construçăo automática # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Manipular schematica # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 63fa3b59..79755b85 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Открыть папку со схемами +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Готово + +# gui - general - load schematica.gui.title=Выберите файл схемы schematica.gui.folderInfo=(Место хранения схем) +schematica.gui.openFolder=Открыть папку со схемами schematica.gui.noschematic=-- Нет схем -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Спрятать + +# gui - general - save +schematica.gui.point.red=Красная точка +schematica.gui.point.blue=Синяя точка +schematica.gui.save=Сохранить +schematica.gui.saveselection=Сохранить схему выделенной области + +# gui - general - control +schematica.gui.moveschematic=Передвинуть схему +schematica.gui.materials=Материалы +schematica.gui.printer=Принтер +schematica.gui.operations=Операции schematica.gui.all=ВСЕ +schematica.gui.layers=Слои +schematica.gui.hide=Спрятать schematica.gui.show=Показать schematica.gui.movehere=Передвинуть сюда schematica.gui.flip=Отразить schematica.gui.rotate=Повернуть -schematica.gui.save=Сохранить -schematica.gui.moveschematic=Передвинуть схему -schematica.gui.layers=Слои -schematica.gui.operations=Операции -schematica.gui.point.red=Красная точка -schematica.gui.point.blue=Синяя точка -schematica.gui.saveselection=Сохранить схему выделенной области -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Материалы schematica.gui.materialname=Материал schematica.gui.materialamount=Количество -schematica.gui.printer=Принтер # gui - config - categories @@ -56,3 +60,5 @@ schematica.key.control=Манипулирование схемой # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index 73954514..eaa5e1c4 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Otvoriť priečinok so schématami +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Hotovo + +# gui - general - load schematica.gui.title=Vyberte schematický súbor schematica.gui.folderInfo=(Tu vložte schematické súbory) +schematica.gui.openFolder=Otvoriť priečinok so schématami schematica.gui.noschematic=-- Žiadna schéma -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Skrýť + +# gui - general - save +schematica.gui.point.red=Červený bod +schematica.gui.point.blue=Modrý bod +schematica.gui.save=Uložiť +schematica.gui.saveselection=Uložiť výber ako schému + +# gui - general - control +schematica.gui.moveschematic=Presunúť schému +schematica.gui.materials=Materiály +schematica.gui.printer=Tlačiareň +schematica.gui.operations=Operácie schematica.gui.all=Všetko +schematica.gui.layers=Vrstvy +schematica.gui.hide=Skrýť schematica.gui.show=Zobraziť schematica.gui.movehere=Presunúť tu schematica.gui.flip=Prevrátiť schematica.gui.rotate=Otočiť -schematica.gui.save=Uložiť -schematica.gui.moveschematic=Presunúť schému -schematica.gui.layers=Vrstvy -schematica.gui.operations=Operácie -schematica.gui.point.red=Červený bod -schematica.gui.point.blue=Modrý bod -schematica.gui.saveselection=Uložiť výber ako schému -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiály schematica.gui.materialname=Materiál schematica.gui.materialamount=Množstvo -schematica.gui.printer=Tlačiareň # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Manipulovať so schémou # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index 6e7336b6..a12eed59 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Odpri shematično mapo +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Končano + +# gui - general - load schematica.gui.title=Izberi shematično datoteko schematica.gui.folderInfo=(Sheme vstavi v to mapo) +schematica.gui.openFolder=Odpri shematično mapo schematica.gui.noschematic=-- Ni sheme -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Skrij + +# gui - general - save +schematica.gui.point.red=Rdeča točka +schematica.gui.point.blue=Modra točka +schematica.gui.save=Shrani +schematica.gui.saveselection=Shrani izbrano območje kot shemo + +# gui - general - control +schematica.gui.moveschematic=Premakni shemo +schematica.gui.materials=Materiali +schematica.gui.printer=Tiskalnik +schematica.gui.operations=Operacije schematica.gui.all=VSE +schematica.gui.layers=Sloji +schematica.gui.hide=Skrij schematica.gui.show=Pokaži schematica.gui.movehere=Premakni sem schematica.gui.flip=Zrcali schematica.gui.rotate=Rotiraj -schematica.gui.save=Shrani -schematica.gui.moveschematic=Premakni shemo -schematica.gui.layers=Sloji -schematica.gui.operations=Operacije -schematica.gui.point.red=Rdeča točka -schematica.gui.point.blue=Modra točka -schematica.gui.saveselection=Shrani izbrano območje kot shemo -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Materiali schematica.gui.materialname=Material schematica.gui.materialamount=Količina -schematica.gui.printer=Tiskalnik # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Manipuliraj shemo # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 3649985b..8f5d3e4b 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=เปิดโฟลเดอร์ Schematic +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=เสร็จสิ้น + +# gui - general - load schematica.gui.title=เลือกไฟล์ Schematic ที่ต้องการ schematica.gui.folderInfo=(ให้วางไฟล์ .schematic ในโฟลเดอร์นี้) +schematica.gui.openFolder=เปิดโฟลเดอร์ Schematic schematica.gui.noschematic=-- ไม่มี Schematic -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=ซ่อน + +# gui - general - save +schematica.gui.point.red=จุดแดง +schematica.gui.point.blue=จุดน้ำเงิน +schematica.gui.save=บันทึก +schematica.gui.saveselection=บันทึกจุดที่เลือกไปยัง Schematic + +# gui - general - control +schematica.gui.moveschematic=ย้าย Schematic +schematica.gui.materials=ส่วนประกอบ +schematica.gui.printer=การปริ๊น +schematica.gui.operations=การดำเนินงาน schematica.gui.all=ทั้งหมด +schematica.gui.layers=เลเยอร์ +schematica.gui.hide=ซ่อน schematica.gui.show=แสดง schematica.gui.movehere=ย้ายมาตรงนี้ schematica.gui.flip=พลิก schematica.gui.rotate=หมุน -schematica.gui.save=บันทึก -schematica.gui.moveschematic=ย้าย Schematic -schematica.gui.layers=เลเยอร์ -schematica.gui.operations=การดำเนินงาน -schematica.gui.point.red=จุดแดง -schematica.gui.point.blue=จุดน้ำเงิน -schematica.gui.saveselection=บันทึกจุดที่เลือกไปยัง Schematic -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=ส่วนประกอบ schematica.gui.materialname=ส่วนประกอบ schematica.gui.materialamount=จำนวน -schematica.gui.printer=การปริ๊น # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=จัดการ Schematic # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 3982aeea..2ec1a606 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Şematik klasörünü aç +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Tamam + +# gui - general - load schematica.gui.title=Şematik dosyasını seçin schematica.gui.folderInfo=(Şematik dosyalarını buraya koyun) +schematica.gui.openFolder=Şematik klasörünü aç schematica.gui.noschematic=--Şematik yok-- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=Gizle + +# gui - general - save +schematica.gui.point.red=Kırmızı nokta +schematica.gui.point.blue=Mavi nokta +schematica.gui.save=Kaydet +schematica.gui.saveselection=Seçimi şematik olarak kaydet + +# gui - general - control +schematica.gui.moveschematic=Şematik taşıma +schematica.gui.materials=Malzemeler +schematica.gui.printer=Yazıcı +schematica.gui.operations=İşlemler schematica.gui.all=HEPSİ +schematica.gui.layers=Katmanlar +schematica.gui.hide=Gizle schematica.gui.show=Göster schematica.gui.movehere=Buraya Taşı schematica.gui.flip=Ters çevir schematica.gui.rotate=Döndür -schematica.gui.save=Kaydet -schematica.gui.moveschematic=Şematik taşıma -schematica.gui.layers=Katmanlar -schematica.gui.operations=İşlemler -schematica.gui.point.red=Kırmızı nokta -schematica.gui.point.blue=Mavi nokta -schematica.gui.saveselection=Seçimi şematik olarak kaydet -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Malzemeler schematica.gui.materialname=Malzeme schematica.gui.materialamount=Miktar -schematica.gui.printer=Yazıcı # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=Şematiki işleyin # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 478ecd52..6740da64 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=Відкрити папку з технологічними схемами +schematica.gui.x=Х: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=Готово + +# gui - general - load schematica.gui.title=вибррати файл технологічної схеми schematica.gui.folderInfo=(збережені технологічні схеми) +schematica.gui.openFolder=Відкрити папку з технологічними схемами schematica.gui.noschematic=-- немає технологічних схем -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=сховати + +# gui - general - save +schematica.gui.point.red=Червона мітка +schematica.gui.point.blue=Синя мітка +schematica.gui.save=Зберегти +schematica.gui.saveselection=Зберегти виділену технологічну схему + +# gui - general - control +schematica.gui.moveschematic=Перемістити технологічну схему +schematica.gui.materials=Матеріали +schematica.gui.printer=Принтер +schematica.gui.operations=Операції schematica.gui.all=всі +schematica.gui.layers=Шар +schematica.gui.hide=сховати schematica.gui.show=показати schematica.gui.movehere=перемістити сюди schematica.gui.flip=відбити schematica.gui.rotate=Обернути -schematica.gui.save=Зберегти -schematica.gui.moveschematic=Перемістити технологічну схему -schematica.gui.layers=Шар -schematica.gui.operations=Операції -schematica.gui.point.red=Червона мітка -schematica.gui.point.blue=Синя мітка -schematica.gui.saveselection=Зберегти виділену технологічну схему -schematica.gui.x=Х: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=Матеріали schematica.gui.materialname=Матеріал schematica.gui.materialamount=кількість -schematica.gui.printer=Принтер # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=маніпулювати технологічною сх # commands - remove # commands - download + +# messages diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index f3e52005..62096ab8 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -1,31 +1,35 @@ # gui - general -schematica.gui.openFolder=打开Schematic文件夹 +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: schematica.gui.done=完成 + +# gui - general - load schematica.gui.title=选择Schematic文件 schematica.gui.folderInfo=(将Schematic文件夹放在此处) +schematica.gui.openFolder=打开Schematic文件夹 schematica.gui.noschematic=-- 没有Schematic文件 -- -schematica.gui.increase=+ -schematica.gui.decrease=- -schematica.gui.hide=隐藏 + +# gui - general - save +schematica.gui.point.red=红点 +schematica.gui.point.blue=蓝点 +schematica.gui.save=保存 +schematica.gui.saveselection=将选区保存为Schematic文件 + +# gui - general - control +schematica.gui.moveschematic=移动Schematic文件 +schematica.gui.materials=材料 +schematica.gui.printer=投影 +schematica.gui.operations=操作 schematica.gui.all=全部 +schematica.gui.layers=层 +schematica.gui.hide=隐藏 schematica.gui.show=显示 schematica.gui.movehere=移动到此处 schematica.gui.flip=对称 schematica.gui.rotate=旋转 -schematica.gui.save=保存 -schematica.gui.moveschematic=移动Schematic文件 -schematica.gui.layers=层 -schematica.gui.operations=操作 -schematica.gui.point.red=红点 -schematica.gui.point.blue=蓝点 -schematica.gui.saveselection=将选区保存为Schematic文件 -schematica.gui.x=X: -schematica.gui.y=Y: -schematica.gui.z=Z: -schematica.gui.materials=材料 schematica.gui.materialname=材料 schematica.gui.materialamount=数量 -schematica.gui.printer=投影 # gui - config - categories @@ -55,3 +59,5 @@ schematica.key.control=调整Schematic文件 # commands - remove # commands - download + +# messages From b852f186e15b152f7f43680e71837b6ee4c82e09 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 24 Mar 2015 23:53:13 +0100 Subject: [PATCH 212/314] Overhauled the printer (should support more blocks by default). Replaced .values() calls with the VALUES field. --- .../gui/control/GuiSchematicControl.java | 2 +- .../client/printer/SchematicPrinter.java | 204 ++++------ .../client/printer/registry/IOffset.java | 7 + .../printer/registry/IValidBlockFacing.java | 10 + .../printer/registry/IValidPlayerFacing.java | 10 + .../printer/registry/PlacementData.java | 100 +++++ .../printer/registry/PlacementRegistry.java | 326 ++++++++++++++++ .../client/renderer/RenderSchematic.java | 2 +- .../client/util/BlockStateToItemStack.java | 26 ++ .../client/util/RotationHelper.java | 2 +- .../schematica/config/BlockInfo.java | 366 ------------------ .../schematica/config/PlacementData.java | 105 ----- .../schematica/reference/Constants.java | 23 ++ .../schematica/util/BlockStateHelper.java | 27 ++ 14 files changed, 614 insertions(+), 596 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/registry/IOffset.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidBlockFacing.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/config/PlacementData.java create mode 100644 src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index 622f19fb..a2e8f7dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -182,7 +182,7 @@ protected void actionPerformed(GuiButton guiButton) { // TODO: implement flip logic SchematicPrinter.INSTANCE.refresh(); } else if (guiButton.id == this.btnRotateDirection.id) { - final EnumFacing[] values = EnumFacing.values(); + final EnumFacing[] values = EnumFacing.VALUES; ClientProxy.axisRotation = values[((ClientProxy.axisRotation.ordinal() + 1) % values.length)]; guiButton.displayString = I18n.format(Names.Gui.Control.TRANSFORM_PREFIX + ClientProxy.axisRotation.getName()); } else if (guiButton.id == this.btnRotate.id) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index fc3c162c..34585169 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -2,54 +2,38 @@ import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.client.printer.registry.PlacementData; +import com.github.lunatrius.schematica.client.printer.registry.PlacementRegistry; +import com.github.lunatrius.schematica.client.util.BlockStateToItemStack; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.github.lunatrius.schematica.config.BlockInfo; -import com.github.lunatrius.schematica.config.PlacementData; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; -import net.minecraft.block.BlockPistonBase; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C0BPacketEntityAction; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.fluids.BlockFluidBase; -import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class SchematicPrinter { - public static final int WILDCARD_METADATA = -1; - public static final int SIZE_CRAFTING_OUT = 1; - public static final int SIZE_CRAFTING_IN = 4; - public static final int SIZE_ARMOR = 4; - public static final int SIZE_INVENTORY = 3 * 9; - public static final int SIZE_HOTBAR = 9; - - public static final int SLOT_OFFSET_CRAFTING_OUT = 0; - public static final int SLOT_OFFSET_CRAFTING_IN = SLOT_OFFSET_CRAFTING_OUT + SIZE_CRAFTING_OUT; - public static final int SLOT_OFFSET_ARMOR = SLOT_OFFSET_CRAFTING_IN + SIZE_CRAFTING_IN; - public static final int SLOT_OFFSET_INVENTORY = SLOT_OFFSET_ARMOR + SIZE_ARMOR; - public static final int SLOT_OFFSET_HOTBAR = SLOT_OFFSET_INVENTORY + SIZE_INVENTORY; - - public static final int INV_OFFSET_HOTBAR = 0; - public static final int INV_OFFSET_INVENTORY = INV_OFFSET_HOTBAR + 9; - public static final SchematicPrinter INSTANCE = new SchematicPrinter(); private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -148,7 +132,7 @@ public boolean print() { return true; } - private boolean placeBlock(WorldClient world, EntityPlayerSP player, BlockPos pos) { + private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos) { final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); @@ -191,13 +175,13 @@ private boolean placeBlock(WorldClient world, EntityPlayerSP player, BlockPos po return false; } - final Item item = BlockInfo.getItemFromBlock(block); - if (item == null) { - Reference.logger.debug(GameData.getBlockRegistry().getNameForObject(block) + " is missing a mapping!"); + final ItemStack itemStack = BlockStateToItemStack.getItemStack(blockState, new MovingObjectPosition(player), this.schematic, pos); + if (itemStack == null || itemStack.getItem() == null) { + Reference.logger.debug("{} is missing a mapping!", blockState); return false; } - if (placeBlock(this.minecraft, world, player, realPos, item, metadata)) { + if (placeBlock(world, player, realPos, blockState, itemStack)) { this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; if (!ConfigurationHandler.placeInstantly) { @@ -208,11 +192,11 @@ private boolean placeBlock(WorldClient world, EntityPlayerSP player, BlockPos po return false; } - private boolean isSolid(World world, BlockPos pos, EnumFacing side) { + private boolean isSolid(final World world, final BlockPos pos, final EnumFacing side) { final BlockPos offset = new BlockPos(pos).offset(side); final IBlockState blockState = world.getBlockState(offset); - Block block = blockState.getBlock(); + final Block block = blockState.getBlock(); if (block == null) { return false; @@ -233,109 +217,84 @@ private boolean isSolid(World world, BlockPos pos, EnumFacing side) { return true; } - private EnumFacing[] getSolidSides(World world, BlockPos pos) { - List list = new ArrayList(); + private List getSolidSides(final World world, final BlockPos pos) { + if (!ConfigurationHandler.placeAdjacent) { + return Arrays.asList(EnumFacing.VALUES); + } + + final List list = new ArrayList(); - for (EnumFacing side : EnumFacing.values()) { + for (final EnumFacing side : EnumFacing.VALUES) { if (isSolid(world, pos, side)) { list.add(side); } } - EnumFacing[] sides = new EnumFacing[list.size()]; - return list.toArray(sides); + return list; } - private boolean placeBlock(Minecraft minecraft, WorldClient world, EntityPlayerSP player, BlockPos pos, Item item, int itemDamage) { - if (item instanceof ItemBucket || item == Items.sign) { + private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos, final IBlockState blockState, final ItemStack itemStack) { + if (itemStack.getItem() instanceof ItemBucket || itemStack.getItem() == Items.sign) { return false; } - PlacementData data = BlockInfo.getPlacementDataFromItem(item); - - if (!isValidOrientation(player, pos, data, itemDamage)) { + final PlacementData data = PlacementRegistry.INSTANCE.getPlacementData(blockState, itemStack); + if (data != null && !data.isValidPlayerFacing(blockState, player, pos, world)) { return false; } - EnumFacing[] solidSides = getSolidSides(world, pos); - EnumFacing direction = null; - float offsetY = 0.0f; - - if (solidSides.length > 0) { - int metadata = WILDCARD_METADATA; - - if (data != null) { - EnumFacing[] validDirections = data.getValidDirections(solidSides, itemDamage); - if (validDirections.length > 0) { - direction = validDirections[0]; - } - - offsetY = data.getOffsetFromMetadata(itemDamage); - - if (data.maskMetaInHand != -1) { - metadata = data.getMetaInHand(itemDamage); - } - } else { - direction = solidSides[0]; - } - - if (!swapToItem(player.inventory, item, metadata)) { - return false; - } - } + final List solidSides = getSolidSides(world, pos); - if (direction != null || !ConfigurationHandler.placeAdjacent) { - return placeBlock(minecraft, world, player, pos, direction, 0.0f, offsetY, 0.0f); + if (solidSides.size() == 0) { + return false; } - return false; - } + final EnumFacing direction; + final float offsetX; + final float offsetY; + final float offsetZ; - private boolean isValidOrientation(EntityPlayer player, BlockPos pos, PlacementData data, int metadata) { if (data != null) { - switch (data.type) { - case BLOCK: { - return true; + final List validDirections = data.getValidBlockFacings(solidSides, blockState); + if (validDirections.size() == 0) { + return false; } - case PLAYER: { - Integer integer = data.mapping.get(ClientProxy.orientation); - if (integer != null) { - return integer == (metadata & data.maskMeta); - } - break; - } + direction = validDirections.get(0); + offsetX = data.getOffsetX(blockState); + offsetY = data.getOffsetY(blockState); + offsetZ = data.getOffsetZ(blockState); + } else { + direction = solidSides.get(0); + offsetX = 0.5f; + offsetY = 0.5f; + offsetZ = 0.5f; + } - case PISTON: { - Integer integer = data.mapping.get(ClientProxy.orientation); - if (integer != null) { - return BlockPistonBase.getFacingFromEntity(null, pos, player) == BlockPistonBase.getFacing(metadata); - } - break; - } - } + if (!swapToItem(player.inventory, itemStack)) { return false; } - return true; + return placeBlock(world, player, pos, direction, offsetX, offsetY, offsetZ); + } - private boolean placeBlock(Minecraft minecraft, WorldClient world, EntityPlayerSP player, BlockPos pos, EnumFacing direction, float offsetX, float offsetY, float offsetZ) { - ItemStack itemStack = player.getCurrentEquippedItem(); + private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos, final EnumFacing direction, final float offsetX, final float offsetY, final float offsetZ) { + final ItemStack itemStack = player.getCurrentEquippedItem(); boolean success = false; final BlockPos offset = new BlockPos(pos).offset(direction); - EnumFacing side = direction.getOpposite(); + final EnumFacing side = direction.getOpposite(); // copypasted from n.m.client.Minecraft to sooth finicky servers - success = !ForgeEventFactory.onPlayerInteract(minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); + success = !ForgeEventFactory.onPlayerInteract(this.minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); if (success) { // still not assured! - success = minecraft.playerController.onPlayerRightClick(player, world, itemStack, offset, side, new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ)); + success = this.minecraft.playerController.onPlayerRightClick(player, world, itemStack, pos, side, new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ)); if (success) { // yes, some servers actually care about this. - minecraft.thePlayer.swingItem(); + this.minecraft.thePlayer.swingItem(); } } @@ -346,50 +305,51 @@ private boolean placeBlock(Minecraft minecraft, WorldClient world, EntityPlayerS return success; } - private void syncSneaking(EntityPlayerSP player, boolean isSneaking) { + private void syncSneaking(final EntityPlayerSP player, final boolean isSneaking) { player.setSneaking(isSneaking); player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? C0BPacketEntityAction.Action.START_SNEAKING : C0BPacketEntityAction.Action.STOP_SNEAKING)); } - private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage) { - return swapToItem(inventory, item, itemDamage, true); + private boolean swapToItem(final InventoryPlayer inventory, final ItemStack itemStack) { + return swapToItem(inventory, itemStack, true); } - private boolean swapToItem(InventoryPlayer inventory, Item item, int itemDamage, boolean swapSlots) { - int slot = getInventorySlotWithItem(inventory, item, itemDamage); + private boolean swapToItem(final InventoryPlayer inventory, final ItemStack itemStack, final boolean swapSlots) { + final int slot = getInventorySlotWithItem(inventory, itemStack); - if (this.minecraft.playerController.isInCreativeMode() && (slot < INV_OFFSET_HOTBAR || slot >= INV_OFFSET_HOTBAR + SIZE_HOTBAR) && ConfigurationHandler.swapSlotsQueue.size() > 0) { + if (this.minecraft.playerController.isInCreativeMode() && (slot < Constants.Inventory.InventoryOffset.HOTBAR || slot >= Constants.Inventory.InventoryOffset.HOTBAR + Constants.Inventory.Size.HOTBAR) && ConfigurationHandler.swapSlotsQueue.size() > 0) { inventory.currentItem = getNextSlot(); - inventory.setInventorySlotContents(inventory.currentItem, new ItemStack(item, 1, itemDamage)); - this.minecraft.playerController.sendSlotPacket(inventory.getStackInSlot(inventory.currentItem), SLOT_OFFSET_HOTBAR + inventory.currentItem); + inventory.setInventorySlotContents(inventory.currentItem, itemStack.copy()); + this.minecraft.playerController.sendSlotPacket(inventory.getStackInSlot(inventory.currentItem), Constants.Inventory.SlotOffset.HOTBAR + inventory.currentItem); return true; } - if (slot >= INV_OFFSET_HOTBAR && slot < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { + if (slot >= Constants.Inventory.InventoryOffset.HOTBAR && slot < Constants.Inventory.InventoryOffset.HOTBAR + Constants.Inventory.Size.HOTBAR) { inventory.currentItem = slot; return true; - } else if (swapSlots && slot >= INV_OFFSET_INVENTORY && slot < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { + } else if (swapSlots && slot >= Constants.Inventory.InventoryOffset.INVENTORY && slot < Constants.Inventory.InventoryOffset.INVENTORY + Constants.Inventory.Size.INVENTORY) { if (swapSlots(inventory, slot)) { - return swapToItem(inventory, item, itemDamage, false); + return swapToItem(inventory, itemStack, false); } } + return false; } - private int getInventorySlotWithItem(InventoryPlayer inventory, Item item, int itemDamage) { + private int getInventorySlotWithItem(final InventoryPlayer inventory, final ItemStack itemStack) { for (int i = 0; i < inventory.mainInventory.length; i++) { - if (inventory.mainInventory[i] != null && inventory.mainInventory[i].getItem() == item && (itemDamage == WILDCARD_METADATA || inventory.mainInventory[i].getItemDamage() == itemDamage)) { + if (inventory.mainInventory[i] != null && inventory.mainInventory[i].isItemEqual(itemStack)) { return i; } } return -1; } - private boolean swapSlots(InventoryPlayer inventory, int from) { + private boolean swapSlots(final InventoryPlayer inventory, final int from) { if (ConfigurationHandler.swapSlotsQueue.size() > 0) { - int slot = getNextSlot(); + final int slot = getNextSlot(); - ItemStack itemStack = inventory.mainInventory[slot + INV_OFFSET_HOTBAR]; + final ItemStack itemStack = inventory.mainInventory[slot + Constants.Inventory.InventoryOffset.HOTBAR]; swapSlots(from, slot, itemStack == null || itemStack.stackSize == 0); return true; } @@ -398,24 +358,24 @@ private boolean swapSlots(InventoryPlayer inventory, int from) { } private int getNextSlot() { - int slot = ConfigurationHandler.swapSlotsQueue.poll() % SIZE_HOTBAR; + final int slot = ConfigurationHandler.swapSlotsQueue.poll() % Constants.Inventory.Size.HOTBAR; ConfigurationHandler.swapSlotsQueue.offer(slot); return slot; } - private boolean swapSlots(int from, int to, boolean targetEmpty) { - if (from >= INV_OFFSET_HOTBAR && from < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { - from = SLOT_OFFSET_HOTBAR + (from - INV_OFFSET_HOTBAR); - } else if (from >= INV_OFFSET_INVENTORY && from < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { - from = SLOT_OFFSET_INVENTORY + (from - INV_OFFSET_INVENTORY); + private boolean swapSlots(int from, int to, final boolean targetEmpty) { + if (from >= Constants.Inventory.InventoryOffset.HOTBAR && from < Constants.Inventory.InventoryOffset.HOTBAR + Constants.Inventory.Size.HOTBAR) { + from = Constants.Inventory.SlotOffset.HOTBAR + (from - Constants.Inventory.InventoryOffset.HOTBAR); + } else if (from >= Constants.Inventory.InventoryOffset.INVENTORY && from < Constants.Inventory.InventoryOffset.INVENTORY + Constants.Inventory.Size.INVENTORY) { + from = Constants.Inventory.SlotOffset.INVENTORY + (from - Constants.Inventory.InventoryOffset.INVENTORY); } else { return false; } - if (to >= INV_OFFSET_HOTBAR && to < INV_OFFSET_HOTBAR + SIZE_HOTBAR) { - to = SLOT_OFFSET_HOTBAR + (to - INV_OFFSET_HOTBAR); - } else if (to >= INV_OFFSET_INVENTORY && to < INV_OFFSET_INVENTORY + SIZE_INVENTORY) { - to = SLOT_OFFSET_INVENTORY + (to - INV_OFFSET_INVENTORY); + if (to >= Constants.Inventory.InventoryOffset.HOTBAR && to < Constants.Inventory.InventoryOffset.HOTBAR + Constants.Inventory.Size.HOTBAR) { + to = Constants.Inventory.SlotOffset.HOTBAR + (to - Constants.Inventory.InventoryOffset.HOTBAR); + } else if (to >= Constants.Inventory.InventoryOffset.INVENTORY && to < Constants.Inventory.InventoryOffset.INVENTORY + Constants.Inventory.Size.INVENTORY) { + to = Constants.Inventory.SlotOffset.INVENTORY + (to - Constants.Inventory.InventoryOffset.INVENTORY); } else { return false; } @@ -429,7 +389,7 @@ private boolean swapSlots(int from, int to, boolean targetEmpty) { return true; } - private ItemStack clickSlot(int slot) { + private ItemStack clickSlot(final int slot) { return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, slot, 0, 0, this.minecraft.thePlayer); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IOffset.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IOffset.java new file mode 100644 index 00000000..963b79b0 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IOffset.java @@ -0,0 +1,7 @@ +package com.github.lunatrius.schematica.client.printer.registry; + +import net.minecraft.block.state.IBlockState; + +public interface IOffset { + float getOffset(IBlockState blockState); +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidBlockFacing.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidBlockFacing.java new file mode 100644 index 00000000..4c1cc6f5 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidBlockFacing.java @@ -0,0 +1,10 @@ +package com.github.lunatrius.schematica.client.printer.registry; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; + +import java.util.List; + +public interface IValidBlockFacing { + List getValidBlockFacings(List solidSides, IBlockState blockState); +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java new file mode 100644 index 00000000..2c938abd --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java @@ -0,0 +1,10 @@ +package com.github.lunatrius.schematica.client.printer.registry; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public interface IValidPlayerFacing { + boolean isValid(IBlockState blockState, EntityPlayer player, BlockPos pos, World world); +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java new file mode 100644 index 00000000..bcf3c168 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java @@ -0,0 +1,100 @@ +package com.github.lunatrius.schematica.client.printer.registry; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class PlacementData { + private final IValidPlayerFacing validPlayerFacing; + private final IValidBlockFacing validBlockFacing; + private IOffset offsetX; + private IOffset offsetY; + private IOffset offsetZ; + + public PlacementData() { + this(null, null); + } + + public PlacementData(final IValidPlayerFacing validPlayerFacing) { + this(validPlayerFacing, null); + } + + public PlacementData(final IValidBlockFacing validBlockFacing) { + this(null, validBlockFacing); + } + + public PlacementData(final IValidPlayerFacing validPlayerFacing, final IValidBlockFacing validBlockFacing) { + this.validPlayerFacing = validPlayerFacing; + this.validBlockFacing = validBlockFacing; + this.offsetX = null; + this.offsetY = null; + this.offsetZ = null; + } + + public PlacementData setOffsetX(final IOffset offset) { + this.offsetX = offset; + return this; + } + + public PlacementData setOffsetY(final IOffset offset) { + this.offsetY = offset; + return this; + } + + public PlacementData setOffsetZ(final IOffset offset) { + this.offsetZ = offset; + return this; + } + + public float getOffsetX(final IBlockState blockState) { + if (this.offsetX != null) { + return this.offsetX.getOffset(blockState); + } + + return 0.5f; + } + + public float getOffsetY(final IBlockState blockState) { + if (this.offsetY != null) { + return this.offsetY.getOffset(blockState); + } + + return 0.5f; + } + + public float getOffsetZ(final IBlockState blockState) { + if (this.offsetZ != null) { + return this.offsetZ.getOffset(blockState); + } + + return 0.5f; + } + + public boolean isValidPlayerFacing(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + return this.validPlayerFacing == null || this.validPlayerFacing.isValid(blockState, player, pos, world); + } + + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = this.validBlockFacing != null ? this.validBlockFacing.getValidBlockFacings(solidSides, blockState) : new ArrayList(solidSides); + + for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { + EnumFacing facing = iterator.next(); + if (this.offsetY != null) { + final float offset = this.offsetY.getOffset(blockState); + if (offset < 0.5 && facing == EnumFacing.UP) { + iterator.remove(); + } else if (offset > 0.5 && facing == EnumFacing.DOWN) { + iterator.remove(); + } + } + } + + return list; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java new file mode 100644 index 00000000..fbe26e8a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -0,0 +1,326 @@ +package com.github.lunatrius.schematica.client.printer.registry; + +import com.github.lunatrius.schematica.util.BlockStateHelper; +import net.minecraft.block.Block; +import net.minecraft.block.BlockButton; +import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockDispenser; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockLever; +import net.minecraft.block.BlockLog; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.BlockPumpkin; +import net.minecraft.block.BlockQuartz; +import net.minecraft.block.BlockRotatedPillar; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.BlockTrapDoor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class PlacementRegistry { + public static final PlacementRegistry INSTANCE = new PlacementRegistry(); + + private final Map, PlacementData> classPlacementMap = new LinkedHashMap, PlacementData>(); + private final Map blockPlacementMap = new HashMap(); + private final Map itemPlacementMap = new HashMap(); + + private void populateMappings() { + this.classPlacementMap.clear(); + this.itemPlacementMap.clear(); + + final IValidPlayerFacing playerFacingEntity = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == player.getHorizontalFacing(); + } + }; + final IValidPlayerFacing playerFacingEntityOpposite = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == player.getHorizontalFacing().getOpposite(); + } + }; + final IValidPlayerFacing playerFacingPiston = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == BlockPistonBase.getFacingFromEntity(world, pos, player); + } + }; + final IValidPlayerFacing playerFacingRotateY = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == player.getHorizontalFacing().rotateY(); + } + }; + final IValidPlayerFacing playerFacingSingleSlab = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + return !((BlockSlab) blockState.getBlock()).isDouble(); + } + }; + final IValidPlayerFacing playerFacingLever = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final BlockLever.EnumOrientation value = (BlockLever.EnumOrientation) blockState.getValue(BlockLever.FACING); + return !value.getFacing().getAxis().isVertical() || BlockLever.EnumOrientation.forFacings(value.getFacing(), player.getHorizontalFacing()) == value; + } + }; + final IValidPlayerFacing playerFacingIgnore = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + return false; + } + }; + + final IOffset offsetSlab = new IOffset() { + @Override + public float getOffset(final IBlockState blockState) { + if (!((BlockSlab) blockState.getBlock()).isDouble()) { + final BlockSlab.EnumBlockHalf half = (BlockSlab.EnumBlockHalf) blockState.getValue(BlockSlab.HALF); + return half == BlockSlab.EnumBlockHalf.TOP ? 1 : 0; + } + + return 0; + } + }; + final IOffset offsetStairs = new IOffset() { + @Override + public float getOffset(final IBlockState blockState) { + final BlockStairs.EnumHalf half = (BlockStairs.EnumHalf) blockState.getValue(BlockStairs.HALF); + return half == BlockStairs.EnumHalf.TOP ? 1 : 0; + } + }; + final IOffset offsetTrapDoor = new IOffset() { + @Override + public float getOffset(final IBlockState blockState) { + final BlockTrapDoor.DoorHalf half = (BlockTrapDoor.DoorHalf) blockState.getValue(BlockTrapDoor.HALF); + return half == BlockTrapDoor.DoorHalf.TOP ? 1 : 0; + } + }; + + final IValidBlockFacing blockFacingLog = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final BlockLog.EnumAxis axis = (BlockLog.EnumAxis) blockState.getValue(BlockLog.LOG_AXIS); + for (final EnumFacing side : solidSides) { + if (axis != BlockLog.EnumAxis.fromFacingAxis(side.getAxis())) { + continue; + } + + list.add(side); + } + + return list; + } + }; + final IValidBlockFacing blockFacingPillar = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final EnumFacing.Axis axis = (EnumFacing.Axis) blockState.getValue(BlockRotatedPillar.AXIS); + for (final EnumFacing side : solidSides) { + if (axis != side.getAxis()) { + continue; + } + + list.add(side); + } + + return list; + } + }; + final IValidBlockFacing blockFacingOpposite = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); + if (propertyFacing != null && propertyFacing.getValueClass().equals(EnumFacing.class)) { + final EnumFacing facing = ((EnumFacing) blockState.getValue(propertyFacing)); + for (final EnumFacing side : solidSides) { + if (facing.getOpposite() != side) { + continue; + } + + list.add(side); + } + } + + return list; + } + }; + final IValidBlockFacing blockFacingHopper = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final EnumFacing facing = (EnumFacing) blockState.getValue(BlockHopper.FACING); + for (final EnumFacing side : solidSides) { + if (facing != side) { + continue; + } + + list.add(side); + } + + return list; + } + }; + final IValidBlockFacing blockFacingLever = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final BlockLever.EnumOrientation facing = (BlockLever.EnumOrientation) blockState.getValue(BlockLever.FACING); + for (final EnumFacing side : solidSides) { + if (facing.getFacing().getOpposite() != side) { + continue; + } + + list.add(side); + } + + return list; + } + }; + final IValidBlockFacing blockFacingQuartz = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final BlockQuartz.EnumType variant = (BlockQuartz.EnumType) blockState.getValue(BlockQuartz.VARIANT); + for (final EnumFacing side : solidSides) { + if (variant == BlockQuartz.EnumType.LINES_X && side.getAxis() != EnumFacing.Axis.X) { + continue; + } else if (variant == BlockQuartz.EnumType.LINES_Y && side.getAxis() != EnumFacing.Axis.Y) { + continue; + } else if (variant == BlockQuartz.EnumType.LINES_Z && side.getAxis() != EnumFacing.Axis.Z) { + continue; + } + + list.add(side); + } + + return list; + } + }; + + /** + * minecraft + */ + // extends BlockRotatedPillar + addPlacementMapping(BlockLog.class, new PlacementData(blockFacingLog)); + + addPlacementMapping(BlockButton.class, new PlacementData(blockFacingOpposite)); + addPlacementMapping(BlockChest.class, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(BlockDispenser.class, new PlacementData(playerFacingPiston)); + addPlacementMapping(BlockDoor.class, new PlacementData(playerFacingEntity)); + addPlacementMapping(BlockEnderChest.class, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(BlockFenceGate.class, new PlacementData(playerFacingEntity)); + addPlacementMapping(BlockFurnace.class, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(BlockHopper.class, new PlacementData(blockFacingHopper)); + addPlacementMapping(BlockPistonBase.class, new PlacementData(playerFacingPiston)); + addPlacementMapping(BlockPumpkin.class, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(BlockRotatedPillar.class, new PlacementData(blockFacingPillar)); + addPlacementMapping(BlockSlab.class, new PlacementData(playerFacingSingleSlab).setOffsetY(offsetSlab)); + addPlacementMapping(BlockStairs.class, new PlacementData(playerFacingEntity).setOffsetY(offsetStairs)); + addPlacementMapping(BlockTorch.class, new PlacementData(blockFacingOpposite)); + addPlacementMapping(BlockTrapDoor.class, new PlacementData(blockFacingOpposite).setOffsetY(offsetTrapDoor)); + + addPlacementMapping(Blocks.anvil, new PlacementData(playerFacingRotateY)); + addPlacementMapping(Blocks.end_portal_frame, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(Blocks.ladder, new PlacementData(blockFacingOpposite)); + addPlacementMapping(Blocks.lever, new PlacementData(playerFacingLever, blockFacingLever)); + addPlacementMapping(Blocks.quartz_block, new PlacementData(blockFacingQuartz)); + addPlacementMapping(Blocks.tripwire_hook, new PlacementData(blockFacingOpposite)); + + addPlacementMapping(Items.comparator, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(Items.repeater, new PlacementData(playerFacingEntityOpposite)); + + addPlacementMapping(Blocks.bed, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.end_portal, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.piston_extension, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.piston_head, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.portal, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.skull, new PlacementData(playerFacingIgnore)); + } + + private PlacementData addPlacementMapping(final Class clazz, final PlacementData data) { + if (clazz == null || data == null) { + return null; + } + + return this.classPlacementMap.put(clazz, data); + } + + private PlacementData addPlacementMapping(final Block block, final PlacementData data) { + if (block == null || data == null) { + return null; + } + + return this.blockPlacementMap.put(block, data); + } + + private PlacementData addPlacementMapping(final Item item, final PlacementData data) { + if (item == null || data == null) { + return null; + } + + return this.itemPlacementMap.put(item, data); + } + + public PlacementData getPlacementData(final IBlockState blockState, final ItemStack itemStack) { + final Item item = itemStack.getItem(); + + final PlacementData placementDataItem = this.itemPlacementMap.get(item); + if (placementDataItem != null) { + return placementDataItem; + } + + final Block block = blockState.getBlock(); + + final PlacementData placementDataBlock = this.blockPlacementMap.get(block); + if (placementDataBlock != null) { + return placementDataBlock; + } + + for (final Class clazz : this.classPlacementMap.keySet()) { + if (clazz.isInstance(block)) { + return this.classPlacementMap.get(clazz); + } + } + + return null; + } + + static { + INSTANCE.populateMappings(); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index d6ad4c16..e6da0f6d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -588,7 +588,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final BlockPos posChunk = renderChunk.getPosition(); this.renderInfos.add(renderInfo); - for (final EnumFacing side : EnumFacing.values()) { + for (final EnumFacing side : EnumFacing.VALUES) { final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, posChunk, side); final RenderOverlay neighborRenderOverlay = getNeighborRenderOverlay(posEye, posChunk, side); diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java new file mode 100644 index 00000000..c4117fff --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java @@ -0,0 +1,26 @@ +package com.github.lunatrius.schematica.client.util; + +import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; + +public class BlockStateToItemStack { + public static ItemStack getItemStack(final IBlockState blockState, final MovingObjectPosition movingObjectPosition, final SchematicWorld world, final BlockPos pos) { + final Block block = blockState.getBlock(); + + try { + final ItemStack itemStack = block.getPickBlock(movingObjectPosition, world, pos); + if (itemStack != null) { + return itemStack; + } + } catch (final Exception e) { + Reference.logger.debug("Could not get the pick block for: {}", blockState, e); + } + + return null; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index a61b1add..cc270d80 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -27,7 +27,7 @@ public class RotationHelper { public static final RotationHelper INSTANCE = new RotationHelper(); private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - private static final EnumFacing[][] FACINGS = new EnumFacing[EnumFacing.values().length][]; + private static final EnumFacing[][] FACINGS = new EnumFacing[EnumFacing.VALUES.length][]; private static final EnumFacing.Axis[][] AXISES = new EnumFacing.Axis[EnumFacing.Axis.values().length][]; private static final BlockLog.EnumAxis[][] AXISES_LOG = new BlockLog.EnumAxis[EnumFacing.Axis.values().length][]; private static final BlockQuartz.EnumType[][] AXISES_QUARTZ = new BlockQuartz.EnumType[EnumFacing.Axis.values().length][]; diff --git a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java b/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java deleted file mode 100644 index 564f5fad..00000000 --- a/src/main/java/com/github/lunatrius/schematica/config/BlockInfo.java +++ /dev/null @@ -1,366 +0,0 @@ -package com.github.lunatrius.schematica.config; - -import com.github.lunatrius.schematica.reference.Names; -import net.minecraft.block.Block; -import net.minecraft.block.BlockButton; -import net.minecraft.block.BlockChest; -import net.minecraft.block.BlockDispenser; -import net.minecraft.block.BlockEnderChest; -import net.minecraft.block.BlockFurnace; -import net.minecraft.block.BlockHopper; -import net.minecraft.block.BlockPistonBase; -import net.minecraft.block.BlockPumpkin; -import net.minecraft.block.BlockRotatedPillar; -import net.minecraft.block.BlockStairs; -import net.minecraft.block.BlockTorch; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.registry.GameData; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.github.lunatrius.schematica.config.PlacementData.PlacementType; - -public class BlockInfo { - public static final List BLOCK_LIST_IGNORE_BLOCK = new ArrayList(); - public static final List BLOCK_LIST_IGNORE_METADATA = new ArrayList(); - public static final Map BLOCK_ITEM_MAP = new HashMap(); - public static final Map CLASS_PLACEMENT_MAP = new HashMap(); - public static final Map ITEM_PLACEMENT_MAP = new HashMap(); - - private static String modId = Names.ModId.MINECRAFT; - - public static void setModId(String modId) { - BlockInfo.modId = modId; - } - - public static void populateIgnoredBlocks() { - BLOCK_LIST_IGNORE_BLOCK.clear(); - - /** - * minecraft - */ - addIgnoredBlock(Blocks.piston_head); - addIgnoredBlock(Blocks.piston_extension); - addIgnoredBlock(Blocks.portal); - addIgnoredBlock(Blocks.end_portal); - } - - private static boolean addIgnoredBlock(Block block) { - if (block == null) { - return false; - } - - return BLOCK_LIST_IGNORE_BLOCK.add(block); - } - - private static boolean addIgnoredBlock(String blockName) { - if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { - return false; - } - - return addIgnoredBlock(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); - } - - public static void populateIgnoredBlockMetadata() { - BLOCK_LIST_IGNORE_METADATA.clear(); - - /** - * minecraft - */ - addIgnoredBlockMetadata(Blocks.flowing_water); - addIgnoredBlockMetadata(Blocks.water); - addIgnoredBlockMetadata(Blocks.flowing_lava); - addIgnoredBlockMetadata(Blocks.lava); - addIgnoredBlockMetadata(Blocks.dispenser); - addIgnoredBlockMetadata(Blocks.bed); - addIgnoredBlockMetadata(Blocks.golden_rail); - addIgnoredBlockMetadata(Blocks.detector_rail); - addIgnoredBlockMetadata(Blocks.sticky_piston); - addIgnoredBlockMetadata(Blocks.piston); - addIgnoredBlockMetadata(Blocks.torch); - addIgnoredBlockMetadata(Blocks.oak_stairs); - addIgnoredBlockMetadata(Blocks.chest); - addIgnoredBlockMetadata(Blocks.redstone_wire); - addIgnoredBlockMetadata(Blocks.wheat); - addIgnoredBlockMetadata(Blocks.farmland); - addIgnoredBlockMetadata(Blocks.furnace); - addIgnoredBlockMetadata(Blocks.lit_furnace); - addIgnoredBlockMetadata(Blocks.standing_sign); - // TODO: addIgnoredBlockMetadata(Blocks.wooden_door); - addIgnoredBlockMetadata(Blocks.ladder); - addIgnoredBlockMetadata(Blocks.rail); - addIgnoredBlockMetadata(Blocks.stone_stairs); - addIgnoredBlockMetadata(Blocks.wall_sign); - addIgnoredBlockMetadata(Blocks.lever); - addIgnoredBlockMetadata(Blocks.stone_pressure_plate); - addIgnoredBlockMetadata(Blocks.iron_door); - addIgnoredBlockMetadata(Blocks.wooden_pressure_plate); - addIgnoredBlockMetadata(Blocks.unlit_redstone_torch); - addIgnoredBlockMetadata(Blocks.redstone_torch); - addIgnoredBlockMetadata(Blocks.stone_button); - addIgnoredBlockMetadata(Blocks.cactus); - addIgnoredBlockMetadata(Blocks.reeds); - addIgnoredBlockMetadata(Blocks.pumpkin); - addIgnoredBlockMetadata(Blocks.portal); - addIgnoredBlockMetadata(Blocks.lit_pumpkin); - addIgnoredBlockMetadata(Blocks.cake); - addIgnoredBlockMetadata(Blocks.unpowered_repeater); - addIgnoredBlockMetadata(Blocks.powered_repeater); - addIgnoredBlockMetadata(Blocks.trapdoor); - addIgnoredBlockMetadata(Blocks.vine); - // TODO: addIgnoredBlockMetadata(Blocks.fence_gate); - addIgnoredBlockMetadata(Blocks.brick_stairs); - addIgnoredBlockMetadata(Blocks.stone_brick_stairs); - addIgnoredBlockMetadata(Blocks.waterlily); - addIgnoredBlockMetadata(Blocks.nether_brick_stairs); - addIgnoredBlockMetadata(Blocks.nether_wart); - addIgnoredBlockMetadata(Blocks.end_portal_frame); - addIgnoredBlockMetadata(Blocks.redstone_lamp); - addIgnoredBlockMetadata(Blocks.lit_redstone_lamp); - addIgnoredBlockMetadata(Blocks.sandstone_stairs); - addIgnoredBlockMetadata(Blocks.ender_chest); - addIgnoredBlockMetadata(Blocks.tripwire_hook); - addIgnoredBlockMetadata(Blocks.tripwire); - addIgnoredBlockMetadata(Blocks.spruce_stairs); - addIgnoredBlockMetadata(Blocks.birch_stairs); - addIgnoredBlockMetadata(Blocks.jungle_stairs); - addIgnoredBlockMetadata(Blocks.command_block); - addIgnoredBlockMetadata(Blocks.flower_pot); - addIgnoredBlockMetadata(Blocks.carrots); - addIgnoredBlockMetadata(Blocks.potatoes); - addIgnoredBlockMetadata(Blocks.wooden_button); - addIgnoredBlockMetadata(Blocks.anvil); - addIgnoredBlockMetadata(Blocks.trapped_chest); - addIgnoredBlockMetadata(Blocks.hopper); - addIgnoredBlockMetadata(Blocks.quartz_stairs); - addIgnoredBlockMetadata(Blocks.dropper); - } - - private static boolean addIgnoredBlockMetadata(Block block) { - if (block == null) { - return false; - } - - return BLOCK_LIST_IGNORE_METADATA.add(block); - } - - private static boolean addIgnoredBlockMetadata(String blockName) { - if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { - return false; - } - - return addIgnoredBlockMetadata(GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockName))); - } - - public static void populateBlockItemMap() { - BLOCK_ITEM_MAP.clear(); - - /** - * minecraft - */ - addBlockItemMapping(Blocks.flowing_water, Items.water_bucket); - addBlockItemMapping(Blocks.water, Items.water_bucket); - addBlockItemMapping(Blocks.flowing_lava, Items.lava_bucket); - addBlockItemMapping(Blocks.lava, Items.lava_bucket); - addBlockItemMapping(Blocks.bed, Items.bed); - addBlockItemMapping(Blocks.redstone_wire, Items.redstone); - addBlockItemMapping(Blocks.wheat, Items.wheat_seeds); - addBlockItemMapping(Blocks.lit_furnace, Blocks.furnace); - addBlockItemMapping(Blocks.standing_sign, Items.sign); - // TODO: addBlockItemMapping(Blocks.wooden_door, Items.wooden_door); - addBlockItemMapping(Blocks.iron_door, Items.iron_door); - addBlockItemMapping(Blocks.wall_sign, Items.sign); - addBlockItemMapping(Blocks.unlit_redstone_torch, Blocks.redstone_torch); - addBlockItemMapping(Blocks.reeds, Items.reeds); - addBlockItemMapping(Blocks.unpowered_repeater, Items.repeater); - addBlockItemMapping(Blocks.powered_repeater, Items.repeater); - addBlockItemMapping(Blocks.pumpkin_stem, Items.pumpkin_seeds); - addBlockItemMapping(Blocks.melon_stem, Items.melon_seeds); - addBlockItemMapping(Blocks.nether_wart, Items.nether_wart); - addBlockItemMapping(Blocks.brewing_stand, Items.brewing_stand); - addBlockItemMapping(Blocks.cauldron, Items.cauldron); - addBlockItemMapping(Blocks.lit_redstone_lamp, Blocks.redstone_lamp); - addBlockItemMapping(Blocks.cocoa, Items.dye); - addBlockItemMapping(Blocks.tripwire, Items.string); - addBlockItemMapping(Blocks.flower_pot, Items.flower_pot); - addBlockItemMapping(Blocks.carrots, Items.carrot); - addBlockItemMapping(Blocks.potatoes, Items.potato); - addBlockItemMapping(Blocks.skull, Items.skull); - addBlockItemMapping(Blocks.unpowered_comparator, Items.comparator); - addBlockItemMapping(Blocks.powered_comparator, Items.comparator); - } - - private static Item addBlockItemMapping(Block block, Item item) { - if (block == null || item == null) { - return null; - } - - return BLOCK_ITEM_MAP.put(block, item); - } - - private static Item addBlockItemMapping(Block block, Block item) { - return addBlockItemMapping(block, Item.getItemFromBlock(item)); - } - - private static Item addBlockItemMapping(Object blockObj, Object itemObj) { - if (!Names.ModId.MINECRAFT.equals(modId) && !Loader.isModLoaded(modId)) { - return null; - } - - Block block = null; - Item item = null; - - if (blockObj instanceof Block) { - block = (Block) blockObj; - } else if (blockObj instanceof String) { - block = GameData.getBlockRegistry().getObject(String.format("%s:%s", modId, blockObj)); - } - - if (itemObj instanceof Item) { - item = (Item) itemObj; - } else if (itemObj instanceof Block) { - item = Item.getItemFromBlock((Block) itemObj); - } else if (itemObj instanceof String) { - String formattedName = String.format("%s:%s", modId, itemObj); - item = GameData.getItemRegistry().getObject(formattedName); - if (item == null) { - item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); - } - } - - return addBlockItemMapping(block, item); - } - - public static Item getItemFromBlock(Block block) { - Item item = BLOCK_ITEM_MAP.get(block); - if (item != null) { - return item; - } - - return Item.getItemFromBlock(block); - } - - public static void populatePlacementMaps() { - ITEM_PLACEMENT_MAP.clear(); - - /** - * minecraft - */ - addPlacementMapping(BlockButton.class, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); - addPlacementMapping(BlockChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(BlockDispenser.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockEnderChest.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(BlockFurnace.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(BlockHopper.class, new PlacementData(PlacementType.BLOCK, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockPistonBase.class, new PlacementData(PlacementType.PISTON, 0, 1, 2, 3, 4, 5).setMaskMeta(0x7)); - addPlacementMapping(BlockPumpkin.class, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0xF)); - addPlacementMapping(BlockRotatedPillar.class, new PlacementData(PlacementType.BLOCK, 0, 0, 8, 8, 4, 4).setMaskMeta(0xC).setMaskMetaInHand(0x3)); - addPlacementMapping(BlockStairs.class, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 2, 1, 0).setOffset(0x4, 0.0f, 1.0f).setMaskMeta(0x3)); - addPlacementMapping(BlockTorch.class, new PlacementData(PlacementType.BLOCK, 5, -1, 3, 4, 1, 2).setMaskMeta(0xF)); - - addPlacementMapping(Blocks.dirt, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.planks, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.sandstone, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.wool, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.yellow_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.red_flower, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.double_stone_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.stone_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); - addPlacementMapping(Blocks.stained_glass, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.ladder, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 2, 5, 4)); - addPlacementMapping(Blocks.lever, new PlacementData(PlacementType.BLOCK, -1, -1, 3, 4, 1, 2).setMaskMeta(0x7)); - addPlacementMapping(Blocks.snow_layer, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0x7)); - addPlacementMapping(Blocks.trapdoor, new PlacementData(PlacementType.BLOCK, -1, -1, 1, 0, 3, 2).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x3)); - addPlacementMapping(Blocks.monster_egg, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.stonebrick, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.tripwire_hook, new PlacementData(PlacementType.BLOCK, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); - addPlacementMapping(Blocks.quartz_block, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - // TODO: addPlacementMapping(Blocks.fence_gate, new PlacementData(PlacementType.PLAYER, -1, -1, 2, 0, 1, 3).setMaskMeta(0x3)); - addPlacementMapping(Blocks.double_wooden_slab, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.wooden_slab, new PlacementData(PlacementType.BLOCK).setOffset(0x8, 0.0f, 1.0f).setMaskMeta(0x7).setMaskMetaInHand(0x7)); - addPlacementMapping(Blocks.anvil, new PlacementData(PlacementType.PLAYER, -1, -1, 1, 3, 0, 2).setMaskMeta(0x3).setMaskMetaInHand(0xC).setBitShiftMetaInHand(2)); - addPlacementMapping(Blocks.stained_hardened_clay, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.carpet, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - addPlacementMapping(Blocks.stained_glass_pane, new PlacementData(PlacementType.BLOCK).setMaskMetaInHand(0xF)); - // TODO: addPlacementMapping(Items.wooden_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); - addPlacementMapping(Items.iron_door, new PlacementData(PlacementType.PLAYER, -1, -1, 3, 1, 2, 0).setMaskMeta(0x7)); - addPlacementMapping(Items.repeater, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); - addPlacementMapping(Items.comparator, new PlacementData(PlacementType.PLAYER, -1, -1, 0, 2, 3, 1).setMaskMeta(0x3)); - } - - public static PlacementData addPlacementMapping(Class clazz, PlacementData data) { - if (clazz == null || data == null) { - return null; - } - - return CLASS_PLACEMENT_MAP.put(clazz, data); - } - - public static PlacementData addPlacementMapping(Item item, PlacementData data) { - if (item == null || data == null) { - return null; - } - - return ITEM_PLACEMENT_MAP.put(item, data); - } - - public static PlacementData addPlacementMapping(Block block, PlacementData data) { - return addPlacementMapping(Item.getItemFromBlock(block), data); - } - - public static PlacementData addPlacementMapping(Object itemObj, PlacementData data) { - if (itemObj == null || data == null) { - return null; - } - - Item item = null; - - if (itemObj instanceof Item) { - item = (Item) itemObj; - } else if (itemObj instanceof Block) { - item = Item.getItemFromBlock((Block) itemObj); - } else if (itemObj instanceof String) { - String formattedName = String.format("%s:%s", modId, itemObj); - item = GameData.getItemRegistry().getObject(formattedName); - if (item == null) { - item = Item.getItemFromBlock(GameData.getBlockRegistry().getObject(formattedName)); - } - } - - return addPlacementMapping(item, data); - } - - public static PlacementData getPlacementDataFromItem(Item item) { - Block block = Block.getBlockFromItem(item); - PlacementData data = null; - - for (Class clazz : CLASS_PLACEMENT_MAP.keySet()) { - if (clazz.isInstance(block)) { - data = CLASS_PLACEMENT_MAP.get(clazz); - break; - } - } - - for (Item i : ITEM_PLACEMENT_MAP.keySet()) { - if (i == item) { - data = ITEM_PLACEMENT_MAP.get(i); - break; - } - } - - return data; - } - - static { - populateIgnoredBlocks(); - populateIgnoredBlockMetadata(); - populateBlockItemMap(); - populatePlacementMaps(); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java deleted file mode 100644 index c0e1ef0a..00000000 --- a/src/main/java/com/github/lunatrius/schematica/config/PlacementData.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.github.lunatrius.schematica.config; - -import net.minecraft.util.EnumFacing; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class PlacementData { - public static enum PlacementType { - BLOCK, PLAYER, PISTON - } - - public static final EnumFacing[] VALID_DIRECTIONS = EnumFacing.values(); - - public final PlacementType type; - public int maskOffset = 0x0; - public float offsetLowY = 0.0f; - public float offsetHighY = 1.0f; - public int maskMetaInHand = -1; - public int bitShiftMetaInHand = 0; - public int maskMeta = 0xF; - public final Map mapping = new HashMap(); - - public PlacementData(PlacementType type, int... metadata) { - this.type = type; - - for (int i = 0; i < VALID_DIRECTIONS.length && i < metadata.length; i++) { - if (metadata[i] >= 0x0 && metadata[i] <= 0xF) { - this.mapping.put(VALID_DIRECTIONS[i], metadata[i]); - } - } - } - - public PlacementData setOffset(int maskOffset, float offsetLowY, float offsetHighY) { - this.maskOffset = maskOffset; - this.offsetLowY = offsetLowY; - this.offsetHighY = offsetHighY; - return this; - } - - public PlacementData setMaskMetaInHand(int maskMetaInHand) { - this.maskMetaInHand = maskMetaInHand; - return this; - } - - public PlacementData setBitShiftMetaInHand(int bitShiftMetaInHand) { - this.bitShiftMetaInHand = bitShiftMetaInHand; - return this; - } - - public PlacementData setMaskMeta(int maskMeta) { - this.maskMeta = maskMeta; - return this; - } - - public float getOffsetFromMetadata(int metadata) { - return (metadata & this.maskOffset) == 0 ? this.offsetLowY : this.offsetHighY; - } - - public int getMetaInHand(int metadata) { - if (this.maskMetaInHand != -1) { - metadata &= this.maskMetaInHand; - } - - if (this.bitShiftMetaInHand > 0) { - metadata >>= this.bitShiftMetaInHand; - } else if (this.bitShiftMetaInHand < 0) { - metadata <<= -this.bitShiftMetaInHand; - } - - return metadata; - } - - public EnumFacing[] getValidDirections(EnumFacing[] solidSides, int metadata) { - List list = new ArrayList(); - - for (EnumFacing direction : solidSides) { - if (this.maskOffset != 0) { - if ((metadata & this.maskOffset) == 0) { - if (this.offsetLowY < 0.5f && direction == EnumFacing.UP) { - continue; - } - } else { - if (this.offsetLowY < 0.5f && direction == EnumFacing.DOWN) { - continue; - } - } - } - - if (this.type == PlacementType.BLOCK) { - Integer meta = this.mapping.get(direction); - if ((meta != null ? meta : -1) != (this.maskMeta & metadata) && this.mapping.size() != 0) { - continue; - } - } - - list.add(direction); - } - - EnumFacing[] directions = new EnumFacing[list.size()]; - return list.toArray(directions); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java index 47e54eb5..8779b22b 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Constants.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Constants.java @@ -1,6 +1,29 @@ package com.github.lunatrius.schematica.reference; public final class Constants { + public static final class Inventory { + public static final class Size { + public static final int CRAFTING_OUT = 1; + public static final int CRAFTING_IN = 4; + public static final int ARMOR = 4; + public static final int INVENTORY = 3 * 9; + public static final int HOTBAR = 9; + } + + public static final class SlotOffset { + public static final int CRAFTING_OUT = 0; + public static final int CRAFTING_IN = CRAFTING_OUT + Size.CRAFTING_OUT; + public static final int ARMOR = CRAFTING_IN + Size.CRAFTING_IN; + public static final int INVENTORY = ARMOR + Size.ARMOR; + public static final int HOTBAR = INVENTORY + Size.INVENTORY; + } + + public static final class InventoryOffset { + public static final int HOTBAR = 0; + public static final int INVENTORY = HOTBAR + 9; + } + } + public static final class Network { public static final int TIMEOUT = 15 * 20; public static final int RETRIES = 5; diff --git a/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java new file mode 100644 index 00000000..f546fd00 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java @@ -0,0 +1,27 @@ +package com.github.lunatrius.schematica.util; + +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; + +import java.util.Set; + +public class BlockStateHelper { + public static IProperty getProperty(final IBlockState blockState, final String name) { + for (final IProperty prop : (Set) blockState.getProperties().keySet()) { + if (prop.getName().equals(name)) { + return prop; + } + } + + return null; + } + + public static T getPropertyValue(final IBlockState blockState, final String name) { + final IProperty property = getProperty(blockState, name); + if (property == null) { + throw new IllegalArgumentException(name + " does not exist in " + blockState); + } + + return (T) blockState.getValue(property); + } +} From 064972b85b9bc6001ac70f15e23ab47dd931e92e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 25 Mar 2015 16:59:54 +0100 Subject: [PATCH 213/314] Replaced the SchematicaMapping tag with a more standard Mapping tag (compatibility with WorldEdit and RecurrentComplex). --- .../github/lunatrius/schematica/reference/Names.java | 1 + .../schematica/world/schematic/SchematicAlpha.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index ed916857..9c39d1ec 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -203,6 +203,7 @@ public static final class NBT { public static final String WIDTH = "Width"; public static final String LENGTH = "Length"; public static final String HEIGHT = "Height"; + public static final String MAPPING = "Mapping"; public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; public static final String TILE_ENTITIES = "TileEntities"; public static final String ENTITIES = "Entities"; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 437b331d..74cdc9bf 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -57,7 +57,13 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { Short id = null; Map oldToNew = new HashMap(); - if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { + if (tagCompound.hasKey(Names.NBT.MAPPING)) { + NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING); + Set names = mapping.getKeySet(); + for (String name : names) { + oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(name)); + } + } else if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); Set names = mapping.getKeySet(); for (String name : names) { @@ -205,7 +211,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { } tagCompound.setTag(Names.NBT.ENTITIES, entityList); tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); - tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, nbtMapping); + tagCompound.setTag(Names.NBT.MAPPING, nbtMapping); final NBTTagCompound extendedMetadata = event.extendedMetadata; if (!extendedMetadata.hasNoTags()) { tagCompound.setTag(Names.NBT.EXTENDED_METADATA, extendedMetadata); From 2444b13bd1dbced3222056fa1027a8c2ab898855 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 26 Mar 2015 12:33:18 +0100 Subject: [PATCH 214/314] Revert "Replaced the SchematicaMapping tag with a more standard Mapping tag (compatibility with WorldEdit and RecurrentComplex)." This reverts commit 064972b85b9bc6001ac70f15e23ab47dd931e92e. --- .../github/lunatrius/schematica/reference/Names.java | 1 - .../schematica/world/schematic/SchematicAlpha.java | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 9c39d1ec..ed916857 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -203,7 +203,6 @@ public static final class NBT { public static final String WIDTH = "Width"; public static final String LENGTH = "Length"; public static final String HEIGHT = "Height"; - public static final String MAPPING = "Mapping"; public static final String MAPPING_SCHEMATICA = "SchematicaMapping"; public static final String TILE_ENTITIES = "TileEntities"; public static final String ENTITIES = "Entities"; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 74cdc9bf..437b331d 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -57,13 +57,7 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { Short id = null; Map oldToNew = new HashMap(); - if (tagCompound.hasKey(Names.NBT.MAPPING)) { - NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING); - Set names = mapping.getKeySet(); - for (String name : names) { - oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(name)); - } - } else if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { + if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); Set names = mapping.getKeySet(); for (String name : names) { @@ -211,7 +205,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { } tagCompound.setTag(Names.NBT.ENTITIES, entityList); tagCompound.setTag(Names.NBT.TILE_ENTITIES, tileEntitiesList); - tagCompound.setTag(Names.NBT.MAPPING, nbtMapping); + tagCompound.setTag(Names.NBT.MAPPING_SCHEMATICA, nbtMapping); final NBTTagCompound extendedMetadata = event.extendedMetadata; if (!extendedMetadata.hasNoTags()) { tagCompound.setTag(Names.NBT.EXTENDED_METADATA, extendedMetadata); From dcdbfb0c7eb2852b02b0d95f334a777b8b30c791 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Mar 2015 16:10:09 +0100 Subject: [PATCH 215/314] Fixed the printer not placing blocks for some users. --- .../schematica/client/printer/SchematicPrinter.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 34585169..bc31bd49 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -284,20 +284,17 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, boolean success = false; final BlockPos offset = new BlockPos(pos).offset(direction); - final EnumFacing side = direction.getOpposite(); - // copypasted from n.m.client.Minecraft to sooth finicky servers - success = !ForgeEventFactory.onPlayerInteract(this.minecraft.thePlayer, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); + success = !ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); if (success) { - // still not assured! - success = this.minecraft.playerController.onPlayerRightClick(player, world, itemStack, pos, side, new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ)); + success = this.minecraft.playerController.onPlayerRightClick(player, world, itemStack, offset, side, new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ)); if (success) { - // yes, some servers actually care about this. - this.minecraft.thePlayer.swingItem(); + player.swingItem(); } } + if (itemStack != null && itemStack.stackSize == 0 && success) { player.inventory.mainInventory[player.inventory.currentItem] = null; } From 5db2958c2c76608198e278a15951194aa0e7e367 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Mar 2015 16:11:01 +0100 Subject: [PATCH 216/314] Added cocoa beans to the placement registry. --- .../printer/registry/PlacementRegistry.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index fbe26e8a..43368bfc 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -176,6 +176,26 @@ public List getValidBlockFacings(final List solidSides, return list; } }; + final IValidBlockFacing blockFacingSame = new IValidBlockFacing() { + @Override + public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { + final List list = new ArrayList(); + + final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); + if (propertyFacing != null && propertyFacing.getValueClass().equals(EnumFacing.class)) { + final EnumFacing facing = (EnumFacing) blockState.getValue(propertyFacing); + for (final EnumFacing side : solidSides) { + if (facing != side) { + continue; + } + + list.add(side); + } + } + + return list; + } + }; final IValidBlockFacing blockFacingHopper = new IValidBlockFacing() { @Override public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { @@ -255,6 +275,7 @@ public List getValidBlockFacings(final List solidSides, addPlacementMapping(BlockTrapDoor.class, new PlacementData(blockFacingOpposite).setOffsetY(offsetTrapDoor)); addPlacementMapping(Blocks.anvil, new PlacementData(playerFacingRotateY)); + addPlacementMapping(Blocks.cocoa, new PlacementData(blockFacingSame)); addPlacementMapping(Blocks.end_portal_frame, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(Blocks.ladder, new PlacementData(blockFacingOpposite)); addPlacementMapping(Blocks.lever, new PlacementData(playerFacingLever, blockFacingLever)); From f2307b282349f4ce6ce88aeb9836525c5475e1f6 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Mar 2015 16:33:55 +0100 Subject: [PATCH 217/314] Do not render tile entities if the block is not an air block. --- .../lunatrius/schematica/client/renderer/RenderSchematic.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index e6da0f6d..62d59fc6 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -452,6 +452,10 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, continue; } + if (!this.mc.theWorld.isAirBlock(tileEntity.getPos().add(this.world.position))) { + continue; + } + TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks, -1); this.countTileEntitiesRendered++; } From e1fab45b44d7eb78d28e5b148e9a69ad2b1753e6 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 27 Mar 2015 16:34:14 +0100 Subject: [PATCH 218/314] Added banners to the ignore list. --- .../schematica/client/printer/registry/PlacementRegistry.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 43368bfc..2a93a011 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -291,6 +291,8 @@ public List getValidBlockFacings(final List solidSides, addPlacementMapping(Blocks.piston_head, new PlacementData(playerFacingIgnore)); addPlacementMapping(Blocks.portal, new PlacementData(playerFacingIgnore)); addPlacementMapping(Blocks.skull, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.standing_banner, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.wall_banner, new PlacementData(playerFacingIgnore)); } private PlacementData addPlacementMapping(final Class clazz, final PlacementData data) { From 1a7fe45ec8c176efcbb986026c38b13066d2236e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 13 Apr 2015 00:57:55 +0200 Subject: [PATCH 219/314] Do not pass MBlockPos directly into the place method, it can freeze the client on survival under certain conditions. --- .../lunatrius/schematica/client/printer/SchematicPrinter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index bc31bd49..7ee6d017 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -100,6 +100,7 @@ public boolean print() { final int slot = player.inventory.currentItem; final boolean isSneaking = player.isSneaking(); + // TODO: clean up the loop, BlockPos.getAllInBox is not suitable due to the x, y, z iteration instead of y, x, z final MBlockPos pos = new MBlockPos(); final boolean isRenderingLayer = this.schematic.isRenderingLayer; @@ -112,7 +113,7 @@ public boolean print() { for (pos.x = minX; pos.x < maxX; pos.x++) { for (pos.z = minZ; pos.z < maxZ; pos.z++) { try { - if (placeBlock(world, player, pos)) { + if (placeBlock(world, player, new BlockPos(pos))) { player.inventory.currentItem = slot; syncSneaking(player, isSneaking); return true; From 1855377d0b3a92a9db76ebe3a494c5a51a6bf428 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 19 Apr 2015 17:08:13 +0200 Subject: [PATCH 220/314] Removed explicit conversion to BlockPos (passed in argument is already BlockPos). --- .../lunatrius/schematica/client/printer/SchematicPrinter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 7ee6d017..42bad08b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -194,7 +194,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, } private boolean isSolid(final World world, final BlockPos pos, final EnumFacing side) { - final BlockPos offset = new BlockPos(pos).offset(side); + final BlockPos offset = pos.offset(side); final IBlockState blockState = world.getBlockState(offset); final Block block = blockState.getBlock(); @@ -284,7 +284,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack = player.getCurrentEquippedItem(); boolean success = false; - final BlockPos offset = new BlockPos(pos).offset(direction); + final BlockPos offset = pos.offset(direction); final EnumFacing side = direction.getOpposite(); success = !ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); From 57fbd04af19800fb8d39bae5b12e00ce49af5ede Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 19 Apr 2015 22:00:21 +0200 Subject: [PATCH 221/314] Fixed schematic blocks sometimes rendering even though they should not be. --- gradle.properties | 4 +-- .../SchematicBlockRendererDispatcher.java | 30 ------------------- .../client/renderer/SchematicRenderCache.java | 29 ++++++++++++++++++ .../chunk/proxy/SchematicRenderChunkList.java | 18 +++-------- .../chunk/proxy/SchematicRenderChunkVbo.java | 18 +++-------- .../schematica/proxy/ClientProxy.java | 17 ----------- 6 files changed, 39 insertions(+), 77 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java diff --git a/gradle.properties b/gradle.properties index 1cadc2c8..613d74e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ version_major=1 version_minor=7 version_micro=6 version_minecraft=1.8 -version_forge=11.14.1.1329 -version_minforge=11.14.1.1317 +version_forge=11.14.1.1390 +version_minforge=11.14.1.1390 version_mappings=stable_16 version_lunatriuscore=1.1.2.26 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java deleted file mode 100644 index 32a13d59..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicBlockRendererDispatcher.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.github.lunatrius.schematica.client.renderer; - -import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.github.lunatrius.schematica.proxy.ClientProxy; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.BlockModelShapes; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.BlockPos; -import net.minecraft.world.IBlockAccess; - -public class SchematicBlockRendererDispatcher extends BlockRendererDispatcher { - private final Minecraft minecraft = Minecraft.getMinecraft(); - - public SchematicBlockRendererDispatcher(final BlockModelShapes blockModelShapes, final GameSettings gameSettings) { - super(blockModelShapes, gameSettings); - } - - @Override - public boolean renderBlock(final IBlockState blockState, final BlockPos pos, final IBlockAccess blockAccess, final WorldRenderer worldRenderer) { - final SchematicWorld schematic = ClientProxy.schematic; - final BlockPos realPos = new BlockPos(pos.getX() + schematic.position.x, pos.getY() + schematic.position.y, pos.getZ() + schematic.position.z); - final WorldClient world = this.minecraft.theWorld; - - return world.isAirBlock(realPos) && super.renderBlock(blockState, pos, blockAccess, worldRenderer); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java new file mode 100644 index 00000000..5b1679a0 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -0,0 +1,29 @@ +package com.github.lunatrius.schematica.client.renderer; + +import com.github.lunatrius.schematica.proxy.ClientProxy; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RegionRenderCache; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class SchematicRenderCache extends RegionRenderCache { + private final Minecraft minecraft = Minecraft.getMinecraft(); + + public SchematicRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { + super(world, from, to, subtract); + } + + @Override + public IBlockState getBlockState(final BlockPos pos) { + final BlockPos realPos = pos.add(ClientProxy.schematic.position); + final World world = this.minecraft.theWorld; + + if (!world.isAirBlock(realPos)) { + return Blocks.air.getDefaultState(); + } + + return super.getBlockState(pos); + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java index cf5b775d..58e2208a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -1,15 +1,14 @@ package com.github.lunatrius.schematica.client.renderer.chunk.proxy; +import com.github.lunatrius.schematica.client.renderer.SchematicRenderCache; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.github.lunatrius.schematica.proxy.ClientProxy; +import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.ListedRenderChunk; import net.minecraft.client.renderer.chunk.SetVisibility; import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -48,16 +47,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } @Override - public void preRenderBlocks(final WorldRenderer worldRendererIn, final BlockPos pos) { - ClientProxy.setDispatcherSchematic(); - - super.preRenderBlocks(worldRendererIn, pos); - } - - @Override - public void postRenderBlocks(final EnumWorldBlockLayer layer, final float x, final float y, final float z, final WorldRenderer worldRenderer, final CompiledChunk compiledChunk) { - super.postRenderBlocks(layer, x, y, z, worldRenderer, compiledChunk); - - ClientProxy.setDispatcherVanilla(); + protected RegionRenderCache createRegionRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { + return new SchematicRenderCache(world, from, to, subtract); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java index 1ac96b70..78a53380 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -1,15 +1,14 @@ package com.github.lunatrius.schematica.client.renderer.chunk.proxy; +import com.github.lunatrius.schematica.client.renderer.SchematicRenderCache; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.github.lunatrius.schematica.proxy.ClientProxy; +import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.SetVisibility; import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -48,16 +47,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } @Override - public void preRenderBlocks(final WorldRenderer worldRendererIn, final BlockPos pos) { - ClientProxy.setDispatcherSchematic(); - - super.preRenderBlocks(worldRendererIn, pos); - } - - @Override - public void postRenderBlocks(final EnumWorldBlockLayer layer, final float x, final float y, final float z, final WorldRenderer worldRenderer, final CompiledChunk compiledChunk) { - super.postRenderBlocks(layer, x, y, z, worldRenderer, compiledChunk); - - ClientProxy.setDispatcherVanilla(); + protected RegionRenderCache createRegionRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { + return new SchematicRenderCache(world, from, to, subtract); } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 749e2155..4722bd19 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -5,7 +5,6 @@ import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; -import com.github.lunatrius.schematica.client.renderer.SchematicBlockRendererDispatcher; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; @@ -16,8 +15,6 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; @@ -55,8 +52,6 @@ public class ClientProxy extends CommonProxy { public static MovingObjectPosition movingObjectPosition = null; private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); - private static BlockRendererDispatcher dispatcherVanilla = null; - private static BlockRendererDispatcher dispatcherSchematic = null; public static void setPlayerData(EntityPlayer player, float partialTicks) { playerPosition.x = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; @@ -152,14 +147,6 @@ public static void moveSchematicToPlayer(SchematicWorld schematic) { } } - public static void setDispatcherSchematic() { - MINECRAFT.blockRenderDispatcher = dispatcherSchematic; - } - - public static void setDispatcherVanilla() { - MINECRAFT.blockRenderDispatcher = dispatcherVanilla; - } - @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); @@ -200,10 +187,6 @@ public void init(FMLInitializationEvent event) { public void postInit(FMLPostInitializationEvent event) { super.postInit(event); - dispatcherVanilla = MINECRAFT.getBlockRendererDispatcher(); - dispatcherSchematic = new SchematicBlockRendererDispatcher(dispatcherVanilla.getBlockModelShapes(), MINECRAFT.gameSettings); - ((IReloadableResourceManager) MINECRAFT.getResourceManager()).registerReloadListener(dispatcherSchematic); - resetSettings(); } From 926e5d2c8c98fd2f498cefae776f4f3cb7499618 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 9 May 2015 21:07:50 +0200 Subject: [PATCH 222/314] Simplified slot swapping. --- .../client/printer/SchematicPrinter.java | 33 ++----------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 42bad08b..cdfecd9c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -347,8 +347,7 @@ private boolean swapSlots(final InventoryPlayer inventory, final int from) { if (ConfigurationHandler.swapSlotsQueue.size() > 0) { final int slot = getNextSlot(); - final ItemStack itemStack = inventory.mainInventory[slot + Constants.Inventory.InventoryOffset.HOTBAR]; - swapSlots(from, slot, itemStack == null || itemStack.stackSize == 0); + swapSlots(from, slot); return true; } @@ -361,33 +360,7 @@ private int getNextSlot() { return slot; } - private boolean swapSlots(int from, int to, final boolean targetEmpty) { - if (from >= Constants.Inventory.InventoryOffset.HOTBAR && from < Constants.Inventory.InventoryOffset.HOTBAR + Constants.Inventory.Size.HOTBAR) { - from = Constants.Inventory.SlotOffset.HOTBAR + (from - Constants.Inventory.InventoryOffset.HOTBAR); - } else if (from >= Constants.Inventory.InventoryOffset.INVENTORY && from < Constants.Inventory.InventoryOffset.INVENTORY + Constants.Inventory.Size.INVENTORY) { - from = Constants.Inventory.SlotOffset.INVENTORY + (from - Constants.Inventory.InventoryOffset.INVENTORY); - } else { - return false; - } - - if (to >= Constants.Inventory.InventoryOffset.HOTBAR && to < Constants.Inventory.InventoryOffset.HOTBAR + Constants.Inventory.Size.HOTBAR) { - to = Constants.Inventory.SlotOffset.HOTBAR + (to - Constants.Inventory.InventoryOffset.HOTBAR); - } else if (to >= Constants.Inventory.InventoryOffset.INVENTORY && to < Constants.Inventory.InventoryOffset.INVENTORY + Constants.Inventory.Size.INVENTORY) { - to = Constants.Inventory.SlotOffset.INVENTORY + (to - Constants.Inventory.InventoryOffset.INVENTORY); - } else { - return false; - } - - clickSlot(from); - clickSlot(to); - if (!targetEmpty) { - clickSlot(from); - } - - return true; - } - - private ItemStack clickSlot(final int slot) { - return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, slot, 0, 0, this.minecraft.thePlayer); + private boolean swapSlots(final int from, final int to) { + return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, from, to, 2, this.minecraft.thePlayer) == null; } } From 18be4258179968981c9d86a899dfa6b10f7d2a56 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 15 May 2015 15:31:43 +0200 Subject: [PATCH 223/314] Added the schematic instance/context to PreSchematicSaveEvent. --- .../schematica/api/event/PreSchematicSaveEvent.java | 12 ++++++++++++ .../lunatrius/schematica/api/event/package-info.java | 2 +- .../schematica/world/schematic/SchematicAlpha.java | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java index c31cce88..ab3880d5 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.api.event; +import com.github.lunatrius.schematica.api.ISchematic; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fml.common.eventhandler.Event; @@ -13,12 +14,23 @@ public class PreSchematicSaveEvent extends Event { private final Map mappings; + /** + * The schematic that will be saved. + */ + public final ISchematic schematic; + /** * The Extended Metadata tag compound provides a facility to add custom metadata to the schematic. */ public final NBTTagCompound extendedMetadata; + @Deprecated public PreSchematicSaveEvent(Map mappings) { + this(null, mappings); + } + + public PreSchematicSaveEvent(ISchematic schematic, Map mappings) { + this.schematic = schematic; this.mappings = mappings; this.extendedMetadata = new NBTTagCompound(); } diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java index 13ff4d6f..6066bb87 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/package-info.java @@ -1,4 +1,4 @@ -@API(owner = "SchematicaAPI", apiVersion = "1.0", provides = "SchematicaAPI|Events") +@API(owner = "SchematicaAPI", apiVersion = "1.1", provides = "SchematicaAPI|Events") package com.github.lunatrius.schematica.api.event; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 437b331d..67547d93 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -189,7 +189,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { } } - PreSchematicSaveEvent event = new PreSchematicSaveEvent(mappings); + PreSchematicSaveEvent event = new PreSchematicSaveEvent(schematic, mappings); MinecraftForge.EVENT_BUS.post(event); NBTTagCompound nbtMapping = new NBTTagCompound(); From a0fcc6ade99c7375c72cc02900af9f59933b0541 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 25 May 2015 19:54:01 +0200 Subject: [PATCH 224/314] Replaced the coordinate loops with an YXZ iterator. --- build.gradle | 1 + gradle.properties | 2 +- .../client/printer/SchematicPrinter.java | 57 +++++++++---------- .../client/util/RotationHelper.java | 3 +- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/build.gradle b/build.gradle index 08879a35..21b38313 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,7 @@ compileJava.options.encoding = 'UTF-8' idea { module { downloadSources = true + inheritOutputDirs = true } } diff --git a/gradle.properties b/gradle.properties index 613d74e6..08e2771c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ version_minecraft=1.8 version_forge=11.14.1.1390 version_minforge=11.14.1.1390 version_mappings=stable_16 -version_lunatriuscore=1.1.2.26 +version_lunatriuscore=1.1.2.28 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index cdfecd9c..989a38bf 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.printer; +import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.client.printer.registry.PlacementData; @@ -87,50 +88,48 @@ public boolean print() { final EntityPlayerSP player = this.minecraft.thePlayer; final WorldClient world = this.minecraft.theWorld; - syncSneaking(player, true); - final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); - final int minX = Math.max(0, trans.x - 3); - final int maxX = Math.min(this.schematic.getWidth(), trans.x + 4); - final int minY = Math.max(0, trans.y - 3); - final int maxY = Math.min(this.schematic.getHeight(), trans.y + 4); - final int minZ = Math.max(0, trans.z - 3); - final int maxZ = Math.min(this.schematic.getLength(), trans.z + 4); + int minX = Math.max(0, trans.x - 3); + int maxX = Math.min(this.schematic.getWidth(), trans.x + 4); + int minY = Math.max(0, trans.y - 3); + int maxY = Math.min(this.schematic.getHeight(), trans.y + 4); + int minZ = Math.max(0, trans.z - 3); + int maxZ = Math.min(this.schematic.getLength(), trans.z + 4); final int slot = player.inventory.currentItem; final boolean isSneaking = player.isSneaking(); - // TODO: clean up the loop, BlockPos.getAllInBox is not suitable due to the x, y, z iteration instead of y, x, z - final MBlockPos pos = new MBlockPos(); - final boolean isRenderingLayer = this.schematic.isRenderingLayer; final int renderingLayer = this.schematic.renderingLayer; - for (pos.y = minY; pos.y < maxY; pos.y++) { - if (isRenderingLayer && pos.y != renderingLayer) { - continue; + + if (isRenderingLayer) { + if (renderingLayer > maxY || renderingLayer < minY) { + return false; } - for (pos.x = minX; pos.x < maxX; pos.x++) { - for (pos.z = minZ; pos.z < maxZ; pos.z++) { - try { - if (placeBlock(world, player, new BlockPos(pos))) { - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return true; - } - } catch (Exception e) { - Reference.logger.error("Could not place block!", e); - player.inventory.currentItem = slot; - syncSneaking(player, isSneaking); - return false; - } + minY = maxY = renderingLayer; + } + + syncSneaking(player, true); + + for (final MBlockPos pos : BlockPosHelper.getAllInBoxYXZ(minX, minY, minZ, maxX, maxY, maxZ)) { + try { + if (placeBlock(world, player, pos)) { + return syncSlotAndSneaking(player, slot, isSneaking, true); } + } catch (Exception e) { + Reference.logger.error("Could not place block!", e); + return syncSlotAndSneaking(player, slot, isSneaking, false); } } + return syncSlotAndSneaking(player, slot, isSneaking, true); + } + + private boolean syncSlotAndSneaking(final EntityPlayerSP player, final int slot, final boolean isSneaking, final boolean success) { player.inventory.currentItem = slot; syncSneaking(player, isSneaking); - return true; + return success; } private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index cc270d80..8cf7f033 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.util; +import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.client.world.SchematicWorld; @@ -92,7 +93,7 @@ public Schematic rotate(final ISchematic schematic, final EnumFacing axis, boole final Schematic schematicRotated = new Schematic(schematic.getIcon(), dimensionsRotated.getX(), dimensionsRotated.getY(), dimensionsRotated.getZ()); final MBlockPos tmp = new MBlockPos(); - for (final MBlockPos pos : MBlockPos.getAllInRange(BlockPos.ORIGIN, new BlockPos(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1))) { + for (final MBlockPos pos : BlockPosHelper.getAllInBox(0, 0, 0, schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1)) { final IBlockState blockState = schematic.getBlockState(pos); final IBlockState blockStateRotated = rotateBlock(blockState, axis, forced); schematicRotated.setBlockState(rotatePos(pos, axis, dimensionsRotated, tmp), blockStateRotated); From e567d200818225ead9b90b0b0dc72d3d97fcb83e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 25 May 2015 20:10:48 +0200 Subject: [PATCH 225/314] Reverted the build mode back to layers instead of columns, corrected the schematic bounds. --- .../lunatrius/schematica/client/printer/SchematicPrinter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 989a38bf..1921af66 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -112,7 +112,7 @@ public boolean print() { syncSneaking(player, true); - for (final MBlockPos pos : BlockPosHelper.getAllInBoxYXZ(minX, minY, minZ, maxX, maxY, maxZ)) { + for (final MBlockPos pos : BlockPosHelper.getAllInBoxXZY(minX, minY, minZ, maxX - 1, maxY - 1, maxZ - 1)) { try { if (placeBlock(world, player, pos)) { return syncSlotAndSneaking(player, slot, isSneaking, true); From 93201445ef3cd7aaf53381a1f62ceba965366803 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 25 May 2015 20:17:18 +0200 Subject: [PATCH 226/314] Actually corrected the schematic bounds for the printer... --- .../schematica/client/printer/SchematicPrinter.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 1921af66..3d1a7fc1 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -90,11 +90,15 @@ public boolean print() { final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); int minX = Math.max(0, trans.x - 3); - int maxX = Math.min(this.schematic.getWidth(), trans.x + 4); + int maxX = Math.min(this.schematic.getWidth() - 1, trans.x + 3); int minY = Math.max(0, trans.y - 3); - int maxY = Math.min(this.schematic.getHeight(), trans.y + 4); + int maxY = Math.min(this.schematic.getHeight() - 1, trans.y + 3); int minZ = Math.max(0, trans.z - 3); - int maxZ = Math.min(this.schematic.getLength(), trans.z + 4); + int maxZ = Math.min(this.schematic.getLength() - 1, trans.z + 3); + + if (minX > maxX || minY > maxY || minZ > maxZ) { + return false; + } final int slot = player.inventory.currentItem; final boolean isSneaking = player.isSneaking(); @@ -112,7 +116,7 @@ public boolean print() { syncSneaking(player, true); - for (final MBlockPos pos : BlockPosHelper.getAllInBoxXZY(minX, minY, minZ, maxX - 1, maxY - 1, maxZ - 1)) { + for (final MBlockPos pos : BlockPosHelper.getAllInBoxXZY(minX, minY, minZ, maxX, maxY, maxZ)) { try { if (placeBlock(world, player, pos)) { return syncSlotAndSneaking(player, slot, isSneaking, true); From 9567e81dcf040111a1524bf44b636cb39249ef20 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 26 May 2015 20:51:36 +0200 Subject: [PATCH 227/314] Added material list sorting and dumping. --- .../gui/control/GuiSchematicMaterials.java | 54 ++++++++++++++- .../client/gui/control/SortType.java | 65 +++++++++++++++++++ .../schematica/client/util/BlockList.java | 18 ----- .../lunatrius/schematica/reference/Names.java | 4 +- .../assets/schematica/lang/en_US.lang | 1 + 5 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index b511b4ca..4275d633 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -5,17 +5,24 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.client.config.GuiUnicodeGlyphButton; import java.io.IOException; +import java.util.Formatter; import java.util.List; public class GuiSchematicMaterials extends GuiScreenBase { private GuiSchematicMaterialsSlot guiSchematicMaterialsSlot; + private SortType sortType = SortType.NAME_ASC; + + private GuiUnicodeGlyphButton btnSort = null; + private GuiButton btnDump = null; private GuiButton btnDone = null; private final String strMaterialName = I18n.format(Names.Gui.Control.MATERIAL_NAME); @@ -27,13 +34,20 @@ public GuiSchematicMaterials(GuiScreen guiScreen) { super(guiScreen); final SchematicWorld schematic = ClientProxy.schematic; this.blockList = new BlockList().getList(schematic); + this.sortType.sort(this.blockList); } @Override public void initGui() { int id = 0; - this.btnDone = new GuiButton(id++, this.width / 2 + 4, this.height - 30, 150, 20, I18n.format(Names.Gui.DONE)); + this.btnSort = new GuiUnicodeGlyphButton(++id, this.width / 2 - 154, this.height - 30, 100, 20, " " + I18n.format(Names.Gui.Control.SORT_PREFIX + this.sortType.label), this.sortType.glyph, 2.0f); + this.buttonList.add(this.btnSort); + + this.btnDump = new GuiButton(++id, this.width / 2 - 50, this.height - 30, 100, 20, I18n.format(Names.Gui.Control.DUMP)); + this.buttonList.add(this.btnDump); + + this.btnDone = new GuiButton(++id, this.width / 2 + 54, this.height - 30, 100, 20, I18n.format(Names.Gui.DONE)); this.buttonList.add(this.btnDone); this.guiSchematicMaterialsSlot = new GuiSchematicMaterialsSlot(this); @@ -48,7 +62,14 @@ public void handleMouseInput() throws IOException { @Override protected void actionPerformed(GuiButton guiButton) { if (guiButton.enabled) { - if (guiButton.id == this.btnDone.id) { + if (guiButton.id == this.btnSort.id) { + this.sortType = this.sortType.next(); + this.sortType.sort(this.blockList); + this.btnSort.displayString = " " + I18n.format(Names.Gui.Control.SORT_PREFIX + this.sortType.label); + this.btnSort.glyph = this.sortType.glyph; + } else if (guiButton.id == this.btnDump.id) { + dumpMaterialList(this.blockList); + } else if (guiButton.id == this.btnDone.id) { this.mc.displayGuiScreen(this.parentScreen); } else { this.guiSchematicMaterialsSlot.actionPerformed(guiButton); @@ -69,4 +90,33 @@ public void drawScreen(int x, int y, float partialTicks) { drawString(this.fontRendererObj, this.strMaterialAmount, this.width / 2 + 108 - this.fontRendererObj.getStringWidth(this.strMaterialAmount), 4, 0x00FFFFFF); super.drawScreen(x, y, partialTicks); } + + private void dumpMaterialList(final List blockList) { + if (blockList.size() <= 0) { + return; + } + + int maxLengthName = 0; + int maxSize = 0; + for (final ItemStack itemStack : blockList) { + maxLengthName = Math.max(maxLengthName, itemStack.getItem().getItemStackDisplayName(itemStack).length()); + maxSize = Math.max(maxSize, itemStack.stackSize); + } + + final int maxLengthSize = String.valueOf(maxSize).length(); + final String formatName = "%-" + maxLengthName + "s"; + final String formatSize = "%" + maxLengthSize + "d"; + + final StringBuilder stringBuilder = new StringBuilder((maxLengthName + 1 + maxLengthSize) * blockList.size()); + final Formatter formatter = new Formatter(stringBuilder); + for (final ItemStack itemStack : blockList) { + formatter.format(formatName, itemStack.getItem().getItemStackDisplayName(itemStack)); + stringBuilder.append(" "); + formatter.format(formatSize, itemStack.stackSize); + stringBuilder.append(System.lineSeparator()); + } + + // TODO: save to file + Reference.logger.info(stringBuilder.toString()); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java new file mode 100644 index 00000000..fc66e974 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java @@ -0,0 +1,65 @@ +package com.github.lunatrius.schematica.client.gui.control; + +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.item.ItemStack; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public enum SortType { + NAME_ASC("name", "\u2191", new Comparator() { + @Override + public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { + final String nameA = itemStackA.getItem().getItemStackDisplayName(itemStackA); + final String nameB = itemStackB.getItem().getItemStackDisplayName(itemStackB); + + return nameA.compareTo(nameB); + } + }), + NAME_DESC("name", "\u2193", new Comparator() { + @Override + public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { + final String nameA = itemStackA.getItem().getItemStackDisplayName(itemStackA); + final String nameB = itemStackB.getItem().getItemStackDisplayName(itemStackB); + + return nameB.compareTo(nameA); + } + }), + SIZE_ASC("amount", "\u2191", new Comparator() { + @Override + public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { + return itemStackA.stackSize - itemStackB.stackSize; + } + }), + SIZE_DESC("amount", "\u2193", new Comparator() { + @Override + public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { + return itemStackB.stackSize - itemStackA.stackSize; + } + }); + + private final Comparator comparator; + + public final String label; + public final String glyph; + + private SortType(final String label, final String glyph, final Comparator comparator) { + this.label = label; + this.glyph = glyph; + this.comparator = comparator; + } + + public void sort(final List blockList) { + try { + Collections.sort(blockList, this.comparator); + } catch (final Exception e) { + Reference.logger.error("Could not sort the block list!", e); + } + } + + public SortType next() { + final SortType[] values = values(); + return values[(ordinal() + 1) % values.length]; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 2d8e2e97..d70fdac5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -12,21 +12,9 @@ import net.minecraft.util.MovingObjectPosition; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.List; public class BlockList { - private static final Comparator BLOCK_COMPARATOR = new Comparator() { - @Override - public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { - final String nameA = itemStackA.getItem().getItemStackDisplayName(itemStackA); - final String nameB = itemStackB.getItem().getItemStackDisplayName(itemStackB); - - return nameA.compareTo(nameB); - } - }; - private final Minecraft minecraft = Minecraft.getMinecraft(); public List getList(final SchematicWorld world) { @@ -72,12 +60,6 @@ public List getList(final SchematicWorld world) { } } - try { - Collections.sort(blockList, BLOCK_COMPARATOR); - } catch (final Exception e) { - Reference.logger.error("Could not sort the block list", e); - } - return blockList; } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index ed916857..394c2213 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -160,6 +160,9 @@ public static final class Control { public static final String MATERIAL_NAME = "schematica.gui.materialname"; public static final String MATERIAL_AMOUNT = "schematica.gui.materialamount"; + + public static final String SORT_PREFIX = "schematica.gui.material"; + public static final String DUMP = "schematica.gui.materialdump"; } public static final String X = "schematica.gui.x"; @@ -168,7 +171,6 @@ public static final class Control { public static final String ON = "schematica.gui.on"; public static final String OFF = "schematica.gui.off"; public static final String DONE = "schematica.gui.done"; - } public static final class ModId { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index a19dff3d..2a3b5e5b 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -38,6 +38,7 @@ schematica.gui.flip=Flip schematica.gui.rotate=Rotate schematica.gui.materialname=Material schematica.gui.materialamount=Amount +schematica.gui.materialdump=Save to file # gui - config - categories schematica.config.category.debug=Debug From 74efeb1b07d895179d02c3e743bd180aff0e7c3d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 26 May 2015 21:28:31 +0200 Subject: [PATCH 228/314] Write the list to the dumps folder. --- .../gui/control/GuiSchematicMaterials.java | 17 ++++++++++++++-- .../schematica/proxy/CommonProxy.java | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index 4275d633..51405c8f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.client.gui.control; import com.github.lunatrius.core.client.gui.GuiScreenBase; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.util.BlockList; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; @@ -11,7 +12,10 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUnicodeGlyphButton; +import org.apache.commons.io.IOUtils; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.util.Formatter; import java.util.List; @@ -116,7 +120,16 @@ private void dumpMaterialList(final List blockList) { stringBuilder.append(System.lineSeparator()); } - // TODO: save to file - Reference.logger.info(stringBuilder.toString()); + final File dumps = Schematica.proxy.getDirectory("dumps"); + try { + final FileOutputStream outputStream = new FileOutputStream(new File(dumps, Reference.MODID + "-materials.txt")); + try { + IOUtils.write(stringBuilder.toString(), outputStream); + } finally { + outputStream.close(); + } + } catch (final Exception e) { + Reference.logger.error("Could not dump the material list!", e); + } } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index b6bbbd89..db5e17b2 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -32,6 +32,7 @@ import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import java.io.File; +import java.io.IOException; import java.util.List; public abstract class CommonProxy { @@ -71,6 +72,25 @@ public void createFolders() { public abstract File getDataDirectory(); + public File getDirectory(final String directory) { + final File dataDirectory = getDataDirectory(); + final File subDirectory = new File(dataDirectory, directory); + + if (!subDirectory.exists()) { + if (!subDirectory.mkdirs()) { + Reference.logger.error("Could not create directory [{}]!", subDirectory.getAbsolutePath()); + } + } + + try { + return subDirectory.getCanonicalFile(); + } catch (IOException e) { + e.printStackTrace(); + } + + return subDirectory; + } + public void resetSettings() { this.isSaveEnabled = true; this.isLoadEnabled = true; From 154505083d26115fab34dfd4d83fc2f8b4803c51 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 28 May 2015 01:07:28 +0200 Subject: [PATCH 229/314] Finished up the material list sorting. --- .../gui/control/GuiSchematicMaterials.java | 7 ++++++- .../handler/ConfigurationHandler.java | 9 ++++++++- .../lunatrius/schematica/reference/Names.java | 2 ++ .../ItemStackSortType.java} | 19 ++++++++++++++----- 4 files changed, 30 insertions(+), 7 deletions(-) rename src/main/java/com/github/lunatrius/schematica/{client/gui/control/SortType.java => util/ItemStackSortType.java} (80%) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index 51405c8f..bb877624 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -4,9 +4,11 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.util.BlockList; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.util.ItemStackSortType; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -23,7 +25,7 @@ public class GuiSchematicMaterials extends GuiScreenBase { private GuiSchematicMaterialsSlot guiSchematicMaterialsSlot; - private SortType sortType = SortType.NAME_ASC; + private ItemStackSortType sortType = ItemStackSortType.fromString(ConfigurationHandler.sortType); private GuiUnicodeGlyphButton btnSort = null; private GuiButton btnDump = null; @@ -71,6 +73,9 @@ protected void actionPerformed(GuiButton guiButton) { this.sortType.sort(this.blockList); this.btnSort.displayString = " " + I18n.format(Names.Gui.Control.SORT_PREFIX + this.sortType.label); this.btnSort.glyph = this.sortType.glyph; + + ConfigurationHandler.propSortType.set(String.valueOf(this.sortType)); + ConfigurationHandler.loadConfiguration(); } else if (guiButton.id == this.btnDump.id) { dumpMaterialList(this.blockList); } else if (guiButton.id == this.btnDone.id) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index acd7eaaa..131758fe 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -47,6 +47,7 @@ public class ConfigurationHandler { public static final String SCHEMATIC_DIRECTORY_STR = "schematics"; public static final File SCHEMATIC_DIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATIC_DIRECTORY_STR); public static final String[] EXTRA_AIR_BLOCKS_DEFAULT = { }; + public static final String SORT_TYPE_DEFAULT = ""; public static final boolean PRINTER_ENABLED_DEFAULT = true; public static final boolean SAVE_ENABLED_DEFAULT = true; public static final boolean LOAD_ENABLED_DEFAULT = true; @@ -72,6 +73,7 @@ public class ConfigurationHandler { public static float tooltipY = (float) TOOLTIP_Y_DEFAULT; public static File schematicDirectory = SCHEMATIC_DIRECTORY_DEFAULT; public static String[] extraAirBlocks = EXTRA_AIR_BLOCKS_DEFAULT; + public static String sortType = SORT_TYPE_DEFAULT; public static boolean printerEnabled = PRINTER_ENABLED_DEFAULT; public static boolean saveEnabled = SAVE_ENABLED_DEFAULT; public static boolean loadEnabled = LOAD_ENABLED_DEFAULT; @@ -96,6 +98,7 @@ public class ConfigurationHandler { public static Property propTooltipY = null; public static Property propSchematicDirectory = null; public static Property propExtraAirBlocks = null; + public static Property propSortType = null; public static Property propPrinterEnabled = null; public static Property propSaveEnabled = null; public static Property propLoadEnabled = null; @@ -110,7 +113,7 @@ public static void init(File configFile) { } } - private static void loadConfiguration() { + public static void loadConfiguration() { propDumpBlockList = configuration.get(Names.Config.Category.DEBUG, Names.Config.DUMP_BLOCK_LIST, DUMP_BLOCK_LIST_DEFAULT, Names.Config.DUMP_BLOCK_LIST_DESC); propDumpBlockList.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DUMP_BLOCK_LIST); propDumpBlockList.requiresMcRestart(); @@ -208,6 +211,10 @@ private static void loadConfiguration() { propExtraAirBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTRA_AIR_BLOCKS); extraAirBlocks = propExtraAirBlocks.getStringList(); + propSortType = configuration.get(Names.Config.Category.GENERAL, Names.Config.SORT_TYPE, SORT_TYPE_DEFAULT, Names.Config.SORT_TYPE_DESC); + propSortType.setShowInGui(false); + sortType = propSortType.getString(); + extraAirBlockList.clear(); for (String name : extraAirBlocks) { final Block block = GameData.getBlockRegistry().getObject(name); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 394c2213..4b42419d 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -55,6 +55,8 @@ public static final class Category { public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; public static final String EXTRA_AIR_BLOCKS = "extraAirBlocks"; public static final String EXTRA_AIR_BLOCKS_DESC = "Extra blocks to consider as air for the schematic renderer."; + public static final String SORT_TYPE = "sortType"; + public static final String SORT_TYPE_DESC = "Default sort type for the material list."; public static final String PRINTER_ENABLED = "printerEnabled"; public static final String PRINTER_ENABLED_DESC = "Allow players to use the printer."; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java b/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java similarity index 80% rename from src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java rename to src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java index fc66e974..41f1d1e4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/SortType.java +++ b/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.client.gui.control; +package com.github.lunatrius.schematica.util; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.item.ItemStack; @@ -7,7 +7,7 @@ import java.util.Comparator; import java.util.List; -public enum SortType { +public enum ItemStackSortType { NAME_ASC("name", "\u2191", new Comparator() { @Override public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { @@ -44,7 +44,7 @@ public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { public final String label; public final String glyph; - private SortType(final String label, final String glyph, final Comparator comparator) { + private ItemStackSortType(final String label, final String glyph, final Comparator comparator) { this.label = label; this.glyph = glyph; this.comparator = comparator; @@ -58,8 +58,17 @@ public void sort(final List blockList) { } } - public SortType next() { - final SortType[] values = values(); + public ItemStackSortType next() { + final ItemStackSortType[] values = values(); return values[(ordinal() + 1) % values.length]; } + + public static ItemStackSortType fromString(final String name) { + try { + return valueOf(name); + } catch (final Exception ignored) { + } + + return NAME_ASC; + } } From 44df79b72b061b66fbde60e46fbe929f86712ccc Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 30 May 2015 13:38:49 +0200 Subject: [PATCH 230/314] Fixed a typo in RotationHelper and added a missing valid value checks. --- .../client/util/RotationHelper.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index 8cf7f033..08217816 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -151,21 +151,23 @@ private BlockPos rotatePos(final BlockPos pos, final EnumFacing axis, final Vec3 throw new RotationException("'%s' is not a valid axis!", axis.getName()); } - private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing axis, boolean forced) throws RotationException { + private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing axisRotation, boolean forced) throws RotationException { final IProperty propertyFacing = getProperty(blockState, "facing"); if (propertyFacing instanceof PropertyDirection) { final Comparable value = blockState.getValue(propertyFacing); if (value instanceof EnumFacing) { - final EnumFacing facing = getRotatedFacing(axis, (EnumFacing) value); + final EnumFacing facing = getRotatedFacing(axisRotation, (EnumFacing) value); if (propertyFacing.getAllowedValues().contains(facing)) { return blockState.withProperty(propertyFacing, facing); } } } else if (propertyFacing instanceof PropertyEnum) { if (BlockLever.EnumOrientation.class.isAssignableFrom(propertyFacing.getValueClass())) { - final BlockLever.EnumOrientation value = (BlockLever.EnumOrientation) blockState.getValue(propertyFacing); - final BlockLever.EnumOrientation valueRotated = getRotatedLeverFacing(axis, value); - return blockState.withProperty(propertyFacing, valueRotated); + final BlockLever.EnumOrientation orientation = (BlockLever.EnumOrientation) blockState.getValue(propertyFacing); + final BlockLever.EnumOrientation orientationRotated = getRotatedLeverFacing(axisRotation, orientation); + if (propertyFacing.getAllowedValues().contains(orientationRotated)) { + return blockState.withProperty(propertyFacing, orientationRotated); + } } } else if (propertyFacing != null) { Reference.logger.error("'{}': found 'facing' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); @@ -174,31 +176,31 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a final IProperty propertyAxis = getProperty(blockState, "axis"); if (propertyAxis instanceof PropertyEnum) { if (EnumFacing.Axis.class.isAssignableFrom(propertyAxis.getValueClass())) { - final EnumFacing.Axis value = (EnumFacing.Axis) blockState.getValue(propertyAxis); - final EnumFacing.Axis valueRotated = getRotatedAxis(axis, value); - return blockState.withProperty(propertyAxis, valueRotated); + final EnumFacing.Axis axis = (EnumFacing.Axis) blockState.getValue(propertyAxis); + final EnumFacing.Axis axisRotated = getRotatedAxis(axisRotation, axis); + return blockState.withProperty(propertyAxis, axisRotated); } if (BlockLog.EnumAxis.class.isAssignableFrom(propertyAxis.getValueClass())) { - final BlockLog.EnumAxis value = (BlockLog.EnumAxis) blockState.getValue(propertyAxis); - final BlockLog.EnumAxis valueRotated = getRotatedLogAxis(axis, value); - return blockState.withProperty(propertyAxis, valueRotated); + final BlockLog.EnumAxis axis = (BlockLog.EnumAxis) blockState.getValue(propertyAxis); + final BlockLog.EnumAxis axisRotated = getRotatedLogAxis(axisRotation, axis); + return blockState.withProperty(propertyAxis, axisRotated); } } else if (propertyAxis != null) { - Reference.logger.error("'{}': found 'axis' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); + Reference.logger.error("'{}': found 'axis' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyAxis.getClass().getSimpleName()); } final IProperty propertyVariant = getProperty(blockState, "variant"); if (propertyVariant instanceof PropertyEnum) { if (BlockQuartz.EnumType.class.isAssignableFrom(propertyVariant.getValueClass())) { - final BlockQuartz.EnumType value = (BlockQuartz.EnumType) blockState.getValue(propertyVariant); - final BlockQuartz.EnumType valueRotated = getRotatedQuartzType(axis, value); - return blockState.withProperty(propertyVariant, valueRotated); + final BlockQuartz.EnumType type = (BlockQuartz.EnumType) blockState.getValue(propertyVariant); + final BlockQuartz.EnumType typeRotated = getRotatedQuartzType(axisRotation, type); + return blockState.withProperty(propertyVariant, typeRotated); } } if (!forced && (propertyFacing != null || propertyAxis != null)) { - throw new RotationException("'%s' cannot be rotated around '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axis); + throw new RotationException("'%s' cannot be rotated around '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axisRotation); } return blockState; From 51cd962ad28d662136d0298f5c7b1388e15f84fc Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 4 Jun 2015 21:10:06 +0200 Subject: [PATCH 231/314] Added really *simple* double slab placing. --- .../client/printer/SchematicPrinter.java | 35 +++++++++++++------ .../client/printer/registry/IExtraClick.java | 7 ++++ .../printer/registry/PlacementData.java | 14 ++++++++ .../printer/registry/PlacementRegistry.java | 15 ++++---- 4 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/registry/IExtraClick.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 3d1a7fc1..4d3a2f5b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -257,6 +257,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final float offsetX; final float offsetY; final float offsetZ; + final int extraClicks; if (data != null) { final List validDirections = data.getValidBlockFacings(solidSides, blockState); @@ -268,37 +269,39 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, offsetX = data.getOffsetX(blockState); offsetY = data.getOffsetY(blockState); offsetZ = data.getOffsetZ(blockState); + extraClicks = data.getExtraClicks(blockState); } else { direction = solidSides.get(0); offsetX = 0.5f; offsetY = 0.5f; offsetZ = 0.5f; + extraClicks = 0; } if (!swapToItem(player.inventory, itemStack)) { return false; } - return placeBlock(world, player, pos, direction, offsetX, offsetY, offsetZ); - + return placeBlock(world, player, pos, direction, offsetX, offsetY, offsetZ, extraClicks); } - private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos, final EnumFacing direction, final float offsetX, final float offsetY, final float offsetZ) { + private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos, final EnumFacing direction, final float offsetX, final float offsetY, final float offsetZ, final int extraClicks) { final ItemStack itemStack = player.getCurrentEquippedItem(); boolean success = false; + if (!this.minecraft.playerController.isInCreativeMode() && itemStack != null && itemStack.stackSize <= extraClicks) { + return false; + } + final BlockPos offset = pos.offset(direction); final EnumFacing side = direction.getOpposite(); + final Vec3 hitVec = new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ); - success = !ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, offset, side).isCanceled(); - if (success) { - success = this.minecraft.playerController.onPlayerRightClick(player, world, itemStack, offset, side, new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ)); - if (success) { - player.swingItem(); - } + success = placeBlock(world, player, itemStack, offset, side, hitVec); + for (int i = 0; success && i < extraClicks; i++) { + success = placeBlock(world, player, itemStack, offset, side, hitVec); } - if (itemStack != null && itemStack.stackSize == 0 && success) { player.inventory.mainInventory[player.inventory.currentItem] = null; } @@ -306,6 +309,18 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, return success; } + private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack, final BlockPos pos, final EnumFacing side, final Vec3 hitVec) { + boolean success = !ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, pos, side).isCanceled(); + if (success) { + success = this.minecraft.playerController.onPlayerRightClick(player, world, itemStack, pos, side, hitVec); + if (success) { + player.swingItem(); + } + } + + return success; + } + private void syncSneaking(final EntityPlayerSP player, final boolean isSneaking) { player.setSneaking(isSneaking); player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? C0BPacketEntityAction.Action.START_SNEAKING : C0BPacketEntityAction.Action.STOP_SNEAKING)); diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IExtraClick.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IExtraClick.java new file mode 100644 index 00000000..6925c1a3 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IExtraClick.java @@ -0,0 +1,7 @@ +package com.github.lunatrius.schematica.client.printer.registry; + +import net.minecraft.block.state.IBlockState; + +public interface IExtraClick { + int getExtraClicks(IBlockState blockState); +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java index bcf3c168..a4f3268f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java @@ -16,6 +16,7 @@ public class PlacementData { private IOffset offsetX; private IOffset offsetY; private IOffset offsetZ; + private IExtraClick extraClick; public PlacementData() { this(null, null); @@ -52,6 +53,11 @@ public PlacementData setOffsetZ(final IOffset offset) { return this; } + public PlacementData setExtraClick(final IExtraClick extraClick) { + this.extraClick = extraClick; + return this; + } + public float getOffsetX(final IBlockState blockState) { if (this.offsetX != null) { return this.offsetX.getOffset(blockState); @@ -76,6 +82,14 @@ public float getOffsetZ(final IBlockState blockState) { return 0.5f; } + public int getExtraClicks(final IBlockState blockState) { + if (this.extraClick != null) { + return this.extraClick.getExtraClicks(blockState); + } + + return 0; + } + public boolean isValidPlayerFacing(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { return this.validPlayerFacing == null || this.validPlayerFacing.isValid(blockState, player, pos, world); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 2a93a011..16ae63c5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -76,12 +76,6 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, return facing == player.getHorizontalFacing().rotateY(); } }; - final IValidPlayerFacing playerFacingSingleSlab = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - return !((BlockSlab) blockState.getBlock()).isDouble(); - } - }; final IValidPlayerFacing playerFacingLever = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { @@ -252,6 +246,13 @@ public List getValidBlockFacings(final List solidSides, } }; + final IExtraClick extraClickDoubleSlab = new IExtraClick() { + @Override + public int getExtraClicks(final IBlockState blockState) { + return ((BlockSlab) blockState.getBlock()).isDouble() ? 1 : 0; + } + }; + /** * minecraft */ @@ -269,7 +270,7 @@ public List getValidBlockFacings(final List solidSides, addPlacementMapping(BlockPistonBase.class, new PlacementData(playerFacingPiston)); addPlacementMapping(BlockPumpkin.class, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(BlockRotatedPillar.class, new PlacementData(blockFacingPillar)); - addPlacementMapping(BlockSlab.class, new PlacementData(playerFacingSingleSlab).setOffsetY(offsetSlab)); + addPlacementMapping(BlockSlab.class, new PlacementData().setOffsetY(offsetSlab).setExtraClick(extraClickDoubleSlab)); addPlacementMapping(BlockStairs.class, new PlacementData(playerFacingEntity).setOffsetY(offsetStairs)); addPlacementMapping(BlockTorch.class, new PlacementData(blockFacingOpposite)); addPlacementMapping(BlockTrapDoor.class, new PlacementData(blockFacingOpposite).setOffsetY(offsetTrapDoor)); From fd943b8a055c6787eaf3087e1c5809d7804008b5 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 4 Jun 2015 21:51:34 +0200 Subject: [PATCH 232/314] Bumped micro version, because. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 08e2771c..5f320d94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version_major=1 version_minor=7 -version_micro=6 +version_micro=7 version_minecraft=1.8 version_forge=11.14.1.1390 version_minforge=11.14.1.1390 From 4586c2607d3ee0600a3b23c2de9df918748a6d3d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 29 Jun 2015 21:29:46 +0200 Subject: [PATCH 233/314] Move entity and tile entity read/write methods to NBTHelper. --- .../lunatrius/schematica/nbt/NBTHelper.java | 46 ++++++++++++++----- .../world/schematic/SchematicAlpha.java | 10 ++-- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index 6165556e..e53a610e 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -23,7 +23,7 @@ public static List readTileEntitiesFromCompound(final NBTTagCompound final NBTTagList tagList = compound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tagList.tagCount(); i++) { final NBTTagCompound tileEntityCompound = tagList.getCompoundTagAt(i); - final TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntityCompound); + final TileEntity tileEntity = readTileEntityFromCompound(tileEntityCompound); tileEntities.add(tileEntity); } @@ -37,8 +37,7 @@ public static NBTTagCompound writeTileEntitiesToCompound(final List public static NBTTagCompound writeTileEntitiesToCompound(final List tileEntities, final NBTTagCompound compound) { final NBTTagList tagList = new NBTTagList(); for (TileEntity tileEntity : tileEntities) { - final NBTTagCompound tileEntityCompound = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityCompound); + final NBTTagCompound tileEntityCompound = writeTileEntityToCompound(tileEntity); tagList.appendTag(tileEntityCompound); } @@ -63,8 +62,10 @@ public static List readEntitiesFromCompound(final NBTTagCompound compoun final NBTTagList tagList = compound.getTagList(Names.NBT.ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tagList.tagCount(); i++) { final NBTTagCompound entityCompound = tagList.getCompoundTagAt(i); - final Entity entity = EntityList.createEntityFromNBT(entityCompound, world); - entities.add(entity); + final Entity entity = readEntityFromCompound(entityCompound, world); + if (entity != null) { + entities.add(entity); + } } return entities; @@ -97,10 +98,8 @@ public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, in } try { - NBTTagCompound tileEntityCompound = new NBTTagCompound(); - tileEntity.writeToNBT(tileEntityCompound); - - tileEntity = TileEntity.createAndLoadEntity(tileEntityCompound); + NBTTagCompound tileEntityCompound = writeTileEntityToCompound(tileEntity); + tileEntity = readTileEntityFromCompound(tileEntityCompound); final BlockPos pos = tileEntity.getPos(); tileEntity.setPos(pos.add(-offsetX, -offsetY, -offsetZ)); } catch (Throwable t) { @@ -120,9 +119,9 @@ public static Entity reloadEntity(Entity entity, int offsetX, int offsetY, int o } try { - final NBTTagCompound entityCompound = new NBTTagCompound(); - if (entity.writeToNBTOptional(entityCompound)) { - entity = EntityList.createEntityFromNBT(entityCompound, WorldDummy.instance()); + final NBTTagCompound entityCompound = writeEntityToCompound(entity); + if (entityCompound != null) { + entity = readEntityFromCompound(entityCompound, WorldDummy.instance()); if (entity != null) { entity.posX -= offsetX; @@ -136,4 +135,27 @@ public static Entity reloadEntity(Entity entity, int offsetX, int offsetY, int o return entity; } + + public static NBTTagCompound writeTileEntityToCompound(final TileEntity tileEntity) { + final NBTTagCompound tileEntityCompound = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityCompound); + return tileEntityCompound; + } + + public static TileEntity readTileEntityFromCompound(final NBTTagCompound tileEntityCompound) { + return TileEntity.createAndLoadEntity(tileEntityCompound); + } + + public static NBTTagCompound writeEntityToCompound(final Entity entity) { + final NBTTagCompound entityCompound = new NBTTagCompound(); + if (entity.writeToNBTOptional(entityCompound)) { + return entityCompound; + } + + return null; + } + + public static Entity readEntityFromCompound(final NBTTagCompound nbtTagCompound, final World world) { + return EntityList.createEntityFromNBT(nbtTagCompound, world); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 67547d93..7454541d 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -3,6 +3,7 @@ import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.api.event.PreSchematicSaveEvent; +import com.github.lunatrius.schematica.nbt.NBTHelper; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.storage.Schematic; @@ -94,7 +95,7 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { for (int i = 0; i < tileEntitiesList.tagCount(); i++) { try { - TileEntity tileEntity = TileEntity.createAndLoadEntity(tileEntitiesList.getCompoundTagAt(i)); + TileEntity tileEntity = NBTHelper.readTileEntityFromCompound(tileEntitiesList.getCompoundTagAt(i)); if (tileEntity != null) { schematic.setTileEntity(tileEntity.getPos(), tileEntity); } @@ -150,9 +151,8 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { int count = 20; NBTTagList tileEntitiesList = new NBTTagList(); for (TileEntity tileEntity : schematic.getTileEntities()) { - NBTTagCompound tileEntityTagCompound = new NBTTagCompound(); try { - tileEntity.writeToNBT(tileEntityTagCompound); + NBTTagCompound tileEntityTagCompound = NBTHelper.writeTileEntityToCompound(tileEntity); tileEntitiesList.appendTag(tileEntityTagCompound); } catch (Exception e) { final BlockPos tePos = tileEntity.getPos(); @@ -180,8 +180,8 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { final List entities = schematic.getEntities(); for (Entity entity : entities) { try { - final NBTTagCompound entityCompound = new NBTTagCompound(); - if (entity.writeToNBTOptional(entityCompound)) { + final NBTTagCompound entityCompound = NBTHelper.writeEntityToCompound(entity); + if (entityCompound != null) { entityList.appendTag(entityCompound); } } catch (Throwable t) { From 4bddb6e3d8c5a007190b8e94a30cd7d224f4a1dc Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 1 Jul 2015 20:26:54 +0200 Subject: [PATCH 234/314] Cleaned up the configuration handler. --- .../handler/ConfigurationHandler.java | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 131758fe..26a199dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -114,11 +114,29 @@ public static void init(File configFile) { } public static void loadConfiguration() { + loadConfigurationDebug(); + loadConfigurationRender(); + loadConfigurationPrinter(); + loadConfigurationSwapSlots(); + loadConfigurationTooltip(); + loadConfigurationGeneral(); + loadConfigurationServer(); + + Schematica.proxy.createFolders(); + + if (configuration.hasChanged()) { + configuration.save(); + } + } + + private static void loadConfigurationDebug() { propDumpBlockList = configuration.get(Names.Config.Category.DEBUG, Names.Config.DUMP_BLOCK_LIST, DUMP_BLOCK_LIST_DEFAULT, Names.Config.DUMP_BLOCK_LIST_DESC); propDumpBlockList.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DUMP_BLOCK_LIST); propDumpBlockList.requiresMcRestart(); dumpBlockList = propDumpBlockList.getBoolean(DUMP_BLOCK_LIST_DEFAULT); + } + private static void loadConfigurationRender() { propEnableAlpha = configuration.get(Names.Config.Category.RENDER, Names.Config.ALPHA_ENABLED, ENABLE_ALPHA_DEFAULT, Names.Config.ALPHA_ENABLED_DESC); propEnableAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.ALPHA_ENABLED); enableAlpha = propEnableAlpha.getBoolean(ENABLE_ALPHA_DEFAULT); @@ -142,7 +160,9 @@ public static void loadConfiguration() { propRenderDistance = configuration.get(Names.Config.Category.RENDER, Names.Config.RENDER_DISTANCE, RENDER_DISTANCE_DEFAULT, Names.Config.RENDER_DISTANCE_DESC, 2, 16); propRenderDistance.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.RENDER_DISTANCE); renderDistance = propRenderDistance.getInt(RENDER_DISTANCE_DEFAULT); + } + private static void loadConfigurationPrinter() { propPlaceDelay = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DELAY, PLACE_DELAY_DEFAULT, Names.Config.PLACE_DELAY_DESC, 0, 20); propPlaceDelay.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DELAY); placeDelay = propPlaceDelay.getInt(PLACE_DELAY_DEFAULT); @@ -166,7 +186,9 @@ public static void loadConfiguration() { propPlaceAdjacent = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_ADJACENT, PLACE_ADJACENT_DEFAULT, Names.Config.PLACE_ADJACENT_DESC); propPlaceAdjacent.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_ADJACENT); placeAdjacent = propPlaceAdjacent.getBoolean(PLACE_ADJACENT_DEFAULT); + } + private static void loadConfigurationSwapSlots() { swapSlotsQueue.clear(); for (int i = 0; i < SWAP_SLOTS_DEFAULT.length; i++) { propSwapSlots[i] = configuration.get(Names.Config.Category.PRINTER_SWAPSLOTS, Names.Config.SWAP_SLOT + i, SWAP_SLOTS_DEFAULT[i], Names.Config.SWAP_SLOT_DESC); @@ -177,7 +199,9 @@ public static void loadConfiguration() { swapSlotsQueue.offer(i); } } + } + private static void loadConfigurationTooltip() { propTooltipEnabled = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_ENABLED, TOOLTIP_ENABLED_DEFAULT, Names.Config.TOOLTIP_ENABLED_DESC); propTooltipEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_ENABLED); tooltipEnabled = propTooltipEnabled.getBoolean(TOOLTIP_ENABLED_DEFAULT); @@ -189,7 +213,9 @@ public static void loadConfiguration() { propTooltipY = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_Y, TOOLTIP_Y_DEFAULT, Names.Config.TOOLTIP_Y_DESC, 0, 100); propTooltipY.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_Y); tooltipY = (float) propTooltipY.getDouble(TOOLTIP_Y_DEFAULT); + } + private static void loadConfigurationGeneral() { propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATIC_DIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); schematicDirectory = new File(propSchematicDirectory.getString()); @@ -222,7 +248,9 @@ public static void loadConfiguration() { extraAirBlockList.add(block); } } + } + private static void loadConfigurationServer() { propPrinterEnabled = configuration.get(Names.Config.Category.SERVER, Names.Config.PRINTER_ENABLED, PRINTER_ENABLED_DEFAULT, Names.Config.PRINTER_ENABLED_DESC); propPrinterEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PRINTER_ENABLED); printerEnabled = propPrinterEnabled.getBoolean(PRINTER_ENABLED_DEFAULT); @@ -238,12 +266,6 @@ public static void loadConfiguration() { propPlayerQuotaKilobytes = configuration.get(Names.Config.Category.SERVER, Names.Config.PLAYER_QUOTA_KILOBYTES, PLAYER_QUOTA_KILOBYTES_DEFAULT, Names.Config.PLAYER_QUOTA_KILOBYTES_DESC); propPlayerQuotaKilobytes.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLAYER_QUOTA_KILOBYTES); playerQuotaKilobytes = propPlayerQuotaKilobytes.getInt(PLAYER_QUOTA_KILOBYTES_DEFAULT); - - Schematica.proxy.createFolders(); - - if (configuration.hasChanged()) { - configuration.save(); - } } private ConfigurationHandler() {} From 60e39386919c661e7339489defc3cb408e639926 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 1 Jul 2015 20:37:20 +0200 Subject: [PATCH 235/314] Fixed the bounding box for loaded schematics. --- .../lunatrius/schematica/client/renderer/RenderSchematic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 62d59fc6..2283d3d7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -275,7 +275,7 @@ private void renderOverlay(final SchematicWorld schematic, final boolean isRende tessellator.drawCuboid(ClientProxy.pointMin, ClientProxy.pointMax, GeometryMasks.Line.ALL, 0x00BF00, 0x7F); } if (isRenderingSchematic) { - this.tmp.set(schematic.position).add(schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1); + this.tmp.set(schematic.position.x + schematic.getWidth() - 1, schematic.position.y + schematic.getHeight() - 1, schematic.position.z + schematic.getLength() - 1); tessellator.drawCuboid(schematic.position, this.tmp, GeometryMasks.Line.ALL, 0xBF00BF, 0x7F); } tessellator.draw(); From 8703c6d0114e44e69c7f8f433c5b2c4b59080d87 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 1 Jul 2015 21:00:50 +0200 Subject: [PATCH 236/314] Added schematic block information to the debug overlay. --- .../handler/ConfigurationHandler.java | 7 +++++ .../handler/client/OverlayHandler.java | 26 +++++++++++++++++-- .../lunatrius/schematica/reference/Names.java | 2 ++ .../schematica/util/BlockStateHelper.java | 26 +++++++++++++++++++ .../assets/schematica/lang/en_US.lang | 2 ++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 26a199dd..0f38f2a9 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -26,6 +26,7 @@ public class ConfigurationHandler { public static Configuration configuration; public static final boolean DUMP_BLOCK_LIST_DEFAULT = false; + public static final boolean SHOW_DEBUG_INFO_DEFAULT = true; public static final boolean ENABLE_ALPHA_DEFAULT = false; public static final double ALPHA_DEFAULT = 1.0; public static final boolean HIGHLIGHT_DEFAULT = true; @@ -54,6 +55,7 @@ public class ConfigurationHandler { public static final int PLAYER_QUOTA_KILOBYTES_DEFAULT = 8192; public static boolean dumpBlockList = DUMP_BLOCK_LIST_DEFAULT; + public static boolean showDebugInfo = SHOW_DEBUG_INFO_DEFAULT; public static boolean enableAlpha = ENABLE_ALPHA_DEFAULT; public static float alpha = (float) ALPHA_DEFAULT; public static boolean highlight = HIGHLIGHT_DEFAULT; @@ -80,6 +82,7 @@ public class ConfigurationHandler { public static int playerQuotaKilobytes = PLAYER_QUOTA_KILOBYTES_DEFAULT; public static Property propDumpBlockList = null; + public static Property propShowDebugInfo = null; public static Property propEnableAlpha = null; public static Property propAlpha = null; public static Property propHighlight = null; @@ -134,6 +137,10 @@ private static void loadConfigurationDebug() { propDumpBlockList.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.DUMP_BLOCK_LIST); propDumpBlockList.requiresMcRestart(); dumpBlockList = propDumpBlockList.getBoolean(DUMP_BLOCK_LIST_DEFAULT); + + propShowDebugInfo = configuration.get(Names.Config.Category.DEBUG, Names.Config.SHOW_DEBUG_INFO, SHOW_DEBUG_INFO_DEFAULT, Names.Config.SHOW_DEBUG_INFO_DESC); + propShowDebugInfo.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SHOW_DEBUG_INFO); + showDebugInfo = propShowDebugInfo.getBoolean(SHOW_DEBUG_INFO_DEFAULT); } private static void loadConfigurationRender() { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index 9f8f1f82..38d61c2f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -2,24 +2,46 @@ import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.util.BlockStateHelper; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; public class OverlayHandler { + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private final Minecraft minecraft = Minecraft.getMinecraft(); @SubscribeEvent public void onText(RenderGameOverlayEvent.Text event) { - if (this.minecraft.gameSettings.showDebugInfo) { + if (this.minecraft.gameSettings.showDebugInfo && ConfigurationHandler.showDebugInfo) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic != null) { + if (schematic != null && schematic.isRendering) { event.left.add(""); event.left.add("[§6Schematica§r] " + schematic.getDebugDimensions()); // event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); + + final MovingObjectPosition mop = ClientProxy.movingObjectPosition; + if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + final BlockPos pos = mop.getBlockPos(); + final IBlockState blockState = schematic.getBlockState(pos); + + event.right.add(""); + event.right.add(String.valueOf(BLOCK_REGISTRY.getNameForObject(blockState.getBlock())) + " [§6S§r]"); + + for (final String formattedProperty : BlockStateHelper.getFormattedProperties(blockState)) { + event.right.add(formattedProperty + " [§6S§r]"); + } + } } } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 4b42419d..c2165a1e 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -15,6 +15,8 @@ public static final class Category { public static final String DUMP_BLOCK_LIST = "dumpBlockList"; public static final String DUMP_BLOCK_LIST_DESC = "Dump all block states on startup."; + public static final String SHOW_DEBUG_INFO = "showDebugInfo"; + public static final String SHOW_DEBUG_INFO_DESC = "Display extra information on the debug screen (F3)."; public static final String ALPHA_ENABLED = "alphaEnabled"; public static final String ALPHA_ENABLED_DESC = "Enable transparent textures."; diff --git a/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java index f546fd00..7fe08157 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java @@ -1,8 +1,13 @@ package com.github.lunatrius.schematica.util; +import com.google.common.collect.ImmutableSet; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumChatFormatting; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.Set; public class BlockStateHelper { @@ -24,4 +29,25 @@ public static T getPropertyValue(final IBlockState blockS return (T) blockState.getValue(property); } + + public static List getFormattedProperties(final IBlockState blockState) { + final List list = new ArrayList(); + + final ImmutableSet> properties = blockState.getProperties().entrySet(); + for (final Map.Entry entry : properties) { + final IProperty key = entry.getKey(); + final Comparable value = entry.getValue(); + + String formattedValue = value.toString(); + if (value == Boolean.TRUE) { + formattedValue = EnumChatFormatting.GREEN + formattedValue + EnumChatFormatting.RESET; + } else if (value == Boolean.FALSE) { + formattedValue = EnumChatFormatting.RED + formattedValue + EnumChatFormatting.RESET; + } + + list.add(key.getName() + ": " + formattedValue); + } + + return list; + } } diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 2a3b5e5b..a0198d7a 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -59,6 +59,8 @@ schematica.config.category.server.tooltip=Server-side settings. # gui - config - debug schematica.config.dumpBlockList=Dump Block List schematica.config.dumpBlockList.tooltip=Dump all block states on startup. +schematica.config.showDebugInfo=Show Debug Info +schematica.config.showDebugInfo.tooltip=Display extra information on the debug screen (F3). # gui - config - render schematica.config.alphaEnabled=Alpha Enabled From ba4095094e6eb194c01d6d2869a8cf472b7f4294 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 1 Jul 2015 21:08:31 +0200 Subject: [PATCH 237/314] Removed old tooltip code. --- .../client/tooltip/TooltipHandler.java | 154 ------------------ .../handler/ConfigurationHandler.java | 24 --- .../handler/client/RenderTickHandler.java | 6 - .../schematica/proxy/ClientProxy.java | 4 +- .../lunatrius/schematica/reference/Names.java | 8 - .../assets/schematica/lang/en_US.lang | 10 -- 6 files changed, 1 insertion(+), 205 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java b/src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java deleted file mode 100644 index aac20dd2..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/tooltip/TooltipHandler.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.github.lunatrius.schematica.client.tooltip; - -import com.github.lunatrius.core.client.gui.FontRendererHelper; -import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import java.util.ArrayList; -import java.util.List; - -public class TooltipHandler { - public static final TooltipHandler INSTANCE = new TooltipHandler(); - - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - private static final int PADDING = 6; - - private final Minecraft minecraft = Minecraft.getMinecraft(); - - private int width = 1280; - private int height = 720; - - public boolean renderTooltip(final SchematicWorld schematic, final MovingObjectPosition objectMouseOver) { - if (objectMouseOver != null) { - if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { - return false; - } - - if (this.minecraft.gameSettings.showDebugInfo || this.minecraft.currentScreen != null && !(this.minecraft.currentScreen instanceof GuiChat)) { - return false; - } - - final List lines = getText(schematic, objectMouseOver.getBlockPos()); - - if (!lines.isEmpty()) { - final ScaledResolution scaledResolution = new ScaledResolution(this.minecraft, this.minecraft.displayWidth, this.minecraft.displayHeight); - this.width = scaledResolution.getScaledWidth(); - this.height = scaledResolution.getScaledHeight(); - - drawHoveringText(lines, ConfigurationHandler.tooltipX, ConfigurationHandler.tooltipY, this.minecraft.fontRendererObj); - } - - GL11.glDisable(GL11.GL_LIGHTING); - } - - return false; - } - - private List getText(final SchematicWorld schematic, final BlockPos pos) { - final List list = new ArrayList(); - - final IBlockState blockState = schematic.getBlockState(pos); - final Block block = blockState.getBlock(); - final int blockMetadata = block.getMetaFromState(blockState); - - list.add(block.getLocalizedName()); - list.add("\u00a77" + BLOCK_REGISTRY.getNameForObject(block) + "\u00a7r : " + blockMetadata); - - return list; - } - - private void drawHoveringText(final List lines, final float x, final float y, final FontRenderer fontRenderer) { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - int width = 0; - int height = lines.size() * (fontRenderer.FONT_HEIGHT + 1) - 1; - for (String line : lines) { - int strWidth = fontRenderer.getStringWidth(line); - - if (strWidth > width) { - width = strWidth; - } - } - - int posX = MathHelper.clamp_int((int) (this.width / 100f * x), width / 2 + PADDING, this.width - (width + 1) / 2 - PADDING); - int posY = MathHelper.clamp_int((int) (this.height / 100f * y), PADDING, this.height - height - PADDING); - - posX -= width / 2; - - final int colorBackground = 0xF0100010; - drawGradientRect(posX - 3, posY - 4, posX + width + 3, posY - 3, colorBackground, colorBackground); - drawGradientRect(posX - 3, posY + height + 3, posX + width + 3, posY + height + 4, colorBackground, colorBackground); - drawGradientRect(posX - 3, posY - 3, posX + width + 3, posY + height + 3, colorBackground, colorBackground); - drawGradientRect(posX - 4, posY - 3, posX - 3, posY + height + 3, colorBackground, colorBackground); - drawGradientRect(posX + width + 3, posY - 3, posX + width + 4, posY + height + 3, colorBackground, colorBackground); - - final int colorTop = 0x505000FF; - final int colorBottom = (colorTop & 0xFEFEFE) >> 1 | colorTop & 0xFF000000; - drawGradientRect(posX - 3, posY - 3 + 1, posX - 3 + 1, posY + height + 3 - 1, colorTop, colorBottom); - drawGradientRect(posX + width + 2, posY - 3 + 1, posX + width + 3, posY + height + 3 - 1, colorTop, colorBottom); - drawGradientRect(posX - 3, posY - 3, posX + width + 3, posY - 3 + 1, colorTop, colorTop); - drawGradientRect(posX - 3, posY + height + 2, posX + width + 3, posY + height + 3, colorBottom, colorBottom); - - posX += width / 2; - - for (String line : lines) { - FontRendererHelper.drawCenteredString(fontRenderer, line, posX, posY, 0xFFFFFFFF); - posY += 10; - } - - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_LIGHTING); - RenderHelper.enableStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } - - private void drawGradientRect(final int x0, final int y0, final int x1, final int y1, final int colorA, final int colorB) { - float alphaA = (colorA >> 24 & 255) / 255f; - float redA = (colorA >> 16 & 255) / 255f; - float greenA = (colorA >> 8 & 255) / 255f; - float blueA = (colorA & 255) / 255f; - float alphaB = (colorB >> 24 & 255) / 255f; - float redB = (colorB >> 16 & 255) / 255f; - float greenB = (colorB >> 8 & 255) / 255f; - float blueB = (colorB & 255) / 255f; - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GL11.glShadeModel(GL11.GL_SMOOTH); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - worldRenderer.startDrawingQuads(); - worldRenderer.setColorRGBA_F(redA, greenA, blueA, alphaA); - worldRenderer.addVertex(x1, y0, 300); - worldRenderer.addVertex(x0, y0, 300); - worldRenderer.setColorRGBA_F(redB, greenB, blueB, alphaB); - worldRenderer.addVertex(x0, y1, 300); - worldRenderer.addVertex(x1, y1, 300); - tessellator.draw(); - GL11.glShadeModel(GL11.GL_FLAT); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 0f38f2a9..bdfb2664 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -42,9 +42,6 @@ public class ConfigurationHandler { public static final boolean[] SWAP_SLOTS_DEFAULT = new boolean[] { false, false, false, false, false, true, true, true, true }; - public static final boolean TOOLTIP_ENABLED_DEFAULT = true; - public static final double TOOLTIP_X_DEFAULT = 100; - public static final double TOOLTIP_Y_DEFAULT = 0; public static final String SCHEMATIC_DIRECTORY_STR = "schematics"; public static final File SCHEMATIC_DIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATIC_DIRECTORY_STR); public static final String[] EXTRA_AIR_BLOCKS_DEFAULT = { }; @@ -70,9 +67,6 @@ public class ConfigurationHandler { public static boolean placeAdjacent = PLACE_ADJACENT_DEFAULT; public static boolean[] swapSlots = SWAP_SLOTS_DEFAULT; public static final Queue swapSlotsQueue = new ArrayDeque(); - public static boolean tooltipEnabled = TOOLTIP_ENABLED_DEFAULT; - public static float tooltipX = (float) TOOLTIP_X_DEFAULT; - public static float tooltipY = (float) TOOLTIP_Y_DEFAULT; public static File schematicDirectory = SCHEMATIC_DIRECTORY_DEFAULT; public static String[] extraAirBlocks = EXTRA_AIR_BLOCKS_DEFAULT; public static String sortType = SORT_TYPE_DEFAULT; @@ -96,9 +90,6 @@ public class ConfigurationHandler { public static Property propDestroyInstantly = null; public static Property propPlaceAdjacent = null; public static Property[] propSwapSlots = new Property[SWAP_SLOTS_DEFAULT.length]; - public static Property propTooltipEnabled = null; - public static Property propTooltipX = null; - public static Property propTooltipY = null; public static Property propSchematicDirectory = null; public static Property propExtraAirBlocks = null; public static Property propSortType = null; @@ -121,7 +112,6 @@ public static void loadConfiguration() { loadConfigurationRender(); loadConfigurationPrinter(); loadConfigurationSwapSlots(); - loadConfigurationTooltip(); loadConfigurationGeneral(); loadConfigurationServer(); @@ -208,20 +198,6 @@ private static void loadConfigurationSwapSlots() { } } - private static void loadConfigurationTooltip() { - propTooltipEnabled = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_ENABLED, TOOLTIP_ENABLED_DEFAULT, Names.Config.TOOLTIP_ENABLED_DESC); - propTooltipEnabled.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_ENABLED); - tooltipEnabled = propTooltipEnabled.getBoolean(TOOLTIP_ENABLED_DEFAULT); - - propTooltipX = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_X, TOOLTIP_X_DEFAULT, Names.Config.TOOLTIP_X_DESC, 0, 100); - propTooltipX.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_X); - tooltipX = (float) propTooltipX.getDouble(TOOLTIP_X_DEFAULT); - - propTooltipY = configuration.get(Names.Config.Category.TOOLTIP, Names.Config.TOOLTIP_Y, TOOLTIP_Y_DEFAULT, Names.Config.TOOLTIP_Y_DESC, 0, 100); - propTooltipY.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TOOLTIP_Y); - tooltipY = (float) propTooltipY.getDouble(TOOLTIP_Y_DEFAULT); - } - private static void loadConfigurationGeneral() { propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATIC_DIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 355a9090..590831ac 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -1,8 +1,6 @@ package com.github.lunatrius.schematica.handler.client; -import com.github.lunatrius.schematica.client.tooltip.TooltipHandler; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -23,10 +21,6 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { final SchematicWorld schematic = ClientProxy.schematic; ClientProxy.movingObjectPosition = schematic != null ? rayTrace(schematic, 1.0f) : null; - - if (ConfigurationHandler.tooltipEnabled) { - TooltipHandler.INSTANCE.renderTooltip(schematic, ClientProxy.movingObjectPosition); - } } private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 4722bd19..f90c042c 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -156,9 +156,7 @@ public void preInit(FMLPreInitializationEvent event) { ConfigurationHandler.propBlockDelta, ConfigurationHandler.propRenderDistance, ConfigurationHandler.propPlaceDelay, - ConfigurationHandler.propTimeout, - ConfigurationHandler.propTooltipX, - ConfigurationHandler.propTooltipY + ConfigurationHandler.propTimeout }; for (Property prop : sliders) { prop.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index c2165a1e..d12728ba 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -8,7 +8,6 @@ public static final class Category { public static final String RENDER = "render"; public static final String PRINTER = "printer"; public static final String PRINTER_SWAPSLOTS = "printer.swapslots"; - public static final String TOOLTIP = "tooltip"; public static final String GENERAL = "general"; public static final String SERVER = "server"; } @@ -46,13 +45,6 @@ public static final class Category { public static final String SWAP_SLOT = "swapSlot"; public static final String SWAP_SLOT_DESC = "Allow the printer to use this hotbar slot."; - public static final String TOOLTIP_ENABLED = "tooltipEnabled"; - public static final String TOOLTIP_ENABLED_DESC = "Display a tooltip when hovering over blocks in a schematic."; - public static final String TOOLTIP_X = "tooltipX"; - public static final String TOOLTIP_X_DESC = "Relative tooltip X."; - public static final String TOOLTIP_Y = "tooltipY"; - public static final String TOOLTIP_Y_DESC = "Relative tooltip Y."; - public static final String SCHEMATIC_DIRECTORY = "schematicDirectory"; public static final String SCHEMATIC_DIRECTORY_DESC = "Schematic directory."; public static final String EXTRA_AIR_BLOCKS = "extraAirBlocks"; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index a0198d7a..e3eced5f 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -49,8 +49,6 @@ schematica.config.category.printer=Printer schematica.config.category.printer.tooltip=Printer related settings. schematica.config.category.printer.swapslots=Hotbar Slots schematica.config.category.printer.swapslots.tooltip=Allow the printer to use non empty hotbar slots. -schematica.config.category.tooltip=Tooltip -schematica.config.category.tooltip.tooltip=Tooltip related settings. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. schematica.config.category.server=Server @@ -110,14 +108,6 @@ schematica.config.swapSlot7.tooltip=Allow the printer to use the hotbar slot 8. schematica.config.swapSlot8=Allow Slot 9 schematica.config.swapSlot8.tooltip=Allow the printer to use the hotbar slot 9. -# gui - config - tooltip -schematica.config.tooltipEnabled=Tooltip Enabled -schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -schematica.config.tooltipX=Tooltip X -schematica.config.tooltipX.tooltip=Relative tooltip X. -schematica.config.tooltipY=Tooltip Y -schematica.config.tooltipY.tooltip=Relative tooltip Y. - # gui - config - general schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. From d60230250cd4f3dc4f604b9c2a09435ab9adff0e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 1 Jul 2015 21:09:31 +0200 Subject: [PATCH 238/314] Replaced direct GL calls with the state manager. --- .../lunatrius/schematica/client/gui/GuiHelper.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java index 75118e4d..0f92e83d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java @@ -3,14 +3,13 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; public class GuiHelper { private static final RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); @@ -19,16 +18,16 @@ public static void drawItemStack(TextureManager textureManager, FontRenderer fon drawItemStackSlot(textureManager, x, y); if (itemStack != null && itemStack.getItem() != null) { - GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GlStateManager.enableRescaleNormal(); RenderHelper.enableGUIStandardItemLighting(); renderItem.renderItemIntoGUI(itemStack, x + 2, y + 2); RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GlStateManager.disableRescaleNormal(); } } public static void drawItemStackSlot(TextureManager textureManager, int x, int y) { - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); textureManager.bindTexture(Gui.statIcons); Tessellator tessellator = Tessellator.getInstance(); final WorldRenderer worldRenderer = tessellator.getWorldRenderer(); From 3450146c947b740593cb75f1132f2448a562d792 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 1 Jul 2015 21:13:02 +0200 Subject: [PATCH 239/314] Resynced assets. --- .../assets/schematica/lang/ca_ES.lang | 2 - .../assets/schematica/lang/cs_CZ.lang | 2 - .../assets/schematica/lang/da_DK.lang | 2 - .../assets/schematica/lang/de_DE.lang | 5 -- .../assets/schematica/lang/en_GB.lang | 84 ++++++++++++++++--- .../assets/schematica/lang/en_PT.lang | 2 - .../assets/schematica/lang/es_ES.lang | 2 - .../assets/schematica/lang/es_MX.lang | 2 - .../assets/schematica/lang/fi_FI.lang | 2 - .../assets/schematica/lang/fr_FR.lang | 2 - .../assets/schematica/lang/hu_HU.lang | 2 - .../assets/schematica/lang/it_IT.lang | 2 - .../assets/schematica/lang/ko_KR.lang | 10 --- .../assets/schematica/lang/la_LA.lang | 2 - .../assets/schematica/lang/lt_LT.lang | 2 - .../assets/schematica/lang/nl_NL.lang | 2 - .../assets/schematica/lang/no_NO.lang | 2 - .../assets/schematica/lang/pl_PL.lang | 2 - .../assets/schematica/lang/pt_PT.lang | 2 - .../assets/schematica/lang/ru_RU.lang | 2 - .../assets/schematica/lang/sk_SK.lang | 2 - .../assets/schematica/lang/sl_SI.lang | 2 - .../assets/schematica/lang/th_TH.lang | 2 - .../assets/schematica/lang/tr_TR.lang | 2 - .../assets/schematica/lang/uk_UA.lang | 2 - .../assets/schematica/lang/zh_CN.lang | 2 - 26 files changed, 74 insertions(+), 71 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 6e3e475f..5c4163b3 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -39,8 +39,6 @@ schematica.gui.materialamount=Quantitat # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index 091076a4..d468184c 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Množství # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index c54d04fe..18a7027e 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -40,8 +40,6 @@ schematica.gui.materialamount=Antal # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 41cb0a39..392cd17e 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -35,7 +35,6 @@ schematica.gui.materialamount=Menge schematica.config.category.render.tooltip=Render Einstellungen schematica.config.category.printer=Drucker schematica.config.category.printer.tooltip=Drucker Einstellungen -schematica.config.category.tooltip.tooltip=Tooltip Einstellungen schematica.config.category.general=Generell schematica.config.category.general.tooltip=Generelle Einstellungen schematica.config.category.server.tooltip=Einstellungen am Server @@ -60,10 +59,6 @@ schematica.config.placeAdjacent.tooltip=Platziere Blöcke nur, wenn es angrenzen # gui - config - printer - swap slots -# gui - config - tooltip -schematica.config.tooltipEnabled=Tooltip anschalten -schematica.config.tooltipEnabled.tooltip=Zeigt einen Tooltip an, wenn man mit der Maus über einen Block fährt. - # gui - config - general schematica.config.schematicDirectory=Schematic Verzeichnis schematica.config.schematicDirectory.tooltip=Schematic Verzeichnis diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index e39d40f5..e3eced5f 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -5,6 +5,12 @@ schematica.gui.z=Z: schematica.gui.on=ON schematica.gui.off=OFF schematica.gui.done=Done +schematica.gui.down=Down +schematica.gui.up=Up +schematica.gui.north=North +schematica.gui.south=South +schematica.gui.west=West +schematica.gui.east=East # gui - general - load schematica.gui.title=Select schematic file @@ -32,18 +38,27 @@ schematica.gui.flip=Flip schematica.gui.rotate=Rotate schematica.gui.materialname=Material schematica.gui.materialamount=Amount +schematica.gui.materialdump=Save to file # gui - config - categories +schematica.config.category.debug=Debug +schematica.config.category.debug.tooltip=Debug/developer settings.\nDon't touch unless you know what you're doing. schematica.config.category.render=Rendering schematica.config.category.render.tooltip=Render related settings. schematica.config.category.printer=Printer schematica.config.category.printer.tooltip=Printer related settings. -schematica.config.category.tooltip=Tooltip -schematica.config.category.tooltip.tooltip=Tooltip related settings. +schematica.config.category.printer.swapslots=Hotbar Slots +schematica.config.category.printer.swapslots.tooltip=Allow the printer to use non empty hotbar slots. schematica.config.category.general=General schematica.config.category.general.tooltip=General settings. +schematica.config.category.server=Server +schematica.config.category.server.tooltip=Server-side settings. # gui - config - debug +schematica.config.dumpBlockList=Dump Block List +schematica.config.dumpBlockList.tooltip=Dump all block states on startup. +schematica.config.showDebugInfo=Show Debug Info +schematica.config.showDebugInfo.tooltip=Display extra information on the debug screen (F3). # gui - config - render schematica.config.alphaEnabled=Alpha Enabled @@ -56,6 +71,8 @@ schematica.config.highlightAir=Highlight Air schematica.config.highlightAir.tooltip=Highlight blocks that should be air. schematica.config.blockDelta=Block Delta schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +schematica.config.renderDistance=Render Distance +schematica.config.renderDistance.tooltip=Schematic render distance. # gui - config - printer schematica.config.placeDelay=Placement Delay @@ -72,33 +89,80 @@ schematica.config.placeAdjacent=Place Only Adjacent schematica.config.placeAdjacent.tooltip=Place blocks only if there is an adjacent block next to them. # gui - config - printer - swap slots - -# gui - config - tooltip -schematica.config.tooltipEnabled=Tooltip Enabled -schematica.config.tooltipEnabled.tooltip=Display a tooltip when hovering over blocks in a schematic. -schematica.config.tooltipX=Tooltip X -schematica.config.tooltipX.tooltip=Relative tooltip X. -schematica.config.tooltipY=Tooltip Y -schematica.config.tooltipY.tooltip=Relative tooltip Y. +schematica.config.swapSlot0=Allow Slot 1 +schematica.config.swapSlot0.tooltip=Allow the printer to use the hotbar slot 1. +schematica.config.swapSlot1=Allow Slot 2 +schematica.config.swapSlot1.tooltip=Allow the printer to use the hotbar slot 2. +schematica.config.swapSlot2=Allow Slot 3 +schematica.config.swapSlot2.tooltip=Allow the printer to use the hotbar slot 3. +schematica.config.swapSlot3=Allow Slot 4 +schematica.config.swapSlot3.tooltip=Allow the printer to use the hotbar slot 4. +schematica.config.swapSlot4=Allow Slot 5 +schematica.config.swapSlot4.tooltip=Allow the printer to use the hotbar slot 5. +schematica.config.swapSlot5=Allow Slot 6 +schematica.config.swapSlot5.tooltip=Allow the printer to use the hotbar slot 6. +schematica.config.swapSlot6=Allow Slot 7 +schematica.config.swapSlot6.tooltip=Allow the printer to use the hotbar slot 7. +schematica.config.swapSlot7=Allow Slot 8 +schematica.config.swapSlot7.tooltip=Allow the printer to use the hotbar slot 8. +schematica.config.swapSlot8=Allow Slot 9 +schematica.config.swapSlot8.tooltip=Allow the printer to use the hotbar slot 9. # gui - config - general schematica.config.schematicDirectory=Schematic Directory schematica.config.schematicDirectory.tooltip=Schematic directory. +schematica.config.extraAirBlocks=Extra Air Blocks +schematica.config.extraAirBlocks.tooltip=Extra blocks to consider as air for the schematic renderer. # gui - config - server +schematica.config.printerEnabled=Allow Printer +schematica.config.printerEnabled.tooltip=Allow players to use the printer. +schematica.config.saveEnabled=Allow Saving +schematica.config.saveEnabled.tooltip=Allow players to save schematics. +schematica.config.loadEnabled=Allow Loading +schematica.config.loadEnabled.tooltip=Allow players to load schematics. # keys schematica.key.category=Schematica schematica.key.load=Load schematic schematica.key.save=Save schematic schematica.key.control=Manipulate schematic +schematica.key.layerInc=Next Layer +schematica.key.layerDec=Previous Layer +schematica.key.layerToggle=Toggle All/Layer Mode +schematica.key.renderToggle=Toggle Rendering +schematica.key.printerToggle=Toggle Printer +schematica.key.moveHere=Move here # commands - save +schematica.command.save.usage=/schematicaSave +schematica.command.save.playersOnly=This command can only be used by players. +schematica.command.save.started=Started saving %d chunks into %s. +schematica.command.save.saveSucceeded=Successfully saved %s. +schematica.command.save.saveFailed=There was a problem saving the schematic %s. +schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. +schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. # commands - list +schematica.command.list.usage=/schematicaList [page] +schematica.command.list.notAvailable=There was a problem retrieving your list of schematics. +schematica.command.list.remove=Remove +schematica.command.list.download=Download +schematica.command.list.header=--- Showing schematics page %d of %d --- +schematica.command.list.noSuchPage=No such page +schematica.command.list.noSchematics=You have no schematics available. # commands - remove +schematica.command.remove.usage=/schematicaRemove +schematica.command.remove.schematicRemoved=Schematic "%s" removed. +schematica.command.remove.schematicNotFound=Schematic "%s" could not be found. +schematica.command.remove.areYouSure=Are you sure? # commands - download +schematica.command.download.usage=/schematicaDownload +schematica.command.download.started=Started downloading %s... +schematica.command.download.downloadSucceeded=Successfully downloaded %s. +schematica.command.download.downloadFail=Download failed. # messages +schematica.message.togglePrinter=Printer: %s diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index ac2e876d..7abd1ce7 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Number # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index aa87d701..8d70e008 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -40,8 +40,6 @@ schematica.gui.materialamount=Cantidad # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index cb8bf11d..6043c9ad 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -39,8 +39,6 @@ schematica.gui.materialamount=Cantidad # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index d1ff8257..174fa4a3 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Määrä # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index 81d5c579..d0a10ad3 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Quantité # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index b93ec685..987d3bcf 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Mennyiség # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index 588953c2..f3e8d7b2 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -40,8 +40,6 @@ schematica.gui.materialamount=Quantità # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index 2b410d33..aa6675c7 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -38,8 +38,6 @@ schematica.config.category.render=렌더링 schematica.config.category.render.tooltip=렌더링 관련 설정. schematica.config.category.printer=프린터 schematica.config.category.printer.tooltip=프린터 관련 설정. -schematica.config.category.tooltip=툴팁 -schematica.config.category.tooltip.tooltip=툴팁 관련 설정. schematica.config.category.general=일반 schematica.config.category.general.tooltip=일반 설정. schematica.config.category.server=서버 @@ -75,14 +73,6 @@ schematica.config.placeAdjacent.tooltip=접촉된 블럭이 있을 경우에만 # gui - config - printer - swap slots -# gui - config - tooltip -schematica.config.tooltipEnabled=툴팁 활성화됨 -schematica.config.tooltipEnabled.tooltip=Schematic의 블럭 위에 마우스를 올릴 때 툴팁을 표시합니다. -schematica.config.tooltipX=툴팁 X -schematica.config.tooltipX.tooltip=툴팁 X에 관련. -schematica.config.tooltipY=툴팁 Y -schematica.config.tooltipY.tooltip=툴팁 Y에 관련. - # gui - config - general schematica.config.schematicDirectory=Schematic 디렉토리 schematica.config.schematicDirectory.tooltip=Schematic 디렉토리. diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index f4879288..c80de93c 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -22,8 +22,6 @@ schematica.gui.materialamount=Numerus # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 58140f6b..839f46a8 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -40,8 +40,6 @@ schematica.gui.materialamount=Kiekis # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index ac6aa1fb..8f2f9405 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -40,8 +40,6 @@ schematica.gui.materialamount=Hoeveelheid # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index ac2b20f6..4319830d 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -65,8 +65,6 @@ schematica.config.placeAdjacent.tooltip=Plasser kun blokker hvis det er en tilst # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general schematica.config.schematicDirectory=Tegningskatalog schematica.config.schematicDirectory.tooltip=Tegningskatalog. diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 2659ed19..01e3912e 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -40,8 +40,6 @@ schematica.gui.materialamount=Ilosc # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index aa45f38a..365aadee 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Quantidade # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 79755b85..00f4be26 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Количество # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index eaa5e1c4..d9bf3e7e 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Množstvo # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index a12eed59..fc0b07f7 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Količina # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 8f5d3e4b..97f0e0e5 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=จำนวน # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index 2ec1a606..b31221d0 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=Miktar # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 6740da64..92b2086e 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=кількість # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 62096ab8..2f80b584 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -41,8 +41,6 @@ schematica.gui.materialamount=数量 # gui - config - printer - swap slots -# gui - config - tooltip - # gui - config - general # gui - config - server From 10f5109140b05c5f6070302321d12256ce301a8f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 31 Jul 2015 00:01:26 +0200 Subject: [PATCH 240/314] Updated Forge. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5f320d94..48633e9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ version_major=1 version_minor=7 version_micro=7 version_minecraft=1.8 -version_forge=11.14.1.1390 +version_forge=11.14.3.1450 version_minforge=11.14.1.1390 version_mappings=stable_16 version_lunatriuscore=1.1.2.28 From 8ef4e5c6249bdd44105630376e5b2353d3e3913d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 31 Jul 2015 00:04:06 +0200 Subject: [PATCH 241/314] Fixed the schematic not updating after changing dimensions. --- .../handler/client/WorldHandler.java | 23 +++++++++++++++++++ .../schematica/proxy/ClientProxy.java | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java new file mode 100644 index 00000000..0777728b --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java @@ -0,0 +1,23 @@ +package com.github.lunatrius.schematica.handler.client; + +import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.proxy.ClientProxy; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class WorldHandler { + @SubscribeEvent + public void onLoad(final WorldEvent.Load event) { + if (event.world.isRemote) { + RenderSchematic.INSTANCE.setWorldAndLoadRenderers(ClientProxy.schematic); + event.world.addWorldAccess(RenderSchematic.INSTANCE); + } + } + + @SubscribeEvent + public void onUnload(final WorldEvent.Unload event) { + if (event.world.isRemote) { + event.world.removeWorldAccess(RenderSchematic.INSTANCE); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index f90c042c..05104607 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -12,6 +12,7 @@ import com.github.lunatrius.schematica.handler.client.OverlayHandler; import com.github.lunatrius.schematica.handler.client.RenderTickHandler; import com.github.lunatrius.schematica.handler.client.TickHandler; +import com.github.lunatrius.schematica.handler.client.WorldHandler; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.Minecraft; @@ -179,6 +180,7 @@ public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(new OverlayHandler()); + MinecraftForge.EVENT_BUS.register(new WorldHandler()); } @Override From 6801867e85e2e68d0a2f111b9961655591837d0f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 31 Jul 2015 02:32:55 +0200 Subject: [PATCH 242/314] Removed ATs that are no longer used. --- .../lunatrius/schematica/client/renderer/RenderSchematic.java | 3 +-- src/main/resources/META-INF/schematica_at.cfg | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 2283d3d7..7d6211f0 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -826,8 +826,7 @@ public void markBlockRangeForRenderUpdate(final int x1, final int y1, final int markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1); } - @Override - public void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + private void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { final MBlockPos position = this.world.position; this.viewFrustum.markBlocksForUpdate(x1 - position.x, y1 - position.y, z1 - position.z, x2 - position.x, y2 - position.y, z2 - position.z); } diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index f5479510..16a95992 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -1,6 +1,4 @@ # Schematica -public net.minecraft.client.Minecraft field_175618_aM # blockRenderDispatcher - public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher field_178524_h # queueChunkUploads public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178506_a(Lnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/client/renderer/vertex/VertexBuffer;)V # uploadVertexBuffer public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178510_a(Lnet/minecraft/client/renderer/WorldRenderer;ILnet/minecraft/client/renderer/chunk/RenderChunk;)V # uploadDisplayList @@ -9,8 +7,6 @@ public net.minecraft.client.renderer.chunk.RenderChunk field_178588_d # world public net.minecraft.client.renderer.chunk.RenderChunk func_178573_a(Lnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/util/BlockPos;)V # preRenderBlocks public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecraft/util/EnumWorldBlockLayer;FFFLnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/client/renderer/chunk/CompiledChunk;)V # postRenderBlocks -public net.minecraft.client.renderer.RenderGlobal func_72725_b(IIIIII)V # markBlocksForUpdate - public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag From 618d2fa303e6b7f7f38e2121f62eb329fcc85af8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 31 Jul 2015 14:14:12 +0200 Subject: [PATCH 243/314] Only add the world access if a schematic is loaded. --- .../lunatrius/schematica/handler/client/WorldHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java index 0777728b..52028863 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java @@ -10,7 +10,9 @@ public class WorldHandler { public void onLoad(final WorldEvent.Load event) { if (event.world.isRemote) { RenderSchematic.INSTANCE.setWorldAndLoadRenderers(ClientProxy.schematic); - event.world.addWorldAccess(RenderSchematic.INSTANCE); + if (ClientProxy.schematic != null) { + event.world.addWorldAccess(RenderSchematic.INSTANCE); + } } } From 58807df69cceef159e76d967bc265fb41add718e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 3 Aug 2015 15:46:13 +0200 Subject: [PATCH 244/314] Improved air block checking. --- .../client/renderer/chunk/overlay/RenderOverlay.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index fceaa1ee..a8a0d7ea 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -18,7 +18,6 @@ import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.VisGraph; import net.minecraft.client.renderer.vertex.VertexBuffer; -import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; @@ -95,10 +94,11 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); final Block mcBlock = mcBlockState.getBlock(); - final boolean isAirBlock = mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock); + final boolean isSchAirBlock = schematic.isAirBlock(pos); + final boolean isMcAirBlock = mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock); - if (!isAirBlock) { - if (schBlock == Blocks.air && ConfigurationHandler.highlightAir) { + if (!isMcAirBlock) { + if (isSchAirBlock && ConfigurationHandler.highlightAir) { render = true; sides = GeometryMasks.Quad.ALL; color = 0xBF00BF; @@ -107,7 +107,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun if (!render) { if (ConfigurationHandler.highlight) { - if (!isAirBlock) { + if (!isMcAirBlock) { if (schBlock != mcBlock) { render = true; color = 0xFF0000; @@ -115,7 +115,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun render = true; color = 0xBF5F00; } - } else if (!schematic.isAirBlock(pos)) { + } else if (!isSchAirBlock) { render = true; color = 0x00BFFF; } From e6c0d485e8b41706eb14dfdae97d372b28e6a01d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 9 Aug 2015 16:10:56 +0200 Subject: [PATCH 245/314] Fixed a client lockup bug with large schematics. --- .../schematica/client/world/chunk/ChunkProviderSchematic.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index f6831dff..13e113bb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -10,14 +10,14 @@ import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.IChunkProvider; -import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class ChunkProviderSchematic implements IChunkProvider { private final SchematicWorld world; private final Chunk emptyChunk; - private final Map chunks = new HashMap(); + private final Map chunks = new ConcurrentHashMap(); public ChunkProviderSchematic(SchematicWorld world) { this.world = world; From 04b5ff59f4da60873e1085861d1db6d7c7b862a3 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 11 Aug 2015 01:55:29 +0200 Subject: [PATCH 246/314] IWorldAccess can be safely added/removed only on block load/unload (with the null check in place). --- .../client/renderer/RenderSchematic.java | 4 ++++ .../handler/client/WorldHandler.java | 24 ++++++++++++++++--- .../schematica/proxy/ClientProxy.java | 4 ---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 7d6211f0..8cb98221 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -827,6 +827,10 @@ public void markBlockRangeForRenderUpdate(final int x1, final int y1, final int } private void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + if (this.world == null) { + return; + } + final MBlockPos position = this.world.position; this.viewFrustum.markBlocksForUpdate(x1 - position.x, y1 - position.y, z1 - position.z, x2 - position.x, y2 - position.y, z2 - position.z); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java index 52028863..68ccbd63 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java @@ -1,17 +1,21 @@ package com.github.lunatrius.schematica.handler.client; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.world.IWorldAccess; +import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class WorldHandler { @SubscribeEvent public void onLoad(final WorldEvent.Load event) { - if (event.world.isRemote) { + if (event.world.isRemote && !(event.world instanceof SchematicWorld)) { RenderSchematic.INSTANCE.setWorldAndLoadRenderers(ClientProxy.schematic); if (ClientProxy.schematic != null) { - event.world.addWorldAccess(RenderSchematic.INSTANCE); + addWorldAccess(event.world, RenderSchematic.INSTANCE); } } } @@ -19,7 +23,21 @@ public void onLoad(final WorldEvent.Load event) { @SubscribeEvent public void onUnload(final WorldEvent.Unload event) { if (event.world.isRemote) { - event.world.removeWorldAccess(RenderSchematic.INSTANCE); + removeWorldAccess(event.world, RenderSchematic.INSTANCE); + } + } + + public static void addWorldAccess(final World world, final IWorldAccess schematic) { + if (world != null && schematic != null) { + Reference.logger.debug("Adding world access to {}", world); + world.addWorldAccess(schematic); + } + } + + public static void removeWorldAccess(final World world, final IWorldAccess schematic) { + if (world != null && schematic != null) { + Reference.logger.debug("Removing world access from {}", world); + world.removeWorldAccess(schematic); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 05104607..3251a4c7 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -211,9 +211,6 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setSchematic(null); schematic = null; - if (MINECRAFT.theWorld != null) { - MINECRAFT.theWorld.removeWorldAccess(RenderSchematic.INSTANCE); - } playerPosition.set(0, 0, 0); orientation = null; @@ -237,7 +234,6 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam ClientProxy.schematic = world; RenderSchematic.INSTANCE.setWorldAndLoadRenderers(world); - MINECRAFT.theWorld.addWorldAccess(RenderSchematic.INSTANCE); SchematicPrinter.INSTANCE.setSchematic(world); world.isRendering = true; From aed3b6b2e32046c6de928cccab1c86a90631214c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 18 Aug 2015 15:41:23 +0200 Subject: [PATCH 247/314] Removed the condition, will not work on first world load otherwise... --- .../lunatrius/schematica/handler/client/WorldHandler.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java index 68ccbd63..3e8e8a5a 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java @@ -14,9 +14,7 @@ public class WorldHandler { public void onLoad(final WorldEvent.Load event) { if (event.world.isRemote && !(event.world instanceof SchematicWorld)) { RenderSchematic.INSTANCE.setWorldAndLoadRenderers(ClientProxy.schematic); - if (ClientProxy.schematic != null) { - addWorldAccess(event.world, RenderSchematic.INSTANCE); - } + addWorldAccess(event.world, RenderSchematic.INSTANCE); } } From bf4f3774c9d9c8084a3699f55464ed666be0c355 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 18 Aug 2015 16:37:27 +0200 Subject: [PATCH 248/314] Added current progress to the material list. --- .../gui/control/GuiSchematicMaterials.java | 20 ++--- .../control/GuiSchematicMaterialsSlot.java | 8 +- .../schematica/client/util/BlockList.java | 76 +++++++++++++------ .../schematica/util/ItemStackSortType.java | 36 ++++----- 4 files changed, 88 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index bb877624..392dee70 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -9,6 +9,7 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.util.ItemStackSortType; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; @@ -34,12 +35,13 @@ public class GuiSchematicMaterials extends GuiScreenBase { private final String strMaterialName = I18n.format(Names.Gui.Control.MATERIAL_NAME); private final String strMaterialAmount = I18n.format(Names.Gui.Control.MATERIAL_AMOUNT); - protected final List blockList; + protected final List blockList; public GuiSchematicMaterials(GuiScreen guiScreen) { super(guiScreen); + final Minecraft minecraft = Minecraft.getMinecraft(); final SchematicWorld schematic = ClientProxy.schematic; - this.blockList = new BlockList().getList(schematic); + this.blockList = new BlockList().getList(minecraft.thePlayer, schematic, minecraft.theWorld); this.sortType.sort(this.blockList); } @@ -100,16 +102,16 @@ public void drawScreen(int x, int y, float partialTicks) { super.drawScreen(x, y, partialTicks); } - private void dumpMaterialList(final List blockList) { + private void dumpMaterialList(final List blockList) { if (blockList.size() <= 0) { return; } int maxLengthName = 0; int maxSize = 0; - for (final ItemStack itemStack : blockList) { - maxLengthName = Math.max(maxLengthName, itemStack.getItem().getItemStackDisplayName(itemStack).length()); - maxSize = Math.max(maxSize, itemStack.stackSize); + for (final BlockList.WrappedItemStack wrappedItemStack : blockList) { + maxLengthName = Math.max(maxLengthName, wrappedItemStack.getItemStackDisplayName().length()); + maxSize = Math.max(maxSize, wrappedItemStack.total); } final int maxLengthSize = String.valueOf(maxSize).length(); @@ -118,10 +120,10 @@ private void dumpMaterialList(final List blockList) { final StringBuilder stringBuilder = new StringBuilder((maxLengthName + 1 + maxLengthSize) * blockList.size()); final Formatter formatter = new Formatter(stringBuilder); - for (final ItemStack itemStack : blockList) { - formatter.format(formatName, itemStack.getItem().getItemStackDisplayName(itemStack)); + for (final BlockList.WrappedItemStack wrappedItemStack : blockList) { + formatter.format(formatName, wrappedItemStack.getItemStackDisplayName()); stringBuilder.append(" "); - formatter.format(formatSize, itemStack.stackSize); + formatter.format(formatSize, wrappedItemStack.total); stringBuilder.append(System.lineSeparator()); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java index 4d7ed004..a7ad7a9e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.client.gui.control; import com.github.lunatrius.schematica.client.gui.GuiHelper; +import com.github.lunatrius.schematica.client.util.BlockList; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.GlStateManager; @@ -50,10 +51,11 @@ protected int getScrollBarX() { @Override protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouseY) { - ItemStack itemStack = this.guiSchematicMaterials.blockList.get(index); + final BlockList.WrappedItemStack wrappedItemStack = this.guiSchematicMaterials.blockList.get(index); + final ItemStack itemStack = wrappedItemStack.itemStack; - String itemName = itemStack.getItem().getItemStackDisplayName(itemStack); - String amount = Integer.toString(itemStack.stackSize); + final String itemName = wrappedItemStack.getItemStackDisplayName(); + final String amount = wrappedItemStack.getFormattedAmount(); GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRendererObj, x, y, itemStack); diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index d70fdac5..3f8764b0 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -1,32 +1,33 @@ package com.github.lunatrius.schematica.client.util; +import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; public class BlockList { - private final Minecraft minecraft = Minecraft.getMinecraft(); - - public List getList(final SchematicWorld world) { - final List blockList = new ArrayList(); + public List getList(final EntityPlayer player, final SchematicWorld world, final World mcWorld) { + final List blockList = new ArrayList(); if (world == null) { return blockList; } - final MovingObjectPosition movingObjectPosition = new MovingObjectPosition(this.minecraft.thePlayer); + final MovingObjectPosition movingObjectPosition = new MovingObjectPosition(player); + final MBlockPos mcPos = new MBlockPos(); - for (final MBlockPos pos : MBlockPos.getAllInRange(BlockPos.ORIGIN, new BlockPos(world.getWidth() - 1, world.getHeight() - 1, world.getLength() - 1))) { + for (final MBlockPos pos : BlockPosHelper.getAllInBox(BlockPos.ORIGIN, new BlockPos(world.getWidth() - 1, world.getHeight() - 1, world.getLength() - 1))) { if (world.isRenderingLayer && pos.getY() != world.renderingLayer) { continue; } @@ -38,6 +39,12 @@ public List getList(final SchematicWorld world) { continue; } + mcPos.set(world.position.add(pos)); + + final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); + final Block mcBlock = mcBlockState.getBlock(); + final boolean isPlaced = block == mcBlock && block.getMetaFromState(blockState) == mcBlock.getMetaFromState(mcBlockState); + ItemStack stack = null; try { @@ -46,30 +53,55 @@ public List getList(final SchematicWorld world) { Reference.logger.debug("Could not get the pick block for: {}", blockState, e); } - if (stack != null && stack.getItem() != null) { - final ItemStack itemStack = findItemStack(blockList, stack); - if (itemStack != null) { - itemStack.stackSize++; - } else { - final ItemStack stackCopy = stack.copy(); - stackCopy.stackSize = 1; - blockList.add(stackCopy); - } - } else { + if (stack == null || stack.getItem() == null) { Reference.logger.debug("Could not find the item for: {}", blockState); + continue; } + + final WrappedItemStack wrappedItemStack = findOrCreateWrappedItemStackFor(blockList, stack); + if (isPlaced) { + wrappedItemStack.placed++; + } + wrappedItemStack.total++; } return blockList; } - private ItemStack findItemStack(final List blockList, final ItemStack pickBlock) { - for (final ItemStack itemStack : blockList) { - if (itemStack.isItemEqual(pickBlock)) { - return itemStack; + private WrappedItemStack findOrCreateWrappedItemStackFor(final List blockList, final ItemStack itemStack) { + for (final WrappedItemStack wrappedItemStack : blockList) { + if (wrappedItemStack.itemStack.isItemEqual(itemStack)) { + return wrappedItemStack; } } - return null; + final WrappedItemStack wrappedItemStack = new WrappedItemStack(itemStack.copy()); + blockList.add(wrappedItemStack); + return wrappedItemStack; + } + + public static class WrappedItemStack { + public ItemStack itemStack; + public int placed; + public int total; + + public WrappedItemStack(final ItemStack itemStack) { + this(itemStack, 0, 0); + } + + public WrappedItemStack(final ItemStack itemStack, final int placed, final int total) { + this.itemStack = itemStack; + this.placed = placed; + this.total = total; + } + + public String getItemStackDisplayName() { + return this.itemStack.getItem().getItemStackDisplayName(this.itemStack); + } + + public String getFormattedAmount() { + final char color = this.placed < this.total ? 'c' : 'a'; + return String.format("\u00a7%c%d\u00a7r/%d", color, this.placed, this.total); + } } } diff --git a/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java b/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java index 41f1d1e4..8f5016e5 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java +++ b/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java @@ -1,56 +1,56 @@ package com.github.lunatrius.schematica.util; +import com.github.lunatrius.schematica.client.util.BlockList; import com.github.lunatrius.schematica.reference.Reference; -import net.minecraft.item.ItemStack; import java.util.Collections; import java.util.Comparator; import java.util.List; public enum ItemStackSortType { - NAME_ASC("name", "\u2191", new Comparator() { + NAME_ASC("name", "\u2191", new Comparator() { @Override - public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { - final String nameA = itemStackA.getItem().getItemStackDisplayName(itemStackA); - final String nameB = itemStackB.getItem().getItemStackDisplayName(itemStackB); + public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { + final String nameA = wrappedItemStackA.getItemStackDisplayName(); + final String nameB = wrappedItemStackB.getItemStackDisplayName(); return nameA.compareTo(nameB); } }), - NAME_DESC("name", "\u2193", new Comparator() { + NAME_DESC("name", "\u2193", new Comparator() { @Override - public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { - final String nameA = itemStackA.getItem().getItemStackDisplayName(itemStackA); - final String nameB = itemStackB.getItem().getItemStackDisplayName(itemStackB); + public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { + final String nameA = wrappedItemStackA.getItemStackDisplayName(); + final String nameB = wrappedItemStackB.getItemStackDisplayName(); return nameB.compareTo(nameA); } }), - SIZE_ASC("amount", "\u2191", new Comparator() { + SIZE_ASC("amount", "\u2191", new Comparator() { @Override - public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { - return itemStackA.stackSize - itemStackB.stackSize; + public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { + return wrappedItemStackA.total - wrappedItemStackB.total; } }), - SIZE_DESC("amount", "\u2193", new Comparator() { + SIZE_DESC("amount", "\u2193", new Comparator() { @Override - public int compare(final ItemStack itemStackA, final ItemStack itemStackB) { - return itemStackB.stackSize - itemStackA.stackSize; + public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { + return wrappedItemStackB.total - wrappedItemStackA.total; } }); - private final Comparator comparator; + private final Comparator comparator; public final String label; public final String glyph; - private ItemStackSortType(final String label, final String glyph, final Comparator comparator) { + private ItemStackSortType(final String label, final String glyph, final Comparator comparator) { this.label = label; this.glyph = glyph; this.comparator = comparator; } - public void sort(final List blockList) { + public void sort(final List blockList) { try { Collections.sort(blockList, this.comparator); } catch (final Exception e) { From 65fdabb7b72b98c2a49cfcfa6c12b23ef4e0f4ca Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 18 Aug 2015 17:49:02 +0200 Subject: [PATCH 249/314] Re-added flipping support. --- .../gui/control/GuiSchematicControl.java | 19 +- .../schematica/client/util/FlipHelper.java | 164 ++++++++++++++++++ .../schematica/proxy/ClientProxy.java | 1 + 3 files changed, 180 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index a2e8f7dd..d66210e0 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -4,6 +4,7 @@ import com.github.lunatrius.core.client.gui.GuiScreenBase; import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; +import com.github.lunatrius.schematica.client.util.FlipHelper; import com.github.lunatrius.schematica.client.util.RotationHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; @@ -34,6 +35,7 @@ public class GuiSchematicControl extends GuiScreenBase { private GuiButton btnHide = null; private GuiButton btnMove = null; + private GuiButton btnFlipDirection = null; private GuiButton btnFlip = null; private GuiButton btnRotateDirection = null; private GuiButton btnRotate = null; @@ -91,7 +93,10 @@ public void initGui() { this.btnMove = new GuiButton(id++, this.width - 90, this.height - 80, 80, 20, I18n.format(Names.Gui.Control.MOVE_HERE)); this.buttonList.add(this.btnMove); - this.btnFlip = new GuiButton(id++, this.width - 90, this.height - 55, 80, 20, I18n.format(Names.Gui.Control.FLIP)); + this.btnFlipDirection = new GuiButton(id++, this.width - 180, this.height - 55, 80, 20, I18n.format(Names.Gui.Control.TRANSFORM_PREFIX + ClientProxy.axisFlip.getName())); + this.buttonList.add(this.btnFlipDirection); + + this.btnFlip = new GuiUnicodeGlyphButton(id++, this.width - 90, this.height - 55, 80, 20, " " + I18n.format(Names.Gui.Control.FLIP), "\u2194", 2.0f); this.buttonList.add(this.btnFlip); this.btnRotateDirection = new GuiButton(id++, this.width - 180, this.height - 30, 80, 20, I18n.format(Names.Gui.Control.TRANSFORM_PREFIX + ClientProxy.axisRotation.getName())); @@ -115,8 +120,8 @@ public void initGui() { this.btnHide.enabled = this.schematic != null; this.btnMove.enabled = this.schematic != null; + this.btnFlipDirection.enabled = this.schematic != null; this.btnFlip.enabled = this.schematic != null; - this.btnFlip.enabled = false; this.btnRotateDirection.enabled = this.schematic != null; this.btnRotate.enabled = this.schematic != null; this.btnMaterials.enabled = this.schematic != null; @@ -178,9 +183,15 @@ protected void actionPerformed(GuiButton guiButton) { ClientProxy.moveSchematicToPlayer(this.schematic); RenderSchematic.INSTANCE.refresh(); setPoint(this.numericX, this.numericY, this.numericZ, this.schematic.position); + } else if (guiButton.id == this.btnFlipDirection.id) { + final EnumFacing[] values = EnumFacing.VALUES; + ClientProxy.axisFlip = values[((ClientProxy.axisFlip.ordinal() + 2) % values.length)]; + guiButton.displayString = I18n.format(Names.Gui.Control.TRANSFORM_PREFIX + ClientProxy.axisFlip.getName()); } else if (guiButton.id == this.btnFlip.id) { - // TODO: implement flip logic - SchematicPrinter.INSTANCE.refresh(); + if (FlipHelper.INSTANCE.flip(this.schematic, ClientProxy.axisFlip, isShiftKeyDown())) { + RenderSchematic.INSTANCE.refresh(); + SchematicPrinter.INSTANCE.refresh(); + } } else if (guiButton.id == this.btnRotateDirection.id) { final EnumFacing[] values = EnumFacing.VALUES; ClientProxy.axisRotation = values[((ClientProxy.axisRotation.ordinal() + 1) % values.length)]; diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java new file mode 100644 index 00000000..a0b788e5 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java @@ -0,0 +1,164 @@ +package com.github.lunatrius.schematica.client.util; + +import com.github.lunatrius.core.util.BlockPosHelper; +import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.storage.Schematic; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLever; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.IBlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3i; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; + +import java.util.List; +import java.util.Set; + +public class FlipHelper { + public static final FlipHelper INSTANCE = new FlipHelper(); + + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + + public boolean flip(final SchematicWorld world, final EnumFacing axis, final boolean forced) { + if (world == null) { + return false; + } + + try { + final ISchematic schematic = world.getSchematic(); + final Schematic schematicFlipped = flip(schematic, axis, forced); + + world.setSchematic(schematicFlipped); + + for (final TileEntity tileEntity : world.getTileEntities()) { + world.initializeTileEntity(tileEntity); + } + + return true; + } catch (final FlipException fe) { + Reference.logger.error(fe.getMessage()); + } catch (final Exception e) { + Reference.logger.fatal("Something went wrong!", e); + } + + return false; + } + + public Schematic flip(final ISchematic schematic, final EnumFacing axis, boolean forced) throws FlipException { + final Vec3i dimensionsFlipped = new Vec3i(schematic.getWidth(), schematic.getHeight(), schematic.getLength()); + final Schematic schematicFlipped = new Schematic(schematic.getIcon(), dimensionsFlipped.getX(), dimensionsFlipped.getY(), dimensionsFlipped.getZ()); + final MBlockPos tmp = new MBlockPos(); + + for (final MBlockPos pos : BlockPosHelper.getAllInBox(0, 0, 0, schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1)) { + final IBlockState blockState = schematic.getBlockState(pos); + final IBlockState blockStateFlipped = flipBlock(blockState, axis, forced); + schematicFlipped.setBlockState(flipPos(pos, axis, dimensionsFlipped, tmp), blockStateFlipped); + } + + final List tileEntities = schematic.getTileEntities(); + for (final TileEntity tileEntity : tileEntities) { + final BlockPos pos = tileEntity.getPos(); + tileEntity.setPos(new BlockPos(flipPos(pos, axis, dimensionsFlipped, tmp))); + schematicFlipped.setTileEntity(tileEntity.getPos(), tileEntity); + } + + return schematicFlipped; + } + + private BlockPos flipPos(final BlockPos pos, final EnumFacing axis, final Vec3i dimensions, final MBlockPos flipped) throws FlipException { + switch (axis) { + case DOWN: + case UP: + return flipped.set(pos.getX(), dimensions.getY() - 1 - pos.getY(), pos.getZ()); + + case NORTH: + case SOUTH: + return flipped.set(pos.getX(), pos.getY(), dimensions.getZ() - 1 - pos.getZ()); + + case WEST: + case EAST: + return flipped.set(dimensions.getX() - 1 - pos.getX(), pos.getY(), pos.getZ()); + } + + throw new FlipException("'%s' is not a valid axis!", axis.getName()); + } + + private IBlockState flipBlock(final IBlockState blockState, final EnumFacing axis, boolean forced) throws FlipException { + final IProperty propertyFacing = getProperty(blockState, "facing"); + if (propertyFacing instanceof PropertyDirection) { + final Comparable value = blockState.getValue(propertyFacing); + if (value instanceof EnumFacing) { + final EnumFacing facing = getFlippedFacing(axis, (EnumFacing) value); + if (propertyFacing.getAllowedValues().contains(facing)) { + return blockState.withProperty(propertyFacing, facing); + } + } + } else if (propertyFacing instanceof PropertyEnum) { + if (BlockLever.EnumOrientation.class.isAssignableFrom(propertyFacing.getValueClass())) { + final BlockLever.EnumOrientation orientation = (BlockLever.EnumOrientation) blockState.getValue(propertyFacing); + final BlockLever.EnumOrientation orientationRotated = getFlippedLeverFacing(axis, orientation); + if (propertyFacing.getAllowedValues().contains(orientationRotated)) { + return blockState.withProperty(propertyFacing, orientationRotated); + } + } + } else if (propertyFacing != null) { + Reference.logger.error("'{}': found 'facing' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); + } + + if (!forced && propertyFacing != null) { + throw new FlipException("'%s' cannot be flipped across '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axis); + } + + return blockState; + } + + private IProperty getProperty(final IBlockState blockState, final String name) { + for (final IProperty prop : (Set) blockState.getProperties().keySet()) { + if (prop.getName().equals(name)) { + return prop; + } + } + + return null; + } + + private static EnumFacing getFlippedFacing(final EnumFacing axis, final EnumFacing side) { + if (axis.getAxis() == side.getAxis()) { + return side.getOpposite(); + } + + return side; + } + + private static BlockLever.EnumOrientation getFlippedLeverFacing(final EnumFacing source, final BlockLever.EnumOrientation side) { + if (source.getAxis() != side.getFacing().getAxis()) { + return side; + } + + final EnumFacing facing; + if (side == BlockLever.EnumOrientation.UP_Z || side == BlockLever.EnumOrientation.DOWN_Z) { + facing = EnumFacing.NORTH; + } else if (side == BlockLever.EnumOrientation.UP_X || side == BlockLever.EnumOrientation.DOWN_X) { + facing = EnumFacing.WEST; + } else { + facing = side.getFacing(); + } + + final EnumFacing facingFlipped = getFlippedFacing(source, side.getFacing()); + return BlockLever.EnumOrientation.forFacings(facingFlipped, facing); + } + + public static class FlipException extends Exception { + public FlipException(String message, Object... args) { + super(String.format(message, args)); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 3251a4c7..acd933da 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -48,6 +48,7 @@ public class ClientProxy extends CommonProxy { public static final MBlockPos pointMin = new MBlockPos(); public static final MBlockPos pointMax = new MBlockPos(); + public static EnumFacing axisFlip = EnumFacing.UP; public static EnumFacing axisRotation = EnumFacing.UP; public static MovingObjectPosition movingObjectPosition = null; From 2573ad26ccd825b0bb10c4ffb0af03c9caf8ca2f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 10 Sep 2015 16:50:25 +0200 Subject: [PATCH 250/314] Added simple NBT sync handlers for command blocks and signs. --- .../client/printer/nbtsync/NBTSync.java | 24 ++++++++++++ .../printer/nbtsync/NBTSyncCommandBlock.java | 37 +++++++++++++++++++ .../client/printer/nbtsync/NBTSyncSign.java | 30 +++++++++++++++ .../client/printer/nbtsync/SyncRegistry.java | 30 +++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java new file mode 100644 index 00000000..9dd7dd50 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java @@ -0,0 +1,24 @@ +package com.github.lunatrius.schematica.client.printer.nbtsync; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.Packet; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class NBTSync { + protected final Minecraft minecraft = Minecraft.getMinecraft(); + + public abstract boolean execute(final EntityPlayer player, final World schematic, final BlockPos pos, final World mcWorld, final BlockPos mcPos); + + public final boolean sendPacket(final Packet packet) { + final NetHandlerPlayClient netHandler = this.minecraft.getNetHandler(); + if (netHandler == null) { + return false; + } + + netHandler.addToSendQueue(packet); + return true; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java new file mode 100644 index 00000000..9463a7d9 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java @@ -0,0 +1,37 @@ +package com.github.lunatrius.schematica.client.printer.nbtsync; + +import io.netty.buffer.Unpooled; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityCommandBlock; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class NBTSyncCommandBlock extends NBTSync { + @Override + public boolean execute(final EntityPlayer player, final World schematic, final BlockPos pos, final World mcWorld, final BlockPos mcPos) { + final TileEntity tileEntity = schematic.getTileEntity(pos); + final TileEntity mcTileEntity = mcWorld.getTileEntity(mcPos); + + if (tileEntity instanceof TileEntityCommandBlock && mcTileEntity instanceof TileEntityCommandBlock) { + final CommandBlockLogic commandBlockLogic = ((TileEntityCommandBlock) tileEntity).getCommandBlockLogic(); + final CommandBlockLogic mcCommandBlockLogic = ((TileEntityCommandBlock) mcTileEntity).getCommandBlockLogic(); + + if (!commandBlockLogic.getCustomName().equals(mcCommandBlockLogic.getCustomName())) { + final PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer()); + + packetBuffer.writeByte(mcCommandBlockLogic.func_145751_f()); + mcCommandBlockLogic.func_145757_a(packetBuffer); + packetBuffer.writeString(commandBlockLogic.getCustomName()); + packetBuffer.writeBoolean(mcCommandBlockLogic.shouldTrackOutput()); + + return sendPacket(new C17PacketCustomPayload("MC|AdvCdm", packetBuffer)); + } + } + + return false; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java new file mode 100644 index 00000000..16817048 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java @@ -0,0 +1,30 @@ +package com.github.lunatrius.schematica.client.printer.nbtsync; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.play.client.C12PacketUpdateSign; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.World; + +import java.util.Arrays; + +public class NBTSyncSign extends NBTSync { + @Override + public boolean execute(final EntityPlayer player, final World schematic, final BlockPos pos, final World mcWorld, final BlockPos mcPos) { + final TileEntity tileEntity = schematic.getTileEntity(pos); + final TileEntity mcTileEntity = mcWorld.getTileEntity(mcPos); + + if (tileEntity instanceof TileEntitySign && mcTileEntity instanceof TileEntitySign) { + final IChatComponent[] signText = ((TileEntitySign) tileEntity).signText; + final IChatComponent[] mcSignText = ((TileEntitySign) mcTileEntity).signText; + + if (!Arrays.equals(signText, mcSignText)) { + return sendPacket(new C12PacketUpdateSign(mcPos, signText)); + } + } + + return false; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java new file mode 100644 index 00000000..371abf86 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java @@ -0,0 +1,30 @@ +package com.github.lunatrius.schematica.client.printer.nbtsync; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; + +import java.util.HashMap; + +public class SyncRegistry { + public static final SyncRegistry INSTANCE = new SyncRegistry(); + + private HashMap map = new HashMap(); + + public void register(final Block block, final NBTSync handler) { + if (block == null || handler == null) { + return; + } + + this.map.put(block, handler); + } + + public NBTSync getHandler(final Block block) { + return this.map.get(block); + } + + static { + INSTANCE.register(Blocks.command_block, new NBTSyncCommandBlock()); + INSTANCE.register(Blocks.standing_sign, new NBTSyncSign()); + INSTANCE.register(Blocks.wall_sign, new NBTSyncSign()); + } +} From c24c20609b90bbc3680c0f73a67ddf8f069006f4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 10 Sep 2015 16:51:55 +0200 Subject: [PATCH 251/314] Added missing map clear. --- .../schematica/client/printer/registry/PlacementRegistry.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 16ae63c5..14485c8c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -46,6 +46,7 @@ public class PlacementRegistry { private void populateMappings() { this.classPlacementMap.clear(); + this.blockPlacementMap.clear(); this.itemPlacementMap.clear(); final IValidPlayerFacing playerFacingEntity = new IValidPlayerFacing() { From 9c9ca940255cd7e9ddd6872b00f6ba4287bbad7b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 10 Sep 2015 17:53:31 +0200 Subject: [PATCH 252/314] Enabled NBT sync for command blocks and signs. --- .../client/printer/SchematicPrinter.java | 29 +++++++++++++++++-- .../printer/registry/PlacementRegistry.java | 12 ++++++++ .../schematica/handler/client/GuiHandler.java | 19 ++++++++++++ .../schematica/proxy/ClientProxy.java | 2 ++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 4d3a2f5b..79b6e35c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -3,6 +3,8 @@ import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.client.printer.nbtsync.NBTSync; +import com.github.lunatrius.schematica.client.printer.nbtsync.SyncRegistry; import com.github.lunatrius.schematica.client.printer.registry.PlacementData; import com.github.lunatrius.schematica.client.printer.registry.PlacementRegistry; import com.github.lunatrius.schematica.client.util.BlockStateToItemStack; @@ -17,7 +19,6 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Items; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.C0BPacketEntityAction; @@ -32,6 +33,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; public class SchematicPrinter { @@ -44,6 +46,7 @@ public class SchematicPrinter { private SchematicWorld schematic = null; private byte[][][] timeout = null; + private HashMap syncBlacklist = new HashMap(); public boolean isEnabled() { return this.isEnabled; @@ -82,6 +85,7 @@ public void refresh() { } else { this.timeout = null; } + this.syncBlacklist.clear(); } public boolean print() { @@ -160,6 +164,27 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, // TODO: compare block states directly? if (block == realBlock && metadata == realMetadata) { + // TODO: clean up this mess + final NBTSync handler = SyncRegistry.INSTANCE.getHandler(realBlock); + if (handler != null) { + this.timeout[x][y][z] = (byte) ConfigurationHandler.timeout; + + Integer tries = this.syncBlacklist.get(realPos); + if (tries == null) { + tries = 0; + } else if (tries >= 10) { + return false; + } + + Reference.logger.trace("Trying to sync block at {} {}", realPos, tries); + final boolean success = handler.execute(player, this.schematic, pos, world, realPos); + if (success) { + this.syncBlacklist.put(realPos, tries + 1); + } + + return success; + } + return false; } @@ -238,7 +263,7 @@ private List getSolidSides(final World world, final BlockPos pos) { } private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos, final IBlockState blockState, final ItemStack itemStack) { - if (itemStack.getItem() instanceof ItemBucket || itemStack.getItem() == Items.sign) { + if (itemStack.getItem() instanceof ItemBucket) { return false; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 14485c8c..45a3be2d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -18,6 +18,7 @@ import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.BlockSlab; import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockStandingSign; import net.minecraft.block.BlockTorch; import net.minecraft.block.BlockTrapDoor; import net.minecraft.block.properties.IProperty; @@ -29,6 +30,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import java.util.ArrayList; @@ -84,6 +86,14 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, return !value.getFacing().getAxis().isVertical() || BlockLever.EnumOrientation.forFacings(value.getFacing(), player.getHorizontalFacing()) == value; } }; + final IValidPlayerFacing playerFacingStandingSign = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final int value = (Integer) blockState.getValue(BlockStandingSign.ROTATION); + final int facing = MathHelper.floor_double((player.rotationYaw + 180.0) * 16.0 / 360.0 + 0.5) & 15; + return value == facing; + } + }; final IValidPlayerFacing playerFacingIgnore = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { @@ -282,7 +292,9 @@ public int getExtraClicks(final IBlockState blockState) { addPlacementMapping(Blocks.ladder, new PlacementData(blockFacingOpposite)); addPlacementMapping(Blocks.lever, new PlacementData(playerFacingLever, blockFacingLever)); addPlacementMapping(Blocks.quartz_block, new PlacementData(blockFacingQuartz)); + addPlacementMapping(Blocks.standing_sign, new PlacementData(playerFacingStandingSign)); addPlacementMapping(Blocks.tripwire_hook, new PlacementData(blockFacingOpposite)); + addPlacementMapping(Blocks.wall_sign, new PlacementData(blockFacingOpposite)); addPlacementMapping(Items.comparator, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(Items.repeater, new PlacementData(playerFacingEntityOpposite)); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java new file mode 100644 index 00000000..4915c2a6 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java @@ -0,0 +1,19 @@ +package com.github.lunatrius.schematica.handler.client; + +import com.github.lunatrius.schematica.client.printer.SchematicPrinter; +import net.minecraft.client.gui.inventory.GuiEditSign; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class GuiHandler { + public static final GuiHandler INSTANCE = new GuiHandler(); + + @SubscribeEvent + public void onGuiOpen(final GuiOpenEvent event) { + if (SchematicPrinter.INSTANCE.isPrinting()) { + if (event.gui instanceof GuiEditSign) { + event.gui = null; + } + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index acd933da..6b77e90b 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -8,6 +8,7 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; +import com.github.lunatrius.schematica.handler.client.GuiHandler; import com.github.lunatrius.schematica.handler.client.InputHandler; import com.github.lunatrius.schematica.handler.client.OverlayHandler; import com.github.lunatrius.schematica.handler.client.RenderTickHandler; @@ -180,6 +181,7 @@ public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(GuiHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(new OverlayHandler()); MinecraftForge.EVENT_BUS.register(new WorldHandler()); } From bfba344dc8cb6c2c85d66adb728f558fbc2330f0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 26 Oct 2015 03:08:20 +0100 Subject: [PATCH 253/314] Moved BlockStateHelper to the correct package. --- .../schematica/{util => block/state}/BlockStateHelper.java | 2 +- .../schematica/client/printer/registry/PlacementRegistry.java | 2 +- .../lunatrius/schematica/handler/client/OverlayHandler.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/com/github/lunatrius/schematica/{util => block/state}/BlockStateHelper.java (97%) diff --git a/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java similarity index 97% rename from src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java rename to src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java index 7fe08157..ad2e2b8b 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/BlockStateHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java @@ -1,4 +1,4 @@ -package com.github.lunatrius.schematica.util; +package com.github.lunatrius.schematica.block.state; import com.google.common.collect.ImmutableSet; import net.minecraft.block.properties.IProperty; diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 45a3be2d..94171845 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.client.printer.registry; -import com.github.lunatrius.schematica.util.BlockStateHelper; +import com.github.lunatrius.schematica.block.state.BlockStateHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockButton; import net.minecraft.block.BlockChest; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index 38d61c2f..c5e17c72 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -1,10 +1,10 @@ package com.github.lunatrius.schematica.handler.client; +import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; -import com.github.lunatrius.schematica.util.BlockStateHelper; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; From bcb5c6e481911d62e6ce4269ae294dff337cd682 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 26 Oct 2015 03:18:07 +0100 Subject: [PATCH 254/314] Extracted state comparison into a helper method. --- .../schematica/block/state/BlockStateHelper.java | 12 ++++++++++++ .../schematica/client/printer/SchematicPrinter.java | 8 ++------ .../lunatrius/schematica/client/util/BlockList.java | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java index ad2e2b8b..ef87183b 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java @@ -1,6 +1,7 @@ package com.github.lunatrius.schematica.block.state; import com.google.common.collect.ImmutableSet; +import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumChatFormatting; @@ -50,4 +51,15 @@ public static List getFormattedProperties(final IBlockState blockState) return list; } + + public static boolean areBlockStatesEqual(final IBlockState blockStateA, final IBlockState blockStateB) { + if (blockStateA == blockStateB) { + return true; + } + + final Block blockA = blockStateA.getBlock(); + final Block blockB = blockStateB.getBlock(); + + return blockA == blockB && blockA.getMetaFromState(blockStateA) == blockB.getMetaFromState(blockStateB); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 79b6e35c..4a677424 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -3,6 +3,7 @@ import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3i; +import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.printer.nbtsync.NBTSync; import com.github.lunatrius.schematica.client.printer.nbtsync.SyncRegistry; import com.github.lunatrius.schematica.client.printer.registry.PlacementData; @@ -155,15 +156,10 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos realPos = new BlockPos(wx, wy, wz); final IBlockState blockState = this.schematic.getBlockState(pos); - final Block block = blockState.getBlock(); - final int metadata = block.getMetaFromState(blockState); - final IBlockState realBlockState = world.getBlockState(realPos); final Block realBlock = realBlockState.getBlock(); - final int realMetadata = realBlock.getMetaFromState(realBlockState); - // TODO: compare block states directly? - if (block == realBlock && metadata == realMetadata) { + if (BlockStateHelper.areBlockStatesEqual(blockState, realBlockState)) { // TODO: clean up this mess final NBTSync handler = SyncRegistry.INSTANCE.getHandler(realBlock); if (handler != null) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 3f8764b0..15f9bfba 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -2,6 +2,7 @@ import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; @@ -42,8 +43,7 @@ public List getList(final EntityPlayer player, final Schematic mcPos.set(world.position.add(pos)); final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); - final Block mcBlock = mcBlockState.getBlock(); - final boolean isPlaced = block == mcBlock && block.getMetaFromState(blockState) == mcBlock.getMetaFromState(mcBlockState); + final boolean isPlaced = BlockStateHelper.areBlockStatesEqual(blockState, mcBlockState); ItemStack stack = null; From f0068d790bdcdd25c9592ddd4dfbf4f2d017fb9d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 26 Oct 2015 03:41:36 +0100 Subject: [PATCH 255/314] Added a block replacement command. Updated LunatriusCore. --- gradle.properties | 2 +- .../state/pattern/BlockStateReplacer.java | 136 ++++++++++++++++++ .../client/world/SchematicWorld.java | 34 +++++ .../client/CommandSchematicaReplace.java | 68 +++++++++ .../schematica/proxy/ClientProxy.java | 4 + .../lunatrius/schematica/reference/Names.java | 14 ++ .../assets/schematica/lang/en_US.lang | 8 ++ 7 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java create mode 100644 src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java diff --git a/gradle.properties b/gradle.properties index 48633e9b..2d060dbf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ version_minecraft=1.8 version_forge=11.14.3.1450 version_minforge=11.14.1.1390 version_mappings=stable_16 -version_lunatriuscore=1.1.2.28 +version_lunatriuscore=1.1.2.29 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java new file mode 100644 index 00000000..38f5bd80 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java @@ -0,0 +1,136 @@ +package com.github.lunatrius.schematica.block.state.pattern; + +import com.github.lunatrius.core.exceptions.LocalizedException; +import com.github.lunatrius.schematica.reference.Names; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableSet; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +public class BlockStateReplacer { + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + private final IBlockState defaultReplacement; + + private BlockStateReplacer(final IBlockState defaultReplacement) { + this.defaultReplacement = defaultReplacement; + } + + public IBlockState getReplacement(final IBlockState original, final Map properties) { + IBlockState replacement = this.defaultReplacement; + + replacement = applyProperties(replacement, original.getProperties()); + replacement = applyProperties(replacement, properties); + + return replacement; + } + + private IBlockState applyProperties(IBlockState blockState, final Map properties) { + for (final Map.Entry entry : properties.entrySet()) { + try { + blockState = blockState.withProperty(entry.getKey(), entry.getValue()); + } catch (final IllegalArgumentException ignored) { + } + } + + return blockState; + } + + public static BlockStateReplacer forBlockState(final IBlockState replacement) { + return new BlockStateReplacer(replacement); + } + + public static BlockStateHelper getMatcher(final BlockStateInfo blockStateInfo) { + final BlockStateHelper matcher = BlockStateHelper.forBlock(blockStateInfo.block); + for (final Map.Entry entry : blockStateInfo.stateData.entrySet()) { + matcher.where(entry.getKey(), new Predicate() { + @Override + public boolean apply(final Comparable input) { + return input != null && input.equals(entry.getValue()); + } + }); + } + + return matcher; + } + + public static BlockStateInfo fromString(final String input) throws LocalizedException { + final int start = input.indexOf('['); + final int end = input.indexOf(']'); + + final String blockName; + final String stateData; + if (start > -1 && end > -1) { + blockName = input.substring(0, start); + stateData = input.substring(start + 1, end); + } else { + blockName = input; + stateData = ""; + } + + final Block block = BLOCK_REGISTRY.getRaw(blockName); + if (block == null) { + throw new LocalizedException(Names.Messages.INVALID_BLOCK, blockName); + } + + final Map propertyData = parsePropertyData(block.getDefaultState(), stateData, true); + return new BlockStateInfo(block, propertyData); + } + + public static Map parsePropertyData(final IBlockState blockState, final String stateData, final boolean strict) throws LocalizedException { + final HashMap map = new HashMap(); + if (stateData == null || stateData.length() == 0) { + return map; + } + + final String[] propertyPairs = stateData.split(","); + for (final String propertyPair : propertyPairs) { + final String[] split = propertyPair.split("="); + if (split.length != 2) { + throw new LocalizedException(Names.Messages.INVALID_PROPERTY, propertyPair); + } + + putMatchingProperty(map, blockState, split[0], split[1], strict); + } + + return map; + } + + private static boolean putMatchingProperty(final Map map, final IBlockState blockState, final String name, final String value, final boolean strict) throws LocalizedException { + final ImmutableSet properties = blockState.getProperties().keySet(); + for (final IProperty property : properties) { + if (property.getName().equalsIgnoreCase(name)) { + final Collection allowedValues = property.getAllowedValues(); + for (final Comparable allowedValue : allowedValues) { + if (String.valueOf(allowedValue).equalsIgnoreCase(value)) { + map.put(property, allowedValue); + return true; + } + } + } + } + + if (strict) { + throw new LocalizedException(Names.Messages.INVALID_PROPERTY_FOR_BLOCK, name + "=" + value, BLOCK_REGISTRY.getNameForObject(blockState.getBlock())); + } + + return false; + } + + public static class BlockStateInfo { + public final Block block; + public final Map stateData; + + public BlockStateInfo(final Block block, final Map stateData) { + this.block = block; + this.stateData = stateData; + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index c7599f47..16183278 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -1,10 +1,14 @@ package com.github.lunatrius.schematica.client.world; +import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.block.state.pattern.BlockStateReplacer; import com.github.lunatrius.schematica.client.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockStateHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.Entity; @@ -23,6 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import java.util.List; +import java.util.Map; public class SchematicWorld extends WorldClient { private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); @@ -200,6 +205,35 @@ public String getDebugDimensions() { return "WHL: " + getWidth() + " / " + getHeight() + " / " + getLength(); } + public int replaceBlock(final BlockStateHelper matcher, final BlockStateReplacer replacer, final Map properties) { + int count = 0; + + for (final MBlockPos pos : BlockPosHelper.getAllInBox(0, 0, 0, getWidth(), getHeight(), getLength())) { + final IBlockState blockState = this.schematic.getBlockState(pos); + + // TODO: add support for tile entities? + if (blockState.getBlock().hasTileEntity(blockState)) { + continue; + } + + if (matcher.matchesState(blockState)) { + final IBlockState replacement = replacer.getReplacement(blockState, properties); + + // TODO: add support for tile entities? + if (replacement.getBlock().hasTileEntity(replacement)) { + continue; + } + + if (this.schematic.setBlockState(pos, replacement)) { + markBlockForUpdate(pos.add(this.position)); + count++; + } + } + } + + return count; + } + public boolean isInside(final BlockPos pos) { final int x = pos.getX(); final int y = pos.getY(); diff --git a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java new file mode 100644 index 00000000..d9f7b339 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java @@ -0,0 +1,68 @@ +package com.github.lunatrius.schematica.command.client; + +import com.github.lunatrius.schematica.block.state.pattern.BlockStateReplacer; +import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.command.CommandSchematicaBase; +import com.github.lunatrius.schematica.proxy.ClientProxy; +import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.block.Block; +import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; +import net.minecraftforge.fml.common.registry.GameData; + +import java.util.List; + +public class CommandSchematicaReplace extends CommandSchematicaBase { + private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + + @Override + public String getCommandName() { + return Names.Command.Replace.NAME; + } + + @Override + public String getCommandUsage(final ICommandSender sender) { + return Names.Command.Replace.Message.USAGE; + } + + @Override + public List addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) { + if (args.length < 3) { + return getListOfStringsMatchingLastWord(args, BLOCK_REGISTRY.getKeys()); + } + + return null; + } + + @Override + public void processCommand(final ICommandSender sender, final String[] args) throws CommandException { + final SchematicWorld schematic = ClientProxy.schematic; + if (schematic == null) { + throw new CommandException(Names.Command.Replace.Message.NO_SCHEMATIC); + } + + if (args.length != 2) { + throw new CommandException(Names.Command.Replace.Message.USAGE); + } + + try { + final BlockStateReplacer.BlockStateInfo patternInfo = BlockStateReplacer.fromString(args[0]); + final BlockStateHelper matcher = BlockStateReplacer.getMatcher(patternInfo); + + final BlockStateReplacer.BlockStateInfo replacementInfo = BlockStateReplacer.fromString(args[1]); + final BlockStateReplacer replacer = BlockStateReplacer.forBlockState(replacementInfo.block.getDefaultState()); + + final int count = schematic.replaceBlock(matcher, replacer, replacementInfo.stateData); + + sender.addChatMessage(new ChatComponentTranslation(Names.Command.Replace.Message.SUCCESS, count)); + } catch (final Exception e) { + Reference.logger.error("Something went wrong!", e); + throw new CommandException(e.getMessage()); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 6b77e90b..0b2b0138 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.command.client.CommandSchematicaReplace; import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.GuiHandler; @@ -22,6 +23,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; +import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.config.GuiConfigEntries; @@ -179,6 +181,8 @@ public void init(FMLInitializationEvent event) { FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); FMLCommonHandler.instance().bus().register(ConfigurationHandler.INSTANCE); + ClientCommandHandler.instance.registerCommand(new CommandSchematicaReplace()); + MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(GuiHandler.INSTANCE); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index d12728ba..4e233b25 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -118,10 +118,24 @@ public static final class Message { public static final String NAME = "schematicaDownload"; } + + public static final class Replace { + public static final class Message { + public static final String USAGE = "schematica.command.replace.usage"; + public static final String NO_SCHEMATIC = "schematica.command.replace.noSchematic"; + public static final String SUCCESS = "schematica.command.replace.success"; + } + + public static final String NAME = "schematicaReplace"; + } } public static final class Messages { public static final String TOGGLE_PRINTER = "schematica.message.togglePrinter"; + + public static final String INVALID_BLOCK = "schematica.message.invalidBlock"; + public static final String INVALID_PROPERTY = "schematica.message.invalidProperty"; + public static final String INVALID_PROPERTY_FOR_BLOCK = "schematica.message.invalidPropertyForBlock"; } public static final class Gui { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index e3eced5f..2bdc6274 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -164,5 +164,13 @@ schematica.command.download.started=Started downloading %s... schematica.command.download.downloadSucceeded=Successfully downloaded %s. schematica.command.download.downloadFail=Download failed. +# commands - replace +schematica.command.replace.usage=/schematicaReplace +schematica.command.replace.noSchematic=You don't have a schematic loaded. +schematica.command.replace.success=Replaced %s blocks. + # messages schematica.message.togglePrinter=Printer: %s +schematica.message.invalidBlock="%s" does not exist. +schematica.message.invalidProperty="%s" is not a valid property. +schematica.message.invalidPropertyForBlock="%s" is not a valid property for "%s". From 4cf093eb99a279711167e4dffec38cced8561b7a Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 30 Oct 2015 03:17:15 +0100 Subject: [PATCH 256/314] Fixed schematic blocks not rendering inside the extra air blocks. --- .../schematica/client/renderer/SchematicRenderCache.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java index 5b1679a0..88d77567 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.renderer; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -20,7 +21,7 @@ public IBlockState getBlockState(final BlockPos pos) { final BlockPos realPos = pos.add(ClientProxy.schematic.position); final World world = this.minecraft.theWorld; - if (!world.isAirBlock(realPos)) { + if (!world.isAirBlock(realPos) && !ConfigurationHandler.isExtraAirBlock(world.getBlockState(realPos).getBlock())) { return Blocks.air.getDefaultState(); } From c32b72769c8dfb18f5022e978bff02709b461c39 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 3 Nov 2015 18:26:17 +0100 Subject: [PATCH 257/314] Change the timeout to a simple decrement like it was supposed to be... --- .../lunatrius/schematica/client/printer/SchematicPrinter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 4a677424..0907c6d5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -146,7 +146,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final int y = pos.getY(); final int z = pos.getZ(); if (this.timeout[x][y][z] > 0) { - this.timeout[x][y][z] -= ConfigurationHandler.placeDelay; + this.timeout[x][y][z]--; return false; } From 414782aea525f760c133ba26bd7eeb7d41f5f225 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 3 Nov 2015 18:30:36 +0100 Subject: [PATCH 258/314] Stop the printer when the game is paused. --- .../client/printer/SchematicPrinter.java | 5 +-- .../handler/client/TickHandler.java | 42 +++++++++++-------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 0907c6d5..5d2c525d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -89,10 +89,7 @@ public void refresh() { this.syncBlacklist.clear(); } - public boolean print() { - final EntityPlayerSP player = this.minecraft.thePlayer; - final WorldClient world = this.minecraft.theWorld; - + public boolean print(final WorldClient world, final EntityPlayerSP player) { final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); int minX = Math.max(0, trans.x - 3); int maxX = Math.min(this.schematic.getWidth() - 1, trans.x + 3); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 5bf1ed6d..ac333ee2 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -7,6 +7,8 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.network.FMLNetworkEvent; @@ -36,28 +38,32 @@ public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEven @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.END) { - this.minecraft.mcProfiler.startSection("schematica"); - SchematicWorld schematic = ClientProxy.schematic; - if (this.minecraft.thePlayer != null && schematic != null && schematic.isRendering) { - this.minecraft.mcProfiler.startSection("printer"); - SchematicPrinter printer = SchematicPrinter.INSTANCE; - if (printer.isEnabled() && printer.isPrinting() && this.ticks-- < 0) { - this.ticks = ConfigurationHandler.placeDelay; - - printer.print(); - } - - this.minecraft.mcProfiler.endSection(); - } + if (this.minecraft.isGamePaused() || event.phase != TickEvent.Phase.END) { + return; + } + + this.minecraft.mcProfiler.startSection("schematica"); + final WorldClient world = this.minecraft.theWorld; + final EntityPlayerSP player = this.minecraft.thePlayer; + final SchematicWorld schematic = ClientProxy.schematic; + if (world != null && player != null && schematic != null && schematic.isRendering) { + this.minecraft.mcProfiler.startSection("printer"); + final SchematicPrinter printer = SchematicPrinter.INSTANCE; + if (printer.isEnabled() && printer.isPrinting() && this.ticks-- < 0) { + this.ticks = ConfigurationHandler.placeDelay; - if (ClientProxy.isPendingReset) { - Schematica.proxy.resetSettings(); - ClientProxy.isPendingReset = false; - Reference.logger.info("Client settings have been reset."); + printer.print(world, player); } this.minecraft.mcProfiler.endSection(); } + + if (ClientProxy.isPendingReset) { + Schematica.proxy.resetSettings(); + ClientProxy.isPendingReset = false; + Reference.logger.info("Client settings have been reset."); + } + + this.minecraft.mcProfiler.endSection(); } } From 404a4f761847a27e5a1efd837cb46602ac086e0c Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 3 Nov 2015 18:41:38 +0100 Subject: [PATCH 259/314] Add config option for the printer range. --- .../client/printer/SchematicPrinter.java | 28 +++++++++++++------ .../handler/ConfigurationHandler.java | 7 +++++ .../schematica/proxy/ClientProxy.java | 3 +- .../lunatrius/schematica/reference/Names.java | 2 ++ .../assets/schematica/lang/en_US.lang | 2 ++ 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 5d2c525d..986b30f1 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -2,7 +2,6 @@ import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; -import com.github.lunatrius.core.util.vector.Vector3i; import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.printer.nbtsync.NBTSync; import com.github.lunatrius.schematica.client.printer.nbtsync.SyncRegistry; @@ -90,13 +89,20 @@ public void refresh() { } public boolean print(final WorldClient world, final EntityPlayerSP player) { - final Vector3i trans = ClientProxy.playerPosition.clone().sub(this.schematic.position.x, this.schematic.position.y, this.schematic.position.z).toVector3i(); - int minX = Math.max(0, trans.x - 3); - int maxX = Math.min(this.schematic.getWidth() - 1, trans.x + 3); - int minY = Math.max(0, trans.y - 3); - int maxY = Math.min(this.schematic.getHeight() - 1, trans.y + 3); - int minZ = Math.max(0, trans.z - 3); - int maxZ = Math.min(this.schematic.getLength() - 1, trans.z + 3); + final double dX = ClientProxy.playerPosition.x - this.schematic.position.x; + final double dY = ClientProxy.playerPosition.y - this.schematic.position.y; + final double dZ = ClientProxy.playerPosition.z - this.schematic.position.z; + final int x = (int) Math.floor(dX); + final int y = (int) Math.floor(dY); + final int z = (int) Math.floor(dZ); + final int range = ConfigurationHandler.placeDistance; + + int minX = Math.max(0, x - range); + int maxX = Math.min(this.schematic.getWidth() - 1, x + range); + int minY = Math.max(0, y - range); + int maxY = Math.min(this.schematic.getHeight() - 1, y + range); + int minZ = Math.max(0, z - range); + int maxZ = Math.min(this.schematic.getLength() - 1, z + range); if (minX > maxX || minY > maxY || minZ > maxZ) { return false; @@ -118,7 +124,13 @@ public boolean print(final WorldClient world, final EntityPlayerSP player) { syncSneaking(player, true); + final double blockReachDistance = this.minecraft.playerController.getBlockReachDistance() - 0.1; + final double blockReachDistanceSq = blockReachDistance * blockReachDistance; for (final MBlockPos pos : BlockPosHelper.getAllInBoxXZY(minX, minY, minZ, maxX, maxY, maxZ)) { + if (pos.distanceSqToCenter(dX, dY, dZ) > blockReachDistanceSq) { + continue; + } + try { if (placeBlock(world, player, pos)) { return syncSlotAndSneaking(player, slot, isSneaking, true); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index bdfb2664..3a864d11 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -35,6 +35,7 @@ public class ConfigurationHandler { public static final int RENDER_DISTANCE_DEFAULT = 8; public static final int PLACE_DELAY_DEFAULT = 1; public static final int TIMEOUT_DEFAULT = 10; + public static final int PLACE_DISTANCE_DEFAULT = 5; public static final boolean PLACE_INSTANTLY_DEFAULT = false; public static final boolean DESTROY_BLOCKS_DEFAULT = false; public static final boolean DESTROY_INSTANTLY_DEFAULT = false; @@ -61,6 +62,7 @@ public class ConfigurationHandler { public static int renderDistance = RENDER_DISTANCE_DEFAULT; public static int placeDelay = PLACE_DELAY_DEFAULT; public static int timeout = TIMEOUT_DEFAULT; + public static int placeDistance = PLACE_DISTANCE_DEFAULT; public static boolean placeInstantly = PLACE_INSTANTLY_DEFAULT; public static boolean destroyBlocks = DESTROY_BLOCKS_DEFAULT; public static boolean destroyInstantly = DESTROY_INSTANTLY_DEFAULT; @@ -85,6 +87,7 @@ public class ConfigurationHandler { public static Property propRenderDistance = null; public static Property propPlaceDelay = null; public static Property propTimeout = null; + public static Property propPlaceDistance = null; public static Property propPlaceInstantly = null; public static Property propDestroyBlocks = null; public static Property propDestroyInstantly = null; @@ -168,6 +171,10 @@ private static void loadConfigurationPrinter() { propTimeout.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TIMEOUT); timeout = propTimeout.getInt(TIMEOUT_DEFAULT); + propPlaceDistance = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_DISTANCE, PLACE_DISTANCE_DEFAULT, Names.Config.PLACE_DISTANCE_DESC, 1, 5); + propPlaceDistance.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_DISTANCE); + placeDistance = propPlaceDistance.getInt(PLACE_DISTANCE_DEFAULT); + propPlaceInstantly = configuration.get(Names.Config.Category.PRINTER, Names.Config.PLACE_INSTANTLY, PLACE_INSTANTLY_DEFAULT, Names.Config.PLACE_INSTANTLY_DESC); propPlaceInstantly.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.PLACE_INSTANTLY); placeInstantly = propPlaceInstantly.getBoolean(PLACE_INSTANTLY_DEFAULT); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 0b2b0138..074952ce 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -161,7 +161,8 @@ public void preInit(FMLPreInitializationEvent event) { ConfigurationHandler.propBlockDelta, ConfigurationHandler.propRenderDistance, ConfigurationHandler.propPlaceDelay, - ConfigurationHandler.propTimeout + ConfigurationHandler.propTimeout, + ConfigurationHandler.propPlaceDistance }; for (Property prop : sliders) { prop.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 4e233b25..378b8ca4 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -34,6 +34,8 @@ public static final class Category { public static final String PLACE_DELAY_DESC = "Delay between placement attempts (in ticks)."; public static final String TIMEOUT = "timeout"; public static final String TIMEOUT_DESC = "Timeout before re-trying failed blocks."; + public static final String PLACE_DISTANCE = "placeDistance"; + public static final String PLACE_DISTANCE_DESC = "Maximum placement distance."; public static final String PLACE_INSTANTLY = "placeInstantly"; public static final String PLACE_INSTANTLY_DESC = "Place all blocks that can be placed in one tick."; public static final String DESTROY_BLOCKS = "destroyBlocks"; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 2bdc6274..6a5911e9 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -79,6 +79,8 @@ schematica.config.placeDelay=Placement Delay schematica.config.placeDelay.tooltip=Delay between placement attempts (in ticks). schematica.config.timeout=Timeout schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +schematica.config.placeDistance=Placement Distance +schematica.config.placeDistance.tooltip=Maximum placement distance. schematica.config.placeInstantly=Place Instantly schematica.config.placeInstantly.tooltip=Place all blocks that can be placed in one tick. schematica.config.destroyBlocks=Destroy Blocks From a8bf9604ec07bad0a8cc6786dfaeb3c9d97b1511 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 3 Nov 2015 21:10:50 +0100 Subject: [PATCH 260/314] Fix weird config behavior for list properties. --- .../lunatrius/schematica/handler/ConfigurationHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 3a864d11..5deea5b1 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -14,6 +14,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayDeque; +import java.util.Arrays; import java.util.HashSet; import java.util.Queue; import java.util.Set; @@ -67,10 +68,10 @@ public class ConfigurationHandler { public static boolean destroyBlocks = DESTROY_BLOCKS_DEFAULT; public static boolean destroyInstantly = DESTROY_INSTANTLY_DEFAULT; public static boolean placeAdjacent = PLACE_ADJACENT_DEFAULT; - public static boolean[] swapSlots = SWAP_SLOTS_DEFAULT; + public static boolean[] swapSlots = Arrays.copyOf(SWAP_SLOTS_DEFAULT, SWAP_SLOTS_DEFAULT.length); public static final Queue swapSlotsQueue = new ArrayDeque(); public static File schematicDirectory = SCHEMATIC_DIRECTORY_DEFAULT; - public static String[] extraAirBlocks = EXTRA_AIR_BLOCKS_DEFAULT; + public static String[] extraAirBlocks = Arrays.copyOf(EXTRA_AIR_BLOCKS_DEFAULT, EXTRA_AIR_BLOCKS_DEFAULT.length); public static String sortType = SORT_TYPE_DEFAULT; public static boolean printerEnabled = PRINTER_ENABLED_DEFAULT; public static boolean saveEnabled = SAVE_ENABLED_DEFAULT; From fbfd6528129c45722d2fe9e438e8ad665645a09b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 3 Nov 2015 22:41:08 +0100 Subject: [PATCH 261/314] Add loaded schematic saving. --- .../client/gui/save/GuiSchematicSave.java | 16 +++++++++++----- .../schematica/handler/QueueTickHandler.java | 4 +--- .../world/schematic/SchematicFormat.java | 8 ++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index 441adfee..da1e1df6 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -7,12 +7,14 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; import net.minecraft.util.BlockPos; +import java.io.File; import java.io.IOException; public class GuiSchematicSave extends GuiScreenBase { @@ -88,7 +90,7 @@ public void initGui() { this.textFields.add(this.tfFilename); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format(Names.Gui.Save.SAVE)); - this.btnSave.enabled = ClientProxy.isRenderingGuide; + this.btnSave.enabled = ClientProxy.isRenderingGuide || ClientProxy.schematic != null; this.buttonList.add(this.btnSave); this.tfFilename.setMaxStringLength(1024); @@ -148,12 +150,16 @@ protected void actionPerformed(GuiButton guiButton) { } else if (guiButton.id == this.btnEnable.id) { ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; this.btnEnable.displayString = ClientProxy.isRenderingGuide ? this.strOn : this.strOff; - this.btnSave.enabled = ClientProxy.isRenderingGuide; + this.btnSave.enabled = ClientProxy.isRenderingGuide || ClientProxy.schematic != null; } else if (guiButton.id == this.btnSave.id) { String path = this.tfFilename.getText() + ".schematic"; - if (Schematica.proxy.saveSchematic(this.mc.thePlayer, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { - this.filename = ""; - this.tfFilename.setText(this.filename); + if (ClientProxy.isRenderingGuide) { + if (Schematica.proxy.saveSchematic(this.mc.thePlayer, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { + this.filename = ""; + this.tfFilename.setText(this.filename); + } + } else { + SchematicFormat.writeToFileAndNotify(new File(ConfigurationHandler.schematicDirectory, path), ClientProxy.schematic.getSchematic(), this.mc.thePlayer); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 12f56e8f..d4c48488 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -68,9 +68,7 @@ private void processQueue() { if (container.hasNext()) { this.queue.offer(container); } else { - final boolean success = SchematicFormat.writeToFile(container.file, container.schematic); - final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; - container.player.addChatMessage(new ChatComponentTranslation(message, container.file.getName())); + SchematicFormat.writeToFileAndNotify(container.file, container.schematic, container.player); } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index ac572458..2bc04201 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -4,7 +4,9 @@ import com.github.lunatrius.schematica.api.event.PostSchematicCaptureEvent; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; import net.minecraftforge.common.MinecraftForge; import java.io.DataOutputStream; @@ -73,6 +75,12 @@ public static boolean writeToFile(File directory, String filename, ISchematic sc return writeToFile(new File(directory, filename), schematic); } + public static void writeToFileAndNotify(final File file, final ISchematic schematic, final EntityPlayer player) { + final boolean success = writeToFile(file, schematic); + final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; + player.addChatMessage(new ChatComponentTranslation(message, file.getName())); + } + static { FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); From ff236fa75be0590f915c69943a5cdff7fc578eb3 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 3 Nov 2015 23:06:18 +0100 Subject: [PATCH 262/314] Add an unload button to the control GUI. --- .../client/gui/control/GuiSchematicControl.java | 10 ++++++++++ .../lunatrius/schematica/proxy/ClientProxy.java | 11 ++++++++--- .../lunatrius/schematica/proxy/CommonProxy.java | 3 +++ .../github/lunatrius/schematica/reference/Names.java | 1 + src/main/resources/assets/schematica/lang/en_US.lang | 1 + 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index d66210e0..fcdc4229 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -2,6 +2,7 @@ import com.github.lunatrius.core.client.gui.GuiNumericField; import com.github.lunatrius.core.client.gui.GuiScreenBase; +import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.util.FlipHelper; @@ -30,6 +31,7 @@ public class GuiSchematicControl extends GuiScreenBase { private GuiNumericField numericY = null; private GuiNumericField numericZ = null; + private GuiButton btnUnload = null; private GuiButton btnLayerMode = null; private GuiNumericField nfLayer = null; @@ -45,6 +47,7 @@ public class GuiSchematicControl extends GuiScreenBase { private final String strMoveSchematic = I18n.format(Names.Gui.Control.MOVE_SCHEMATIC); private final String strOperations = I18n.format(Names.Gui.Control.OPERATIONS); + private final String strUnload = I18n.format(Names.Gui.Control.UNLOAD); private final String strAll = I18n.format(Names.Gui.Control.MODE_ALL); private final String strLayers = I18n.format(Names.Gui.Control.MODE_LAYERS); private final String strMaterials = I18n.format(Names.Gui.Control.MATERIALS); @@ -81,6 +84,9 @@ public void initGui() { this.numericZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY + 20, 100, 20); this.buttonList.add(this.numericZ); + this.btnUnload = new GuiButton(id++, this.width - 90, this.height - 200, 80, 20, this.strUnload); + this.buttonList.add(this.btnUnload); + this.btnLayerMode = new GuiButton(id++, this.width - 90, this.height - 150 - 25, 80, 20, this.schematic != null && this.schematic.isRenderingLayer ? this.strLayers : this.strAll); this.buttonList.add(this.btnLayerMode); @@ -115,6 +121,7 @@ public void initGui() { this.numericY.setEnabled(this.schematic != null); this.numericZ.setEnabled(this.schematic != null); + this.btnUnload.enabled = this.schematic != null; this.btnLayerMode.enabled = this.schematic != null; this.nfLayer.setEnabled(this.schematic != null && this.schematic.isRenderingLayer); @@ -169,6 +176,9 @@ protected void actionPerformed(GuiButton guiButton) { } else if (guiButton.id == this.numericZ.id) { this.schematic.position.z = this.numericZ.getValue(); RenderSchematic.INSTANCE.refresh(); + } else if (guiButton.id == this.btnUnload.id) { + Schematica.proxy.unloadSchematic(); + this.mc.displayGuiScreen(this.parentScreen); } else if (guiButton.id == this.btnLayerMode.id) { this.schematic.isRenderingLayer = !this.schematic.isRenderingLayer; this.btnLayerMode.displayString = this.schematic.isRenderingLayer ? this.strLayers : this.strAll; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 074952ce..9a065526 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -216,9 +216,7 @@ public void resetSettings() { ChatEventHandler.INSTANCE.chatLines = 0; SchematicPrinter.INSTANCE.setEnabled(true); - SchematicPrinter.INSTANCE.setSchematic(null); - - schematic = null; + unloadSchematic(); playerPosition.set(0, 0, 0); orientation = null; @@ -229,6 +227,13 @@ public void resetSettings() { updatePoints(); } + @Override + public void unloadSchematic() { + schematic = null; + RenderSchematic.INSTANCE.setWorldAndLoadRenderers(null); + SchematicPrinter.INSTANCE.setSchematic(null); + } + @Override public boolean loadSchematic(EntityPlayer player, File directory, String filename) { ISchematic schematic = SchematicFormat.readFromFile(directory, filename); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index db5e17b2..970267e8 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -96,6 +96,9 @@ public void resetSettings() { this.isLoadEnabled = true; } + public void unloadSchematic() { + } + public void copyChunkToSchematic(final ISchematic schematic, final World world, final int chunkX, final int chunkZ, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { final MBlockPos pos = new MBlockPos(); final MBlockPos localPos = new MBlockPos(); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 378b8ca4..4d051818 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -161,6 +161,7 @@ public static final class Control { public static final String PRINTER = "schematica.gui.printer"; public static final String OPERATIONS = "schematica.gui.operations"; + public static final String UNLOAD = "schematica.gui.unload"; public static final String MODE_ALL = "schematica.gui.all"; public static final String MODE_LAYERS = "schematica.gui.layers"; public static final String HIDE = "schematica.gui.hide"; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index 6a5911e9..b0080352 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -29,6 +29,7 @@ schematica.gui.moveschematic=Move schematic schematica.gui.materials=Materials schematica.gui.printer=Printer schematica.gui.operations=Operations +schematica.gui.unload=Unload schematica.gui.all=ALL schematica.gui.layers=Layers schematica.gui.hide=Hide From 32c813b195303f0c18efa2e65f8ed81102974790 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Nov 2015 03:40:55 +0100 Subject: [PATCH 263/314] Add the locale to all toLowerCase calls. --- .../com/github/lunatrius/schematica/network/PacketHandler.java | 2 +- .../java/com/github/lunatrius/schematica/reference/Names.java | 2 +- .../com/github/lunatrius/schematica/reference/Reference.java | 3 +++ .../github/lunatrius/schematica/util/FileFilterSchematic.java | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java index 674aba8e..bda8feca 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java @@ -12,7 +12,7 @@ import net.minecraftforge.fml.relauncher.Side; public class PacketHandler { - public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID.toLowerCase()); + public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID_LOWER); public static void init() { INSTANCE.registerMessage(MessageCapabilities.class, MessageCapabilities.class, 0, Side.CLIENT); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 4d051818..e52525ee 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -64,7 +64,7 @@ public static final class Category { public static final String PLAYER_QUOTA_KILOBYTES = "playerQuotaKilobytes"; public static final String PLAYER_QUOTA_KILOBYTES_DESC = "Amount of storage provided per-player for schematics on the server."; - public static final String LANG_PREFIX = Reference.MODID.toLowerCase() + ".config"; + public static final String LANG_PREFIX = Reference.MODID_LOWER + ".config"; } public static final class Command { diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java index 7f1c9200..c8366a04 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java @@ -3,8 +3,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.Locale; + public class Reference { public static final String MODID = "Schematica"; + public static final String MODID_LOWER = MODID.toLowerCase(Locale.ENGLISH); public static final String NAME = "Schematica"; public static final String VERSION = "${version}"; public static final String FORGE = "${forgeversion}"; diff --git a/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java index 46ce105b..ddd91463 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java @@ -2,6 +2,7 @@ import java.io.File; import java.io.FileFilter; +import java.util.Locale; public class FileFilterSchematic implements FileFilter { private final boolean directory; @@ -16,6 +17,6 @@ public boolean accept(File file) { return file.isDirectory(); } - return file.getName().toLowerCase().endsWith(".schematic"); + return file.getName().toLowerCase(Locale.ENGLISH).endsWith(".schematic"); } } From 7dc88427c4bef6a8eae6a3d995c8446bbe2bd14d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 21 Dec 2015 20:08:49 +0100 Subject: [PATCH 264/314] Update to 1.8.8. General code cleanup. --- build.gradle | 53 ++++++------- gradle.properties | 10 +-- .../lunatrius/schematica/Schematica.java | 10 +-- .../block/state/BlockStateHelper.java | 21 +++-- .../state/pattern/BlockStateReplacer.java | 17 ++-- .../schematica/client/gui/GuiFactory.java | 28 ------- .../schematica/client/gui/GuiHelper.java | 41 ---------- .../schematica/client/gui/GuiModConfig.java | 30 ------- .../client/gui/config/GuiFactory.java | 38 +++++++++ .../gui/control/GuiSchematicControl.java | 12 +-- .../gui/control/GuiSchematicMaterials.java | 8 +- .../control/GuiSchematicMaterialsSlot.java | 14 ++-- .../client/gui/load/GuiSchematicEntry.java | 6 +- .../client/gui/load/GuiSchematicLoad.java | 42 +++++----- .../client/gui/load/GuiSchematicLoadSlot.java | 28 ++++--- .../client/gui/save/GuiSchematicSave.java | 14 ++-- .../client/printer/SchematicPrinter.java | 16 ++-- .../client/printer/nbtsync/NBTSync.java | 3 +- .../printer/nbtsync/NBTSyncCommandBlock.java | 4 +- .../printer/registry/PlacementData.java | 4 +- .../printer/registry/PlacementRegistry.java | 22 +++--- .../client/renderer/RenderSchematic.java | 28 +++---- .../chunk/OverlayRenderDispatcher.java | 4 +- .../renderer/chunk/overlay/RenderOverlay.java | 13 ++- .../client/renderer/shader/ShaderProgram.java | 18 ++--- .../schematica/client/util/BlockList.java | 2 +- .../schematica/client/util/FlipHelper.java | 21 ++--- .../client/util/RotationHelper.java | 25 ++---- .../client/world/SchematicWorld.java | 43 +++++----- .../world/chunk/ChunkProviderSchematic.java | 21 ++--- .../client/world/chunk/ChunkSchematic.java | 8 +- .../command/CommandSchematicaBase.java | 2 +- .../command/CommandSchematicaDownload.java | 10 +-- .../command/CommandSchematicaList.java | 32 ++++---- .../command/CommandSchematicaRemove.java | 22 +++--- .../command/CommandSchematicaSave.java | 18 ++--- .../client/CommandSchematicaReplace.java | 2 +- .../handler/ConfigurationHandler.java | 15 ++-- .../schematica/handler/DownloadHandler.java | 18 ++--- .../schematica/handler/PlayerHandler.java | 6 +- .../schematica/handler/QueueTickHandler.java | 8 +- .../handler/client/ChatEventHandler.java | 4 +- .../handler/client/InputHandler.java | 4 +- .../handler/client/OverlayHandler.java | 2 +- .../handler/client/RenderTickHandler.java | 2 +- .../handler/client/TickHandler.java | 6 +- .../nbt/NBTConversionException.java | 6 +- .../lunatrius/schematica/nbt/NBTHelper.java | 18 ++--- .../network/message/MessageCapabilities.java | 8 +- .../network/message/MessageDownloadBegin.java | 8 +- .../message/MessageDownloadBeginAck.java | 10 +-- .../network/message/MessageDownloadChunk.java | 16 ++-- .../message/MessageDownloadChunkAck.java | 10 +-- .../network/message/MessageDownloadEnd.java | 12 +-- .../network/transfer/SchematicTransfer.java | 6 +- .../schematica/proxy/ClientProxy.java | 46 ++++++----- .../schematica/proxy/CommonProxy.java | 36 ++++----- .../schematica/proxy/ServerProxy.java | 22 +++--- .../schematica/reference/Reference.java | 2 +- .../schematica/util/FileFilterSchematic.java | 4 +- .../schematica/world/WorldDummy.java | 2 +- .../world/chunk/SchematicContainer.java | 2 +- .../world/schematic/SchematicAlpha.java | 79 ++++++++++--------- .../world/schematic/SchematicClassic.java | 11 +-- .../world/schematic/SchematicFormat.java | 19 ++--- .../world/schematic/SchematicUtil.java | 43 ++++++---- .../schematic/UnsupportedFormatException.java | 2 +- .../world/storage/SaveHandlerSchematic.java | 8 +- .../assets/schematica/lang/ca_ES.lang | 2 + .../assets/schematica/lang/cs_CZ.lang | 2 + .../assets/schematica/lang/da_DK.lang | 2 + .../assets/schematica/lang/de_DE.lang | 2 + .../assets/schematica/lang/en_GB.lang | 2 + .../assets/schematica/lang/en_PT.lang | 2 + .../assets/schematica/lang/es_ES.lang | 2 + .../assets/schematica/lang/es_MX.lang | 2 + .../assets/schematica/lang/fi_FI.lang | 2 + .../assets/schematica/lang/fr_FR.lang | 2 + .../assets/schematica/lang/hu_HU.lang | 2 + .../assets/schematica/lang/it_IT.lang | 2 + .../assets/schematica/lang/ko_KR.lang | 2 + .../assets/schematica/lang/la_LA.lang | 2 + .../assets/schematica/lang/lt_LT.lang | 2 + .../assets/schematica/lang/nl_NL.lang | 2 + .../assets/schematica/lang/no_NO.lang | 2 + .../assets/schematica/lang/pl_PL.lang | 2 + .../assets/schematica/lang/pt_PT.lang | 2 + .../assets/schematica/lang/ru_RU.lang | 2 + .../assets/schematica/lang/sk_SK.lang | 2 + .../assets/schematica/lang/sl_SI.lang | 2 + .../assets/schematica/lang/th_TH.lang | 2 + .../assets/schematica/lang/tr_TR.lang | 2 + .../assets/schematica/lang/uk_UA.lang | 2 + .../assets/schematica/lang/zh_CN.lang | 2 + 94 files changed, 589 insertions(+), 588 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java delete mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java create mode 100644 src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java diff --git a/build.gradle b/build.gradle index 21b38313..9577b50c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ buildscript { repositories { mavenCentral() + jcenter() maven { name = 'forge' url = 'http://files.minecraftforge.net/maven' @@ -11,12 +12,13 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' + classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT' } } -apply plugin: 'forge' -apply plugin: 'curseforge' +apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'com.matthewprenger.cursegradle' ext.build = System.getenv().BUILD_NUMBER ?: 'git' ext.modversion = "${project.version_major}.${project.version_minor}.${project.version_micro}.${build}" @@ -26,13 +28,6 @@ version = "${project.version_minecraft}-${modversion}" compileJava.options.encoding = 'UTF-8' -idea { - module { - downloadSources = true - inheritOutputDirs = true - } -} - minecraft { version = "${project.version_minecraft}-${project.version_forge}" @@ -81,7 +76,7 @@ repositories { } dependencies { - compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev' + deobfCompile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'universal' } def commonManifest = { @@ -96,18 +91,8 @@ jar { manifest commonManifest } -task devJar(dependsOn: 'classes', type: Jar) { - from sourceSets.main.output - from sourceSets.api.output - classifier = 'dev' - manifest commonManifest -} - -task sourceJar(dependsOn: 'classes', type: Jar) { - from sourceSets.main.allSource +sourceJar { from sourceSets.api.allSource - classifier = 'sources' - manifest commonManifest } task apiJar(dependsOn: 'classes', type: Jar) { @@ -117,7 +102,6 @@ task apiJar(dependsOn: 'classes', type: Jar) { } artifacts { - archives devJar archives sourceJar archives apiJar } @@ -131,7 +115,7 @@ if (!project.hasProperty('keystore_alias')) if (!project.hasProperty('keystore_password')) ext.keystore_password = '' -task signJars(dependsOn: ['reobf', 'devJar', 'sourceJar', 'apiJar']) { +task signJars(dependsOn: ['reobfJar', 'sourceJar', 'apiJar']) { inputs.dir jar.destinationDir inputs.file keystore_location inputs.property 'keystore_alias', keystore_alias @@ -178,14 +162,21 @@ task release(dependsOn: 'signJars', type: Copy) { } if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curseforge_id')) { - curse { - dependsOn signJars - releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release' + tasks.curseforge.dependsOn signJars + curseforge { apiKey = project.api_key_curseforge - projectId = project.extra_curseforge_id - changelog = '' - additionalArtifact devJar, sourceJar, apiJar - relatedProject 'lunatriuscore' + project { + id = project.extra_curseforge_id + changelog = '' + releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release' + + addArtifact sourceJar + addArtifact apiJar + + relations { + requiredLibrary 'lunatriuscore' + } + } } } diff --git a/gradle.properties b/gradle.properties index 2d060dbf..b3552cbe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=7 -version_minecraft=1.8 -version_forge=11.14.3.1450 -version_minforge=11.14.1.1390 -version_mappings=stable_16 -version_lunatriuscore=1.1.2.29 +version_minecraft=1.8.8 +version_forge=11.15.0.1636-1.8.8 +version_minforge=11.15.0.1636 +version_mappings=snapshot_20151219 +version_lunatriuscore=1.1.2.31 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/Schematica.java b/src/main/java/com/github/lunatrius/schematica/Schematica.java index 9f341690..a26ccec0 100644 --- a/src/main/java/com/github/lunatrius/schematica/Schematica.java +++ b/src/main/java/com/github/lunatrius/schematica/Schematica.java @@ -22,27 +22,27 @@ public class Schematica { public static CommonProxy proxy; @NetworkCheckHandler - public boolean checkModList(Map versions, Side side) { + public boolean checkModList(final Map versions, final Side side) { return true; } @Mod.EventHandler - public void preInit(FMLPreInitializationEvent event) { + public void preInit(final FMLPreInitializationEvent event) { proxy.preInit(event); } @Mod.EventHandler - public void init(FMLInitializationEvent event) { + public void init(final FMLInitializationEvent event) { proxy.init(event); } @Mod.EventHandler - public void postInit(FMLPostInitializationEvent event) { + public void postInit(final FMLPostInitializationEvent event) { proxy.postInit(event); } @Mod.EventHandler - public void serverStarting(FMLServerStartingEvent event) { + public void serverStarting(final FMLServerStartingEvent event) { proxy.serverStarting(event); } } diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java index ef87183b..8d4ec8fe 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java @@ -1,6 +1,5 @@ package com.github.lunatrius.schematica.block.state; -import com.google.common.collect.ImmutableSet; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; @@ -9,11 +8,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Set; public class BlockStateHelper { - public static IProperty getProperty(final IBlockState blockState, final String name) { - for (final IProperty prop : (Set) blockState.getProperties().keySet()) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static > IProperty getProperty(final IBlockState blockState, final String name) { + for (final IProperty prop : blockState.getPropertyNames()) { if (prop.getName().equals(name)) { return prop; } @@ -22,27 +21,27 @@ public static IProperty getProperty(final IBlockState blockState, final String n return null; } - public static T getPropertyValue(final IBlockState blockState, final String name) { - final IProperty property = getProperty(blockState, name); + public static > T getPropertyValue(final IBlockState blockState, final String name) { + final IProperty property = getProperty(blockState, name); if (property == null) { throw new IllegalArgumentException(name + " does not exist in " + blockState); } - return (T) blockState.getValue(property); + return blockState.getValue(property); } + @SuppressWarnings({ "rawtypes" }) public static List getFormattedProperties(final IBlockState blockState) { final List list = new ArrayList(); - final ImmutableSet> properties = blockState.getProperties().entrySet(); - for (final Map.Entry entry : properties) { + for (final Map.Entry entry : blockState.getProperties().entrySet()) { final IProperty key = entry.getKey(); final Comparable value = entry.getValue(); String formattedValue = value.toString(); - if (value == Boolean.TRUE) { + if (Boolean.TRUE.equals(value)) { formattedValue = EnumChatFormatting.GREEN + formattedValue + EnumChatFormatting.RESET; - } else if (value == Boolean.FALSE) { + } else if (Boolean.FALSE.equals(value)) { formattedValue = EnumChatFormatting.RED + formattedValue + EnumChatFormatting.RESET; } diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java index 38f5bd80..6f2324c6 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java @@ -3,11 +3,11 @@ import com.github.lunatrius.core.exceptions.LocalizedException; import com.github.lunatrius.schematica.reference.Names; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; @@ -23,6 +23,7 @@ private BlockStateReplacer(final IBlockState defaultReplacement) { this.defaultReplacement = defaultReplacement; } + @SuppressWarnings({ "rawtypes" }) public IBlockState getReplacement(final IBlockState original, final Map properties) { IBlockState replacement = this.defaultReplacement; @@ -32,6 +33,7 @@ public IBlockState getReplacement(final IBlockState original, final Map properties) { for (final Map.Entry entry : properties.entrySet()) { try { @@ -47,6 +49,7 @@ public static BlockStateReplacer forBlockState(final IBlockState replacement) { return new BlockStateReplacer(replacement); } + @SuppressWarnings({ "rawtypes", "unchecked" }) public static BlockStateHelper getMatcher(final BlockStateInfo blockStateInfo) { final BlockStateHelper matcher = BlockStateHelper.forBlock(blockStateInfo.block); for (final Map.Entry entry : blockStateInfo.stateData.entrySet()) { @@ -61,6 +64,7 @@ public boolean apply(final Comparable input) { return matcher; } + @SuppressWarnings({ "rawtypes" }) public static BlockStateInfo fromString(final String input) throws LocalizedException { final int start = input.indexOf('['); final int end = input.indexOf(']'); @@ -75,15 +79,17 @@ public static BlockStateInfo fromString(final String input) throws LocalizedExce stateData = ""; } - final Block block = BLOCK_REGISTRY.getRaw(blockName); - if (block == null) { + final ResourceLocation location = new ResourceLocation(blockName); + if (!BLOCK_REGISTRY.containsKey(location)) { throw new LocalizedException(Names.Messages.INVALID_BLOCK, blockName); } + final Block block = BLOCK_REGISTRY.getObject(location); final Map propertyData = parsePropertyData(block.getDefaultState(), stateData, true); return new BlockStateInfo(block, propertyData); } + @SuppressWarnings({ "rawtypes" }) public static Map parsePropertyData(final IBlockState blockState, final String stateData, final boolean strict) throws LocalizedException { final HashMap map = new HashMap(); if (stateData == null || stateData.length() == 0) { @@ -103,9 +109,9 @@ public static Map parsePropertyData(final IBlockState blo return map; } + @SuppressWarnings({ "rawtypes", "unchecked" }) private static boolean putMatchingProperty(final Map map, final IBlockState blockState, final String name, final String value, final boolean strict) throws LocalizedException { - final ImmutableSet properties = blockState.getProperties().keySet(); - for (final IProperty property : properties) { + for (final IProperty property : blockState.getPropertyNames()) { if (property.getName().equalsIgnoreCase(name)) { final Collection allowedValues = property.getAllowedValues(); for (final Comparable allowedValue : allowedValues) { @@ -124,6 +130,7 @@ private static boolean putMatchingProperty(final Map map, return false; } + @SuppressWarnings({ "rawtypes" }) public static class BlockStateInfo { public final Block block; public final Map stateData; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java deleted file mode 100644 index 2b896870..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.lunatrius.schematica.client.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.fml.client.IModGuiFactory; - -import java.util.Set; - -public class GuiFactory implements IModGuiFactory { - @Override - public void initialize(Minecraft minecraftInstance) { - } - - @Override - public Class mainConfigGuiClass() { - return GuiModConfig.class; - } - - @Override - public Set runtimeGuiCategories() { - return null; - } - - @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { - return null; - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java deleted file mode 100644 index 0f92e83d..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiHelper.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.github.lunatrius.schematica.client.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.ItemStack; - -public class GuiHelper { - private static final RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); - - public static void drawItemStack(TextureManager textureManager, FontRenderer fontRenderer, int x, int y, ItemStack itemStack) { - drawItemStackSlot(textureManager, x, y); - - if (itemStack != null && itemStack.getItem() != null) { - GlStateManager.enableRescaleNormal(); - RenderHelper.enableGUIStandardItemLighting(); - renderItem.renderItemIntoGUI(itemStack, x + 2, y + 2); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableRescaleNormal(); - } - } - - public static void drawItemStackSlot(TextureManager textureManager, int x, int y) { - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - textureManager.bindTexture(Gui.statIcons); - Tessellator tessellator = Tessellator.getInstance(); - final WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - worldRenderer.startDrawingQuads(); - worldRenderer.addVertexWithUV(x + 1 + 0, y + 1 + 18, 0, 0 * 0.0078125f, 18 * 0.0078125f); - worldRenderer.addVertexWithUV(x + 1 + 18, y + 1 + 18, 0, 18 * 0.0078125f, 18 * 0.0078125f); - worldRenderer.addVertexWithUV(x + 1 + 18, y + 1 + 0, 0, 18 * 0.0078125f, 0 * 0.0078125f); - worldRenderer.addVertexWithUV(x + 1 + 0, y + 1 + 0, 0, 0 * 0.0078125f, 0 * 0.0078125f); - tessellator.draw(); - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java b/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java deleted file mode 100644 index aff74cde..00000000 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/GuiModConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.github.lunatrius.schematica.client.gui; - -import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.reference.Names; -import com.github.lunatrius.schematica.reference.Reference; -import net.minecraft.client.gui.GuiScreen; -import net.minecraftforge.common.config.ConfigCategory; -import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.fml.client.config.GuiConfig; -import net.minecraftforge.fml.client.config.IConfigElement; - -import java.util.ArrayList; -import java.util.List; - -public class GuiModConfig extends GuiConfig { - public GuiModConfig(GuiScreen guiScreen) { - super(guiScreen, getConfigElements(), Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())); - } - - private static List getConfigElements() { - List elements = new ArrayList(); - for (String name : ConfigurationHandler.configuration.getCategoryNames()) { - final ConfigCategory category = ConfigurationHandler.configuration.getCategory(name).setLanguageKey(Names.Config.LANG_PREFIX + ".category." + name); - if (category.parent == null) { - elements.add(new ConfigElement(category)); - } - } - return elements; - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java b/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java new file mode 100644 index 00000000..2956a007 --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java @@ -0,0 +1,38 @@ +package com.github.lunatrius.schematica.client.gui.config; + +import com.github.lunatrius.core.client.gui.config.GuiConfigComplex; +import com.github.lunatrius.schematica.handler.ConfigurationHandler; +import com.github.lunatrius.schematica.reference.Names; +import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.fml.client.IModGuiFactory; + +import java.util.Set; + +public class GuiFactory implements IModGuiFactory { + @Override + public void initialize(final Minecraft minecraftInstance) { + } + + @Override + public Class mainConfigGuiClass() { + return GuiModConfig.class; + } + + @Override + public Set runtimeGuiCategories() { + return null; + } + + @Override + public RuntimeOptionGuiHandler getHandlerFor(final RuntimeOptionCategoryElement element) { + return null; + } + + public static class GuiModConfig extends GuiConfigComplex { + public GuiModConfig(final GuiScreen guiScreen) { + super(guiScreen, Reference.MODID, ConfigurationHandler.configuration, Names.Config.LANG_PREFIX); + } + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index fcdc4229..49159b91 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -60,7 +60,7 @@ public class GuiSchematicControl extends GuiScreenBase { private final String strOn = I18n.format(Names.Gui.ON); private final String strOff = I18n.format(Names.Gui.OFF); - public GuiSchematicControl(GuiScreen guiScreen) { + public GuiSchematicControl(final GuiScreen guiScreen) { super(guiScreen); this.schematic = ClientProxy.schematic; this.printer = SchematicPrinter.INSTANCE; @@ -149,19 +149,19 @@ public void initGui() { } } - private void setMinMax(GuiNumericField numericField) { + private void setMinMax(final GuiNumericField numericField) { numericField.setMinimum(Constants.World.MINIMUM_COORD); numericField.setMaximum(Constants.World.MAXIMUM_COORD); } - private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, BlockPos point) { + private void setPoint(final GuiNumericField numX, final GuiNumericField numY, final GuiNumericField numZ, final BlockPos point) { numX.setValue(point.getX()); numY.setValue(point.getY()); numZ.setValue(point.getZ()); } @Override - protected void actionPerformed(GuiButton guiButton) { + protected void actionPerformed(final GuiButton guiButton) { if (guiButton.enabled) { if (this.schematic == null) { return; @@ -215,7 +215,7 @@ protected void actionPerformed(GuiButton guiButton) { } else if (guiButton.id == this.btnMaterials.id) { this.mc.displayGuiScreen(new GuiSchematicMaterials(this)); } else if (guiButton.id == this.btnPrint.id && this.printer.isEnabled()) { - boolean isPrinting = this.printer.togglePrinting(); + final boolean isPrinting = this.printer.togglePrinting(); this.btnPrint.displayString = isPrinting ? this.strOn : this.strOff; } } @@ -235,7 +235,7 @@ public void handleKeyboardInput() throws IOException { } @Override - public void drawScreen(int par1, int par2, float par3) { + public void drawScreen(final int par1, final int par2, final float par3) { // drawDefaultBackground(); drawCenteredString(this.fontRendererObj, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index 392dee70..6ed5fcca 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -37,7 +37,7 @@ public class GuiSchematicMaterials extends GuiScreenBase { protected final List blockList; - public GuiSchematicMaterials(GuiScreen guiScreen) { + public GuiSchematicMaterials(final GuiScreen guiScreen) { super(guiScreen); final Minecraft minecraft = Minecraft.getMinecraft(); final SchematicWorld schematic = ClientProxy.schematic; @@ -68,7 +68,7 @@ public void handleMouseInput() throws IOException { } @Override - protected void actionPerformed(GuiButton guiButton) { + protected void actionPerformed(final GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnSort.id) { this.sortType = this.sortType.next(); @@ -89,12 +89,12 @@ protected void actionPerformed(GuiButton guiButton) { } @Override - public void renderToolTip(ItemStack stack, int x, int y) { + public void renderToolTip(final ItemStack stack, final int x, final int y) { super.renderToolTip(stack, x, y); } @Override - public void drawScreen(int x, int y, float partialTicks) { + public void drawScreen(final int x, final int y, final float partialTicks) { this.guiSchematicMaterialsSlot.drawScreen(x, y, partialTicks); drawString(this.fontRendererObj, this.strMaterialName, this.width / 2 - 108, 4, 0x00FFFFFF); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java index a7ad7a9e..1569ae4d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.client.gui.control; -import com.github.lunatrius.schematica.client.gui.GuiHelper; +import com.github.lunatrius.core.client.gui.GuiHelper; import com.github.lunatrius.schematica.client.util.BlockList; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; @@ -15,7 +15,7 @@ class GuiSchematicMaterialsSlot extends GuiSlot { protected int selectedIndex = -1; - public GuiSchematicMaterialsSlot(GuiSchematicMaterials par1) { + public GuiSchematicMaterialsSlot(final GuiSchematicMaterials par1) { super(Minecraft.getMinecraft(), par1.width, par1.height, 16, par1.height - 34, 24); this.guiSchematicMaterials = par1; this.selectedIndex = -1; @@ -27,12 +27,12 @@ protected int getSize() { } @Override - protected void elementClicked(int index, boolean par2, int par3, int par4) { + protected void elementClicked(final int index, final boolean par2, final int par3, final int par4) { this.selectedIndex = index; } @Override - protected boolean isSelected(int index) { + protected boolean isSelected(final int index) { return index == this.selectedIndex; } @@ -41,7 +41,7 @@ protected void drawBackground() { } @Override - protected void drawContainerBackground(Tessellator tessellator) { + protected void drawContainerBackground(final Tessellator tessellator) { } @Override @@ -50,14 +50,14 @@ protected int getScrollBarX() { } @Override - protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouseY) { + protected void drawSlot(final int index, final int x, final int y, final int par4, final int mouseX, final int mouseY) { final BlockList.WrappedItemStack wrappedItemStack = this.guiSchematicMaterials.blockList.get(index); final ItemStack itemStack = wrappedItemStack.itemStack; final String itemName = wrappedItemStack.getItemStackDisplayName(); final String amount = wrappedItemStack.getFormattedAmount(); - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRendererObj, x, y, itemStack); + GuiHelper.drawItemStackWithSlot(this.minecraft.renderEngine, itemStack, x, y); this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, itemName, x + 24, y + 6, 0xFFFFFF); this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amount, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amount), y + 6, 0xFFFFFF); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java index 7df8d896..7b10731f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicEntry.java @@ -9,17 +9,17 @@ public class GuiSchematicEntry { private final ItemStack itemStack; private final boolean isDirectory; - public GuiSchematicEntry(String name, ItemStack itemStack, boolean isDirectory) { + public GuiSchematicEntry(final String name, final ItemStack itemStack, final boolean isDirectory) { this(name, itemStack.getItem(), itemStack.getItemDamage(), isDirectory); } - public GuiSchematicEntry(String name, Item item, int itemDamage, boolean isDirectory) { + public GuiSchematicEntry(final String name, final Item item, final int itemDamage, final boolean isDirectory) { this.name = name; this.isDirectory = isDirectory; this.itemStack = new ItemStack(item, 1, itemDamage); } - public GuiSchematicEntry(String name, Block block, int itemDamage, boolean isDirectory) { + public GuiSchematicEntry(final String name, final Block block, final int itemDamage, final boolean isDirectory) { this.name = name; this.isDirectory = isDirectory; this.itemStack = new ItemStack(block, 1, itemDamage); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java index ae2de327..fedcc35f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java @@ -39,7 +39,7 @@ public class GuiSchematicLoad extends GuiScreenBase { protected File currentDirectory = ConfigurationHandler.schematicDirectory; protected final List schematicFiles = new ArrayList(); - public GuiSchematicLoad(GuiScreen guiScreen) { + public GuiSchematicLoad(final GuiScreen guiScreen) { super(guiScreen); } @@ -65,16 +65,16 @@ public void handleMouseInput() throws IOException { } @Override - protected void actionPerformed(GuiButton guiButton) { + protected void actionPerformed(final GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnOpenDir.id) { boolean retry = false; try { - Class c = Class.forName("java.awt.Desktop"); - Object m = c.getMethod("getDesktop").invoke(null); + final Class c = Class.forName("java.awt.Desktop"); + final Object m = c.getMethod("getDesktop").invoke(null); c.getMethod("browse", URI.class).invoke(m, ConfigurationHandler.schematicDirectory.toURI()); - } catch (Throwable e) { + } catch (final Throwable e) { retry = true; } @@ -94,7 +94,7 @@ protected void actionPerformed(GuiButton guiButton) { } @Override - public void drawScreen(int x, int y, float partialTicks) { + public void drawScreen(final int x, final int y, final float partialTicks) { this.guiSchematicLoadSlot.drawScreen(x, y, partialTicks); drawCenteredString(this.fontRendererObj, this.strTitle, this.width / 2, 4, 0x00FFFFFF); @@ -108,9 +108,15 @@ public void onGuiClosed() { // loadSchematic(); } - protected void changeDirectory(String directory) { + protected void changeDirectory(final String directory) { this.currentDirectory = new File(this.currentDirectory, directory); + try { + this.currentDirectory = this.currentDirectory.getCanonicalFile(); + } catch (final IOException ioe) { + Reference.logger.error("Failed to canonize directory!", ioe); + } + reloadSchematics(); } @@ -124,33 +130,33 @@ protected void reloadSchematics() { if (!this.currentDirectory.getCanonicalPath().equals(ConfigurationHandler.schematicDirectory.getCanonicalPath())) { this.schematicFiles.add(new GuiSchematicEntry("..", Items.lava_bucket, 0, true)); } - } catch (IOException e) { + } catch (final IOException e) { Reference.logger.error("Failed to add GuiSchematicEntry!", e); } - File[] filesFolders = this.currentDirectory.listFiles(FILE_FILTER_FOLDER); + final File[] filesFolders = this.currentDirectory.listFiles(FILE_FILTER_FOLDER); if (filesFolders == null) { Reference.logger.error("listFiles returned null (directory: {})!", this.currentDirectory); } else { - for (File file : filesFolders) { + for (final File file : filesFolders) { if (file == null) { continue; } name = file.getName(); - File[] files = file.listFiles(); + final File[] files = file.listFiles(); item = (files == null || files.length == 0) ? Items.bucket : Items.water_bucket; this.schematicFiles.add(new GuiSchematicEntry(name, item, 0, file.isDirectory())); } } - File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); + final File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); if (filesSchematics == null || filesSchematics.length == 0) { - this.schematicFiles.add(new GuiSchematicEntry(strNoSchematic, Blocks.dirt, 0, false)); + this.schematicFiles.add(new GuiSchematicEntry(this.strNoSchematic, Blocks.dirt, 0, false)); } else { - for (File file : filesSchematics) { + for (final File file : filesSchematics) { name = file.getName(); this.schematicFiles.add(new GuiSchematicEntry(name, SchematicUtil.getIconFromFile(file), file.isDirectory())); @@ -159,19 +165,19 @@ protected void reloadSchematics() { } private void loadSchematic() { - int selectedIndex = this.guiSchematicLoadSlot.selectedIndex; + final int selectedIndex = this.guiSchematicLoadSlot.selectedIndex; try { if (selectedIndex >= 0 && selectedIndex < this.schematicFiles.size()) { - GuiSchematicEntry schematicEntry = this.schematicFiles.get(selectedIndex); + final GuiSchematicEntry schematicEntry = this.schematicFiles.get(selectedIndex); if (Schematica.proxy.loadSchematic(null, this.currentDirectory, schematicEntry.getName())) { - SchematicWorld schematic = ClientProxy.schematic; + final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null) { ClientProxy.moveSchematicToPlayer(schematic); } } } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Failed to load schematic!", e); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java index 0966d3bb..239562f4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.client.gui.load; -import com.github.lunatrius.schematica.client.gui.GuiHelper; +import com.github.lunatrius.core.client.gui.GuiHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; @@ -11,8 +11,9 @@ public class GuiSchematicLoadSlot extends GuiSlot { private final GuiSchematicLoad guiSchematicLoad; protected int selectedIndex = -1; + private long lastClick = 0; - public GuiSchematicLoadSlot(GuiSchematicLoad guiSchematicLoad) { + public GuiSchematicLoadSlot(final GuiSchematicLoad guiSchematicLoad) { super(Minecraft.getMinecraft(), guiSchematicLoad.width, guiSchematicLoad.height, 16, guiSchematicLoad.height - 40, 24); this.guiSchematicLoad = guiSchematicLoad; } @@ -23,18 +24,25 @@ protected int getSize() { } @Override - protected void elementClicked(int index, boolean par2, int par3, int par4) { - GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); + protected void elementClicked(final int slotIndex, final boolean isDoubleClick, final int mouseX, final int mouseY) { + final boolean ignore = Minecraft.getSystemTime() - this.lastClick < 500; + this.lastClick = Minecraft.getSystemTime(); + + if (ignore) { + return; + } + + final GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(slotIndex); if (schematic.isDirectory()) { this.guiSchematicLoad.changeDirectory(schematic.getName()); this.selectedIndex = -1; } else { - this.selectedIndex = index; + this.selectedIndex = slotIndex; } } @Override - protected boolean isSelected(int index) { + protected boolean isSelected(final int index) { return index == this.selectedIndex; } @@ -43,16 +51,16 @@ protected void drawBackground() { } @Override - protected void drawContainerBackground(Tessellator tessellator) { + protected void drawContainerBackground(final Tessellator tessellator) { } @Override - protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouseY) { + protected void drawSlot(final int index, final int x, final int y, final int par4, final int mouseX, final int mouseY) { if (index < 0 || index >= this.guiSchematicLoad.schematicFiles.size()) { return; } - GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); + final GuiSchematicEntry schematic = this.guiSchematicLoad.schematicFiles.get(index); String schematicName = schematic.getName(); if (schematic.isDirectory()) { @@ -61,7 +69,7 @@ protected void drawSlot(int index, int x, int y, int par4, int mouseX, int mouse schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); } - GuiHelper.drawItemStack(this.minecraft.renderEngine, this.minecraft.fontRendererObj, x, y, schematic.getItemStack()); + GuiHelper.drawItemStackWithSlot(this.minecraft.renderEngine, schematic.getItemStack(), x, y); this.guiSchematicLoad.drawString(this.minecraft.fontRendererObj, schematicName, x + 24, y + 6, 0x00FFFFFF); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index da1e1df6..f290fcb9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -46,7 +46,7 @@ public class GuiSchematicSave extends GuiScreenBase { private final String strOn = I18n.format(Names.Gui.ON); private final String strOff = I18n.format(Names.Gui.OFF); - public GuiSchematicSave(GuiScreen guiScreen) { + public GuiSchematicSave(final GuiScreen guiScreen) { super(guiScreen); } @@ -107,19 +107,19 @@ public void initGui() { setPoint(this.numericBX, this.numericBY, this.numericBZ, ClientProxy.pointB); } - private void setMinMax(GuiNumericField numericField) { + private void setMinMax(final GuiNumericField numericField) { numericField.setMinimum(Constants.World.MINIMUM_COORD); numericField.setMaximum(Constants.World.MAXIMUM_COORD); } - private void setPoint(GuiNumericField numX, GuiNumericField numY, GuiNumericField numZ, BlockPos point) { + private void setPoint(final GuiNumericField numX, final GuiNumericField numY, final GuiNumericField numZ, final BlockPos point) { numX.setValue(point.getX()); numY.setValue(point.getY()); numZ.setValue(point.getZ()); } @Override - protected void actionPerformed(GuiButton guiButton) { + protected void actionPerformed(final GuiButton guiButton) { if (guiButton.enabled) { if (guiButton.id == this.btnPointA.id) { ClientProxy.movePointToPlayer(ClientProxy.pointA); @@ -152,7 +152,7 @@ protected void actionPerformed(GuiButton guiButton) { this.btnEnable.displayString = ClientProxy.isRenderingGuide ? this.strOn : this.strOff; this.btnSave.enabled = ClientProxy.isRenderingGuide || ClientProxy.schematic != null; } else if (guiButton.id == this.btnSave.id) { - String path = this.tfFilename.getText() + ".schematic"; + final String path = this.tfFilename.getText() + ".schematic"; if (ClientProxy.isRenderingGuide) { if (Schematica.proxy.saveSchematic(this.mc.thePlayer, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { this.filename = ""; @@ -166,13 +166,13 @@ protected void actionPerformed(GuiButton guiButton) { } @Override - protected void keyTyped(char character, int code) throws IOException { + protected void keyTyped(final char character, final int code) throws IOException { super.keyTyped(character, code); this.filename = this.tfFilename.getText(); } @Override - public void drawScreen(int par1, int par2, float par3) { + public void drawScreen(final int par1, final int par2, final float par3) { // drawDefaultBackground(); drawString(this.fontRendererObj, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 986b30f1..53ef07a1 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -52,7 +52,7 @@ public boolean isEnabled() { return this.isEnabled; } - public void setEnabled(boolean isEnabled) { + public void setEnabled(final boolean isEnabled) { this.isEnabled = isEnabled; } @@ -65,7 +65,7 @@ public boolean isPrinting() { return this.isPrinting; } - public void setPrinting(boolean isPrinting) { + public void setPrinting(final boolean isPrinting) { this.isPrinting = isPrinting; } @@ -73,7 +73,7 @@ public SchematicWorld getSchematic() { return this.schematic; } - public void setSchematic(SchematicWorld schematic) { + public void setSchematic(final SchematicWorld schematic) { this.isPrinting = false; this.schematic = schematic; refresh(); @@ -97,12 +97,12 @@ public boolean print(final WorldClient world, final EntityPlayerSP player) { final int z = (int) Math.floor(dZ); final int range = ConfigurationHandler.placeDistance; - int minX = Math.max(0, x - range); - int maxX = Math.min(this.schematic.getWidth() - 1, x + range); + final int minX = Math.max(0, x - range); + final int maxX = Math.min(this.schematic.getWidth() - 1, x + range); int minY = Math.max(0, y - range); int maxY = Math.min(this.schematic.getHeight() - 1, y + range); - int minZ = Math.max(0, z - range); - int maxZ = Math.min(this.schematic.getLength() - 1, z + range); + final int minZ = Math.max(0, z - range); + final int maxZ = Math.min(this.schematic.getLength() - 1, z + range); if (minX > maxX || minY > maxY || minZ > maxZ) { return false; @@ -135,7 +135,7 @@ public boolean print(final WorldClient world, final EntityPlayerSP player) { if (placeBlock(world, player, pos)) { return syncSlotAndSneaking(player, slot, isSneaking, true); } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Could not place block!", e); return syncSlotAndSneaking(player, slot, isSneaking, false); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java index 9dd7dd50..5d0cd322 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java @@ -3,6 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraft.util.BlockPos; import net.minecraft.world.World; @@ -12,7 +13,7 @@ public abstract class NBTSync { public abstract boolean execute(final EntityPlayer player, final World schematic, final BlockPos pos, final World mcWorld, final BlockPos mcPos); - public final boolean sendPacket(final Packet packet) { + public final boolean sendPacket(final Packet packet) { final NetHandlerPlayClient netHandler = this.minecraft.getNetHandler(); if (netHandler == null) { return false; diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java index 9463a7d9..01527821 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java @@ -20,12 +20,12 @@ public boolean execute(final EntityPlayer player, final World schematic, final B final CommandBlockLogic commandBlockLogic = ((TileEntityCommandBlock) tileEntity).getCommandBlockLogic(); final CommandBlockLogic mcCommandBlockLogic = ((TileEntityCommandBlock) mcTileEntity).getCommandBlockLogic(); - if (!commandBlockLogic.getCustomName().equals(mcCommandBlockLogic.getCustomName())) { + if (!commandBlockLogic.getCommand().equals(mcCommandBlockLogic.getCommand())) { final PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer()); packetBuffer.writeByte(mcCommandBlockLogic.func_145751_f()); mcCommandBlockLogic.func_145757_a(packetBuffer); - packetBuffer.writeString(commandBlockLogic.getCustomName()); + packetBuffer.writeString(commandBlockLogic.getCommand()); packetBuffer.writeBoolean(mcCommandBlockLogic.shouldTrackOutput()); return sendPacket(new C17PacketCustomPayload("MC|AdvCdm", packetBuffer)); diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java index a4f3268f..7bcc7b80 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java @@ -97,8 +97,8 @@ public boolean isValidPlayerFacing(final IBlockState blockState, final EntityPla public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = this.validBlockFacing != null ? this.validBlockFacing.getValidBlockFacings(solidSides, blockState) : new ArrayList(solidSides); - for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { - EnumFacing facing = iterator.next(); + for (final Iterator iterator = list.iterator(); iterator.hasNext(); ) { + final EnumFacing facing = iterator.next(); if (this.offsetY != null) { final float offset = this.offsetY.getOffset(blockState); if (offset < 0.5 && facing == EnumFacing.UP) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 94171845..77ca659e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -82,14 +82,14 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, final IValidPlayerFacing playerFacingLever = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final BlockLever.EnumOrientation value = (BlockLever.EnumOrientation) blockState.getValue(BlockLever.FACING); + final BlockLever.EnumOrientation value = blockState.getValue(BlockLever.FACING); return !value.getFacing().getAxis().isVertical() || BlockLever.EnumOrientation.forFacings(value.getFacing(), player.getHorizontalFacing()) == value; } }; final IValidPlayerFacing playerFacingStandingSign = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final int value = (Integer) blockState.getValue(BlockStandingSign.ROTATION); + final int value = blockState.getValue(BlockStandingSign.ROTATION); final int facing = MathHelper.floor_double((player.rotationYaw + 180.0) * 16.0 / 360.0 + 0.5) & 15; return value == facing; } @@ -105,7 +105,7 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, @Override public float getOffset(final IBlockState blockState) { if (!((BlockSlab) blockState.getBlock()).isDouble()) { - final BlockSlab.EnumBlockHalf half = (BlockSlab.EnumBlockHalf) blockState.getValue(BlockSlab.HALF); + final BlockSlab.EnumBlockHalf half = blockState.getValue(BlockSlab.HALF); return half == BlockSlab.EnumBlockHalf.TOP ? 1 : 0; } @@ -115,14 +115,14 @@ public float getOffset(final IBlockState blockState) { final IOffset offsetStairs = new IOffset() { @Override public float getOffset(final IBlockState blockState) { - final BlockStairs.EnumHalf half = (BlockStairs.EnumHalf) blockState.getValue(BlockStairs.HALF); + final BlockStairs.EnumHalf half = blockState.getValue(BlockStairs.HALF); return half == BlockStairs.EnumHalf.TOP ? 1 : 0; } }; final IOffset offsetTrapDoor = new IOffset() { @Override public float getOffset(final IBlockState blockState) { - final BlockTrapDoor.DoorHalf half = (BlockTrapDoor.DoorHalf) blockState.getValue(BlockTrapDoor.HALF); + final BlockTrapDoor.DoorHalf half = blockState.getValue(BlockTrapDoor.HALF); return half == BlockTrapDoor.DoorHalf.TOP ? 1 : 0; } }; @@ -132,7 +132,7 @@ public float getOffset(final IBlockState blockState) { public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); - final BlockLog.EnumAxis axis = (BlockLog.EnumAxis) blockState.getValue(BlockLog.LOG_AXIS); + final BlockLog.EnumAxis axis = blockState.getValue(BlockLog.LOG_AXIS); for (final EnumFacing side : solidSides) { if (axis != BlockLog.EnumAxis.fromFacingAxis(side.getAxis())) { continue; @@ -149,7 +149,7 @@ public List getValidBlockFacings(final List solidSides, public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); - final EnumFacing.Axis axis = (EnumFacing.Axis) blockState.getValue(BlockRotatedPillar.AXIS); + final EnumFacing.Axis axis = blockState.getValue(BlockRotatedPillar.AXIS); for (final EnumFacing side : solidSides) { if (axis != side.getAxis()) { continue; @@ -163,6 +163,7 @@ public List getValidBlockFacings(final List solidSides, }; final IValidBlockFacing blockFacingOpposite = new IValidBlockFacing() { @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); @@ -183,6 +184,7 @@ public List getValidBlockFacings(final List solidSides, }; final IValidBlockFacing blockFacingSame = new IValidBlockFacing() { @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); @@ -206,7 +208,7 @@ public List getValidBlockFacings(final List solidSides, public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); - final EnumFacing facing = (EnumFacing) blockState.getValue(BlockHopper.FACING); + final EnumFacing facing = blockState.getValue(BlockHopper.FACING); for (final EnumFacing side : solidSides) { if (facing != side) { continue; @@ -223,7 +225,7 @@ public List getValidBlockFacings(final List solidSides, public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); - final BlockLever.EnumOrientation facing = (BlockLever.EnumOrientation) blockState.getValue(BlockLever.FACING); + final BlockLever.EnumOrientation facing = blockState.getValue(BlockLever.FACING); for (final EnumFacing side : solidSides) { if (facing.getFacing().getOpposite() != side) { continue; @@ -240,7 +242,7 @@ public List getValidBlockFacings(final List solidSides, public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { final List list = new ArrayList(); - final BlockQuartz.EnumType variant = (BlockQuartz.EnumType) blockState.getValue(BlockQuartz.VARIANT); + final BlockQuartz.EnumType variant = blockState.getValue(BlockQuartz.VARIANT); for (final EnumFacing side : solidSides) { if (variant == BlockQuartz.EnumType.LINES_X && side.getAxis() != EnumFacing.Axis.X) { continue; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 8cb98221..2457d823 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -55,8 +55,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL20; +import org.lwjgl.util.vector.Vector3f; -import javax.vecmath.Vector3f; import java.util.EnumSet; import java.util.Iterator; import java.util.LinkedList; @@ -262,21 +262,21 @@ private void renderOverlay(final SchematicWorld schematic, final boolean isRende tessellator.setDelta(ConfigurationHandler.blockDelta); if (ClientProxy.isRenderingGuide) { - tessellator.startQuads(); - tessellator.drawCuboid(ClientProxy.pointA, GeometryMasks.Quad.ALL, 0xBF0000, 0x3F); - tessellator.drawCuboid(ClientProxy.pointB, GeometryMasks.Quad.ALL, 0x0000BF, 0x3F); + tessellator.beginQuads(); + tessellator.drawCuboid(ClientProxy.pointA, GeometryMasks.Quad.ALL, 0x3FBF0000); + tessellator.drawCuboid(ClientProxy.pointB, GeometryMasks.Quad.ALL, 0x3F0000BF); tessellator.draw(); } - tessellator.startLines(); + tessellator.beginLines(); if (ClientProxy.isRenderingGuide) { - tessellator.drawCuboid(ClientProxy.pointA, GeometryMasks.Line.ALL, 0xBF0000, 0x3F); - tessellator.drawCuboid(ClientProxy.pointB, GeometryMasks.Line.ALL, 0x0000BF, 0x3F); - tessellator.drawCuboid(ClientProxy.pointMin, ClientProxy.pointMax, GeometryMasks.Line.ALL, 0x00BF00, 0x7F); + tessellator.drawCuboid(ClientProxy.pointA, GeometryMasks.Line.ALL, 0x3FBF0000); + tessellator.drawCuboid(ClientProxy.pointB, GeometryMasks.Line.ALL, 0x3F0000BF); + tessellator.drawCuboid(ClientProxy.pointMin, ClientProxy.pointMax, GeometryMasks.Line.ALL, 0x7F00BF00); } if (isRenderingSchematic) { this.tmp.set(schematic.position.x + schematic.getWidth() - 1, schematic.position.y + schematic.getHeight() - 1, schematic.position.z + schematic.getLength() - 1); - tessellator.drawCuboid(schematic.position, this.tmp, GeometryMasks.Line.ALL, 0xBF00BF, 0x7F); + tessellator.drawCuboid(schematic.position, this.tmp, GeometryMasks.Line.ALL, 0x7FBF00BF); } tessellator.draw(); @@ -444,7 +444,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, RenderHelper.enableStandardItemLighting(); for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { - for (final TileEntity tileEntity : (List) renderInfo.renderChunk.getCompiledChunk().getTileEntities()) { + for (final TileEntity tileEntity : renderInfo.renderChunk.getCompiledChunk().getTileEntities()) { final AxisAlignedBB renderBB = tileEntity.getRenderBoundingBox(); this.countTileEntitiesTotal++; @@ -616,13 +616,13 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final RenderChunk renderChunk = renderInfo.renderChunk; final RenderOverlay renderOverlay = renderInfo.renderOverlay; - if (renderChunk.isNeedsUpdate() || renderChunk.isCompileTaskPending() || set.contains(renderChunk)) { + if (renderChunk.isNeedsUpdate() || set.contains(renderChunk)) { this.displayListEntitiesDirty = true; this.chunksToUpdate.add(renderChunk); } - if (renderOverlay.isNeedsUpdate() || renderOverlay.isCompileTaskPending() || set1.contains(renderOverlay)) { + if (renderOverlay.isNeedsUpdate() || set1.contains(renderOverlay)) { this.displayListEntitiesDirty = true; this.overlaysToUpdate.add(renderOverlay); @@ -638,7 +638,7 @@ private Set getVisibleSides(final BlockPos pos) { final VisGraph visgraph = new VisGraph(); final BlockPos posChunk = new BlockPos(pos.getX() & ~0xF, pos.getY() & ~0xF, pos.getZ() & ~0xF); - for (final BlockPos.MutableBlockPos mutableBlockPos : (Iterable) BlockPos.getAllInBoxMutable(posChunk, posChunk.add(15, 15, 15))) { + for (final BlockPos.MutableBlockPos mutableBlockPos : BlockPos.getAllInBoxMutable(posChunk, posChunk.add(15, 15, 15))) { if (this.world.getBlockState(mutableBlockPos).getBlock().isOpaqueCube()) { visgraph.func_178606_a(mutableBlockPos); } @@ -860,7 +860,7 @@ public void deleteAllDisplayLists() {} public void broadcastSound(final int p_180440_1_, final BlockPos pos, final int p_180440_3_) {} @Override - public void playAusSFX(final EntityPlayer player, final int p_180439_2_, final BlockPos pos, final int p_180439_4_) {} + public void playAuxSFX(final EntityPlayer player, final int sfxType, final BlockPos blockPosIn, final int p_180439_4_) {} @Override public void sendBlockBreakProgress(final int breakerId, final BlockPos pos, final int progress) {} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java index 32d99738..a429bba2 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java @@ -14,7 +14,7 @@ public class OverlayRenderDispatcher extends ChunkRenderDispatcher { @Override - public ListenableFuture uploadChunk(final EnumWorldBlockLayer layer, final WorldRenderer worldRenderer, final RenderChunk renderChunk, final CompiledChunk compiledChunk) { + public ListenableFuture uploadChunk(final EnumWorldBlockLayer layer, final WorldRenderer worldRenderer, final RenderChunk renderChunk, final CompiledChunk compiledChunk) { if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { if (OpenGlHelper.useVbo()) { uploadVertexBuffer(worldRenderer, renderChunk.getVertexBufferByLayer(layer.ordinal())); @@ -25,7 +25,7 @@ public ListenableFuture uploadChunk(final EnumWorldBlockLayer layer, final World worldRenderer.setTranslation(0.0, 0.0, 0.0); return Futures.immediateFuture(null); } else { - final ListenableFutureTask listenableFutureTask = ListenableFutureTask.create(new Runnable() { + final ListenableFutureTask listenableFutureTask = ListenableFutureTask.create(new Runnable() { @Override public void run() { uploadChunk(layer, worldRenderer, renderChunk, compiledChunk); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index a8a0d7ea..d2505621 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -2,7 +2,6 @@ import com.github.lunatrius.core.client.renderer.GeometryMasks; import com.github.lunatrius.core.client.renderer.GeometryTessellator; -import com.github.lunatrius.core.client.renderer.vertex.VertexFormats; import com.github.lunatrius.schematica.client.renderer.chunk.CompiledOverlay; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.handler.ConfigurationHandler; @@ -17,6 +16,7 @@ import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.VisGraph; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; @@ -29,7 +29,7 @@ public class RenderOverlay extends RenderChunk { public RenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { super(world, renderGlobal, pos, index); - this.vertexBuffer = OpenGlHelper.useVbo() ? new VertexBuffer(VertexFormats.ABSTRACT) : null; + this.vertexBuffer = OpenGlHelper.useVbo() ? new VertexBuffer(DefaultVertexFormats.POSITION_COLOR) : null; } @Override @@ -74,7 +74,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun GeometryTessellator.setStaticDelta(ConfigurationHandler.blockDelta); - for (BlockPos pos : (Iterable) BlockPos.getAllInBox(from, to)) { + for (final BlockPos pos : BlockPos.getAllInBox(from, to)) { if (schematic.isRenderingLayer && schematic.renderingLayer != pos.getY() || !schematic.isInside(pos)) { continue; } @@ -154,7 +154,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun preRenderBlocks(worldRenderer, from); } - GeometryTessellator.drawCuboid(worldRenderer, GL11.GL_QUADS, pos, sides, color, 0x3F); + GeometryTessellator.drawCuboid(worldRenderer, pos, sides, 0x3F000000 | color); compiledOverlay.setLayerUsed(layer); } } @@ -169,9 +169,8 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun @Override public void preRenderBlocks(final WorldRenderer worldRenderer, final BlockPos pos) { - super.preRenderBlocks(worldRenderer, pos); - - worldRenderer.setVertexFormat(VertexFormats.ABSTRACT); + worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ()); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java index 1bfd738c..b25858d1 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/shader/ShaderProgram.java @@ -16,7 +16,7 @@ public class ShaderProgram { private int program; - public ShaderProgram(String domain, String vertShaderFilename, String fragShaderFilename) { + public ShaderProgram(final String domain, final String vertShaderFilename, final String fragShaderFilename) { try { init(domain, vertShaderFilename, fragShaderFilename); if (this.program > 0) { @@ -24,13 +24,13 @@ public ShaderProgram(String domain, String vertShaderFilename, String fragShader GL20.glUniform1i(GL20.glGetUniformLocation(this.program, "texture"), 0); GL20.glUseProgram(0); } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Could not initialize shader program!", e); this.program = 0; } } - private void init(String domain, String vertShaderFilename, String fragShaderFilename) { + private void init(final String domain, final String vertShaderFilename, final String fragShaderFilename) { if (!OpenGlHelper.shadersSupported) { this.program = 0; return; @@ -38,8 +38,8 @@ private void init(String domain, String vertShaderFilename, String fragShaderFil this.program = GL20.glCreateProgram(); - int vertShader = loadAndCompileShader(domain, vertShaderFilename, GL20.GL_VERTEX_SHADER); - int fragShader = loadAndCompileShader(domain, fragShaderFilename, GL20.GL_FRAGMENT_SHADER); + final int vertShader = loadAndCompileShader(domain, vertShaderFilename, GL20.GL_VERTEX_SHADER); + final int fragShader = loadAndCompileShader(domain, fragShaderFilename, GL20.GL_FRAGMENT_SHADER); if (vertShader != 0) { GL20.glAttachShader(this.program, vertShader); @@ -67,7 +67,7 @@ private void init(String domain, String vertShaderFilename, String fragShaderFil } } - private int loadAndCompileShader(String domain, String filename, int shaderType) { + private int loadAndCompileShader(final String domain, final String filename, final int shaderType) { if (filename == null) { return 0; } @@ -79,7 +79,7 @@ private int loadAndCompileShader(String domain, String filename, int shaderType) return 0; } - String code = loadFile(new ResourceLocation(domain, filename)); + final String code = loadFile(new ResourceLocation(domain, filename)); if (code == null) { GL20.glDeleteShader(handle); return 0; @@ -97,7 +97,7 @@ private int loadAndCompileShader(String domain, String filename, int shaderType) return handle; } - private String loadFile(ResourceLocation resourceLocation) { + private String loadFile(final ResourceLocation resourceLocation) { try { final StringBuilder code = new StringBuilder(); final InputStream inputStream = MINECRAFT.getResourceManager().getResource(resourceLocation).getInputStream(); @@ -111,7 +111,7 @@ private String loadFile(ResourceLocation resourceLocation) { reader.close(); return code.toString(); - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Could not load shader file!", e); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 15f9bfba..160929e3 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -48,7 +48,7 @@ public List getList(final EntityPlayer player, final Schematic ItemStack stack = null; try { - stack = block.getPickBlock(movingObjectPosition, world, pos); + stack = block.getPickBlock(movingObjectPosition, world, pos, player); } catch (final Exception e) { Reference.logger.debug("Could not get the pick block for: {}", blockState, e); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java index a0b788e5..4c481912 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java @@ -3,6 +3,7 @@ import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.storage.Schematic; @@ -20,7 +21,6 @@ import net.minecraftforge.fml.common.registry.GameData; import java.util.List; -import java.util.Set; public class FlipHelper { public static final FlipHelper INSTANCE = new FlipHelper(); @@ -52,7 +52,7 @@ public boolean flip(final SchematicWorld world, final EnumFacing axis, final boo return false; } - public Schematic flip(final ISchematic schematic, final EnumFacing axis, boolean forced) throws FlipException { + public Schematic flip(final ISchematic schematic, final EnumFacing axis, final boolean forced) throws FlipException { final Vec3i dimensionsFlipped = new Vec3i(schematic.getWidth(), schematic.getHeight(), schematic.getLength()); final Schematic schematicFlipped = new Schematic(schematic.getIcon(), dimensionsFlipped.getX(), dimensionsFlipped.getY(), dimensionsFlipped.getZ()); final MBlockPos tmp = new MBlockPos(); @@ -91,8 +91,9 @@ private BlockPos flipPos(final BlockPos pos, final EnumFacing axis, final Vec3i throw new FlipException("'%s' is not a valid axis!", axis.getName()); } - private IBlockState flipBlock(final IBlockState blockState, final EnumFacing axis, boolean forced) throws FlipException { - final IProperty propertyFacing = getProperty(blockState, "facing"); + @SuppressWarnings({ "rawtypes", "unchecked" }) + private IBlockState flipBlock(final IBlockState blockState, final EnumFacing axis, final boolean forced) throws FlipException { + final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); if (propertyFacing instanceof PropertyDirection) { final Comparable value = blockState.getValue(propertyFacing); if (value instanceof EnumFacing) { @@ -120,16 +121,6 @@ private IBlockState flipBlock(final IBlockState blockState, final EnumFacing axi return blockState; } - private IProperty getProperty(final IBlockState blockState, final String name) { - for (final IProperty prop : (Set) blockState.getProperties().keySet()) { - if (prop.getName().equals(name)) { - return prop; - } - } - - return null; - } - private static EnumFacing getFlippedFacing(final EnumFacing axis, final EnumFacing side) { if (axis.getAxis() == side.getAxis()) { return side.getOpposite(); @@ -157,7 +148,7 @@ private static BlockLever.EnumOrientation getFlippedLeverFacing(final EnumFacing } public static class FlipException extends Exception { - public FlipException(String message, Object... args) { + public FlipException(final String message, final Object... args) { super(String.format(message, args)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index 08217816..a84a7fc1 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -3,6 +3,7 @@ import com.github.lunatrius.core.util.BlockPosHelper; import com.github.lunatrius.core.util.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.storage.Schematic; @@ -22,7 +23,6 @@ import net.minecraftforge.fml.common.registry.GameData; import java.util.List; -import java.util.Set; public class RotationHelper { public static final RotationHelper INSTANCE = new RotationHelper(); @@ -88,7 +88,7 @@ private void updatePosition(final SchematicWorld world, final EnumFacing axis) { } } - public Schematic rotate(final ISchematic schematic, final EnumFacing axis, boolean forced) throws RotationException { + public Schematic rotate(final ISchematic schematic, final EnumFacing axis, final boolean forced) throws RotationException { final Vec3i dimensionsRotated = rotateDimensions(axis, schematic.getWidth(), schematic.getHeight(), schematic.getLength()); final Schematic schematicRotated = new Schematic(schematic.getIcon(), dimensionsRotated.getX(), dimensionsRotated.getY(), dimensionsRotated.getZ()); final MBlockPos tmp = new MBlockPos(); @@ -151,8 +151,9 @@ private BlockPos rotatePos(final BlockPos pos, final EnumFacing axis, final Vec3 throw new RotationException("'%s' is not a valid axis!", axis.getName()); } - private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing axisRotation, boolean forced) throws RotationException { - final IProperty propertyFacing = getProperty(blockState, "facing"); + @SuppressWarnings({ "rawtypes", "unchecked" }) + private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing axisRotation, final boolean forced) throws RotationException { + final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); if (propertyFacing instanceof PropertyDirection) { final Comparable value = blockState.getValue(propertyFacing); if (value instanceof EnumFacing) { @@ -173,7 +174,7 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a Reference.logger.error("'{}': found 'facing' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); } - final IProperty propertyAxis = getProperty(blockState, "axis"); + final IProperty propertyAxis = BlockStateHelper.getProperty(blockState, "axis"); if (propertyAxis instanceof PropertyEnum) { if (EnumFacing.Axis.class.isAssignableFrom(propertyAxis.getValueClass())) { final EnumFacing.Axis axis = (EnumFacing.Axis) blockState.getValue(propertyAxis); @@ -190,7 +191,7 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a Reference.logger.error("'{}': found 'axis' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyAxis.getClass().getSimpleName()); } - final IProperty propertyVariant = getProperty(blockState, "variant"); + final IProperty propertyVariant = BlockStateHelper.getProperty(blockState, "variant"); if (propertyVariant instanceof PropertyEnum) { if (BlockQuartz.EnumType.class.isAssignableFrom(propertyVariant.getValueClass())) { final BlockQuartz.EnumType type = (BlockQuartz.EnumType) blockState.getValue(propertyVariant); @@ -206,16 +207,6 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a return blockState; } - private IProperty getProperty(final IBlockState blockState, final String name) { - for (final IProperty prop : (Set) blockState.getProperties().keySet()) { - if (prop.getName().equals(name)) { - return prop; - } - } - - return null; - } - private static EnumFacing getRotatedFacing(final EnumFacing source, final EnumFacing side) { return FACINGS[source.ordinal()][side.ordinal()]; } @@ -308,7 +299,7 @@ private static BlockLever.EnumOrientation getRotatedLeverFacing(final EnumFacing } public static class RotationException extends Exception { - public RotationException(String message, Object... args) { + public RotationException(final String message, final Object... args) { super(String.format(message, args)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 16183278..29552ef4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -39,11 +39,11 @@ public class SchematicWorld extends WorldClient { public boolean isRenderingLayer; public int renderingLayer; - public SchematicWorld(ISchematic schematic) { + public SchematicWorld(final ISchematic schematic) { super(null, WORLD_SETTINGS, 0, EnumDifficulty.PEACEFUL, Minecraft.getMinecraft().mcProfiler); this.schematic = schematic; - for (TileEntity tileEntity : schematic.getTileEntities()) { + for (final TileEntity tileEntity : schematic.getTileEntities()) { initializeTileEntity(tileEntity); } @@ -53,7 +53,7 @@ public SchematicWorld(ISchematic schematic) { } @Override - public IBlockState getBlockState(BlockPos pos) { + public IBlockState getBlockState(final BlockPos pos) { if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { return Blocks.air.getDefaultState(); } @@ -62,12 +62,12 @@ public IBlockState getBlockState(BlockPos pos) { } @Override - public boolean setBlockState(BlockPos pos, IBlockState state, int flags) { + public boolean setBlockState(final BlockPos pos, final IBlockState state, final int flags) { return this.schematic.setBlockState(pos, state); } @Override - public TileEntity getTileEntity(BlockPos pos) { + public TileEntity getTileEntity(final BlockPos pos) { if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { return null; } @@ -76,29 +76,29 @@ public TileEntity getTileEntity(BlockPos pos) { } @Override - public void setTileEntity(BlockPos pos, TileEntity tileEntity) { + public void setTileEntity(final BlockPos pos, final TileEntity tileEntity) { this.schematic.setTileEntity(pos, tileEntity); initializeTileEntity(tileEntity); } @Override - public void removeTileEntity(BlockPos pos) { + public void removeTileEntity(final BlockPos pos) { this.schematic.removeTileEntity(pos); } @SideOnly(Side.CLIENT) @Override - public int getLightFromNeighborsFor(EnumSkyBlock type, BlockPos pos) { + public int getLightFromNeighborsFor(final EnumSkyBlock type, final BlockPos pos) { return 15; } @Override - public float getLightBrightness(BlockPos pos) { + public float getLightBrightness(final BlockPos pos) { return 1.0f; } @Override - public boolean isBlockNormalCube(BlockPos pos, boolean _default) { + public boolean isBlockNormalCube(final BlockPos pos, final boolean _default) { return getBlockState(pos).getBlock().isNormalCube(this, pos); } @@ -109,7 +109,7 @@ public void calculateInitialSkylight() {} protected void calculateInitialWeather() {} @Override - public void setSpawnPoint(BlockPos pos) {} + public void setSpawnPoint(final BlockPos pos) {} @Override protected int getRenderDistanceChunks() { @@ -117,12 +117,12 @@ protected int getRenderDistanceChunks() { } @Override - public boolean isAirBlock(BlockPos pos) { + public boolean isAirBlock(final BlockPos pos) { return getBlockState(pos).getBlock().isAir(this, pos); } @Override - public BiomeGenBase getBiomeGenForCoords(BlockPos pos) { + public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { return BiomeGenBase.jungle; } @@ -151,21 +151,21 @@ protected IChunkProvider createChunkProvider() { } @Override - public Entity getEntityByID(int id) { + public Entity getEntityByID(final int id) { return null; } @Override - public boolean isSideSolid(BlockPos pos, EnumFacing side) { + public boolean isSideSolid(final BlockPos pos, final EnumFacing side) { return isSideSolid(pos, side, false); } @Override - public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) { + public boolean isSideSolid(final BlockPos pos, final EnumFacing side, final boolean _default) { return getBlockState(pos).getBlock().isSideSolid(this, pos, side); } - public void setSchematic(ISchematic schematic) { + public void setSchematic(final ISchematic schematic) { this.schematic = schematic; } @@ -173,18 +173,18 @@ public ISchematic getSchematic() { return this.schematic; } - public void initializeTileEntity(TileEntity tileEntity) { + public void initializeTileEntity(final TileEntity tileEntity) { tileEntity.setWorldObj(this); tileEntity.getBlockType(); try { tileEntity.invalidate(); tileEntity.validate(); - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("TileEntity validation for {} failed!", tileEntity.getClass(), e); } } - public void setIcon(ItemStack icon) { + public void setIcon(final ItemStack icon) { this.schematic.setIcon(icon); } @@ -205,6 +205,7 @@ public String getDebugDimensions() { return "WHL: " + getWidth() + " / " + getHeight() + " / " + getLength(); } + @SuppressWarnings({ "rawtypes", "unchecked" }) public int replaceBlock(final BlockStateHelper matcher, final BlockStateReplacer replacer, final Map properties) { int count = 0; @@ -216,7 +217,7 @@ public int replaceBlock(final BlockStateHelper matcher, final BlockStateReplacer continue; } - if (matcher.matchesState(blockState)) { + if (matcher.apply(blockState)) { final IBlockState replacement = replacer.getReplacement(blockState, properties); // TODO: add support for tile entities? diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index 13e113bb..dbbfdf8b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -6,6 +6,7 @@ import net.minecraft.util.IProgressUpdate; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.IChunkProvider; @@ -19,18 +20,18 @@ public class ChunkProviderSchematic implements IChunkProvider { private final Chunk emptyChunk; private final Map chunks = new ConcurrentHashMap(); - public ChunkProviderSchematic(SchematicWorld world) { + public ChunkProviderSchematic(final SchematicWorld world) { this.world = world; this.emptyChunk = new EmptyChunk(world, 0, 0); } @Override - public boolean chunkExists(int x, int z) { + public boolean chunkExists(final int x, final int z) { return x >= 0 && z >= 0 && x < this.world.getWidth() && z < this.world.getLength(); } @Override - public Chunk provideChunk(int x, int z) { + public Chunk provideChunk(final int x, final int z) { if (chunkExists(x, z)) { final long key = ChunkCoordIntPair.chunkXZ2Int(x, z); @@ -47,20 +48,20 @@ public Chunk provideChunk(int x, int z) { } @Override - public Chunk provideChunk(BlockPos pos) { + public Chunk provideChunk(final BlockPos pos) { return provideChunk(pos.getX() >> 4, pos.getZ() >> 4); } @Override - public void populate(IChunkProvider provider, int x, int z) {} + public void populate(final IChunkProvider provider, final int x, final int z) {} @Override - public boolean func_177460_a(IChunkProvider chunkProvider, Chunk chunk, int x, int z) { + public boolean func_177460_a(final IChunkProvider chunkProvider, final Chunk chunk, final int x, final int z) { return false; } @Override - public boolean saveChunks(boolean saveExtra, IProgressUpdate progressUpdate) { + public boolean saveChunks(final boolean saveExtra, final IProgressUpdate progressUpdate) { return true; } @@ -80,12 +81,12 @@ public String makeString() { } @Override - public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { + public List getPossibleCreatures(final EnumCreatureType creatureType, final BlockPos pos) { return null; } @Override - public BlockPos getStrongholdGen(World world, String name, BlockPos pos) { + public BlockPos getStrongholdGen(final World world, final String name, final BlockPos pos) { return null; } @@ -95,7 +96,7 @@ public int getLoadedChunkCount() { } @Override - public void recreateStructures(Chunk chunk, int x, int z) { } + public void recreateStructures(final Chunk chunk, final int x, final int z) { } @Override public void saveExtraData() {} diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java index a72f6526..6787983c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java @@ -9,7 +9,7 @@ public class ChunkSchematic extends Chunk { private final World world; - public ChunkSchematic(World world, int x, int z) { + public ChunkSchematic(final World world, final int x, final int z) { super(world, x, z); this.world = world; } @@ -23,17 +23,17 @@ public void generateSkylightMap() { } @Override - public IBlockState getBlockState(BlockPos pos) { + public IBlockState getBlockState(final BlockPos pos) { return this.world.getBlockState(pos); } @Override - public boolean getAreLevelsEmpty(int startY, int endY) { + public boolean getAreLevelsEmpty(final int startY, final int endY) { return false; } @Override - public TileEntity getTileEntity(BlockPos pos, EnumCreateEntityType createEntityType) { + public TileEntity getTileEntity(final BlockPos pos, final EnumCreateEntityType createEntityType) { return this.world.getTileEntity(pos); } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java index 53535dd1..cdd041d9 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java @@ -11,7 +11,7 @@ public int getRequiredPermissionLevel() { } @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { + public boolean canCommandSenderUseCommand(final ICommandSender sender) { // TODO: add logic for the client side when ready return super.canCommandSenderUseCommand(sender) || (sender instanceof EntityPlayerMP && getRequiredPermissionLevel() <= 0); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 55eca1be..2f2d9b31 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -31,12 +31,12 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getCommandUsage(final ICommandSender sender) { return Names.Command.Download.Message.USAGE; } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + public List addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) { if (!(sender instanceof EntityPlayer)) { return null; } @@ -47,7 +47,7 @@ public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockP if (files != null) { final List filenames = new ArrayList(); - for (File file : files) { + for (final File file : files) { filenames.add(FilenameUtils.removeExtension(file.getName())); } @@ -58,7 +58,7 @@ public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockP } @Override - public void processCommand(ICommandSender sender, String[] args) throws CommandException { + public void processCommand(final ICommandSender sender, final String[] args) throws CommandException { if (args.length < 1) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -71,7 +71,7 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE final EntityPlayerMP player = (EntityPlayerMP) sender; final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (!FileUtils.contains(directory, filename)) { - Reference.logger.error("{} has tried to download the file {}", player.getCommandSenderName(), filename); + Reference.logger.error("{} has tried to download the file {}", player.getName(), filename); throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 1c50631b..9688fa76 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -29,12 +29,12 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getCommandUsage(final ICommandSender sender) { return Names.Command.List.Message.USAGE; } @Override - public void processCommand(ICommandSender sender, String[] arguments) throws CommandException { + public void processCommand(final ICommandSender sender, final String[] arguments) throws CommandException { if (!(sender instanceof EntityPlayer)) { throw new CommandException(Names.Command.Save.Message.PLAYERS_ONLY); } @@ -47,19 +47,19 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com page = 0; } } - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { throw new WrongUsageException(getCommandUsage(sender)); } final EntityPlayer player = (EntityPlayer) sender; - int pageSize = 9; //maximum number of lines available without opening chat. - int pageStart = page * pageSize; - int pageEnd = pageStart + pageSize; + final int pageSize = 9; //maximum number of lines available without opening chat. + final int pageStart = page * pageSize; + final int pageEnd = pageStart + pageSize; int currentFile = 0; - LinkedList componentsToSend = new LinkedList(); + final LinkedList componentsToSend = new LinkedList(); - File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + final File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (schematicDirectory == null) { Reference.logger.warn("Unable to determine the schematic directory for player {}", player); throw new CommandException(Names.Command.Save.Message.PLAYER_SCHEMATIC_DIR_UNAVAILABLE); @@ -73,14 +73,14 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com } final File[] files = schematicDirectory.listFiles(FILE_FILTER_SCHEMATIC); - for (File path : files) { + for (final File path : files) { if (currentFile >= pageStart && currentFile < pageEnd) { - String fileName = FilenameUtils.removeExtension(path.getName()); + final String fileName = FilenameUtils.removeExtension(path.getName()); - IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), fileName)); - String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); + final IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), fileName)); + final String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); - IChatComponent removeLink = new ChatComponentTranslation(Names.Command.List.Message.REMOVE) + final IChatComponent removeLink = new ChatComponentTranslation(Names.Command.List.Message.REMOVE) .setChatStyle( new ChatStyle() .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, removeCommand)) @@ -89,8 +89,8 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com chatComponent.appendSibling(removeLink); chatComponent.appendText("]["); - String downloadCommand = String.format("/%s %s", Names.Command.Download.NAME, fileName); - IChatComponent downloadLink = new ChatComponentTranslation(Names.Command.List.Message.DOWNLOAD) + final String downloadCommand = String.format("/%s %s", Names.Command.Download.NAME, fileName); + final IChatComponent downloadLink = new ChatComponentTranslation(Names.Command.List.Message.DOWNLOAD) .setChatStyle( new ChatStyle() .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, downloadCommand)) @@ -116,7 +116,7 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1) .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_GREEN))); - for (IChatComponent chatComponent : componentsToSend) { + for (final IChatComponent chatComponent : componentsToSend) { sender.addChatMessage(chatComponent); } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 1f152fc0..15f80cf7 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -28,12 +28,12 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getCommandUsage(final ICommandSender sender) { return Names.Command.Remove.Message.USAGE; } @Override - public void processCommand(ICommandSender sender, String[] arguments) throws CommandException{ + public void processCommand(final ICommandSender sender, final String[] arguments) throws CommandException{ if (arguments.length < 1) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -49,14 +49,14 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com if (arguments.length > 1) { //check if the last parameter is a hash, which constitutes a confirmation. - String potentialNameHash = arguments[arguments.length - 1]; + final String potentialNameHash = arguments[arguments.length - 1]; if (potentialNameHash.length() == 32) { //We probably have a match. - String[] a = Arrays.copyOfRange(arguments, 0, arguments.length - 1); + final String[] a = Arrays.copyOfRange(arguments, 0, arguments.length - 1); //The name then should be everything except the last element name = Strings.join(a, " "); - String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); + final String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); if (potentialNameHash.equals(hash)) { delete = true; @@ -64,11 +64,11 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com } } - String filename = String.format("%s.schematic", name); - File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); - File file = new File(schematicDirectory, filename); + final String filename = String.format("%s.schematic", name); + final File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); + final File file = new File(schematicDirectory, filename); if (!FileUtils.contains(schematicDirectory, file)) { - Reference.logger.error("{} has tried to download the file {}", player.getCommandSenderName(), filename); + Reference.logger.error("{} has tried to download the file {}", player.getName(), filename); throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } @@ -80,8 +80,8 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } } else { - String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); - String confirmCommand = String.format("/%s %s %s", Names.Command.Remove.NAME, name, hash); + final String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); + final String confirmCommand = String.format("/%s %s %s", Names.Command.Remove.NAME, name, hash); final IChatComponent chatComponent = new ChatComponentTranslation(Names.Command.Remove.Message.ARE_YOU_SURE_START, name) .appendSibling(new ChatComponentText(" [")) .appendSibling( diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 7275a6d8..2e15e64e 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -21,12 +21,12 @@ public String getCommandName() { } @Override - public String getCommandUsage(ICommandSender sender) { + public String getCommandUsage(final ICommandSender sender) { return Names.Command.Save.Message.USAGE; } @Override - public void processCommand(ICommandSender sender, String[] arguments) throws CommandException { + public void processCommand(final ICommandSender sender, final String[] arguments) throws CommandException { if (arguments.length < 7) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -41,10 +41,10 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com throw new CommandException(Names.Command.Save.Message.QUOTA_EXCEEDED); } - MBlockPos from = new MBlockPos(); - MBlockPos to = new MBlockPos(); - String filename; - String name; + final MBlockPos from = new MBlockPos(); + final MBlockPos to = new MBlockPos(); + final String filename; + final String name; try { from.set(parseCoord(arguments[0]), parseCoord(arguments[1]), parseCoord(arguments[2])); @@ -52,7 +52,7 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com name = arguments[6]; filename = String.format("%s.schematic", name); - } catch (NumberFormatException exception) { + } catch (final NumberFormatException exception) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -74,12 +74,12 @@ public void processCommand(ICommandSender sender, String[] arguments) throws Com try { Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), from, to); sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); - } catch (Exception e) { + } catch (final Exception e) { throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); } } - private int parseCoord(String argument) throws NumberInvalidException { + private int parseCoord(final String argument) throws NumberInvalidException { return parseInt(argument, Constants.World.MINIMUM_COORD, Constants.World.MAXIMUM_COORD); } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java index d9f7b339..e5be90a1 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java +++ b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java @@ -31,7 +31,7 @@ public String getCommandUsage(final ICommandSender sender) { } @Override - public List addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) { + public List addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) { if (args.length < 3) { return getListOfStringsMatchingLastWord(args, BLOCK_REGISTRY.getKeys()); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 5deea5b1..bd15c1b2 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -5,10 +5,12 @@ import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; import java.io.File; @@ -21,6 +23,7 @@ public class ConfigurationHandler { public static final ConfigurationHandler INSTANCE = new ConfigurationHandler(); + public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); public static final String VERSION = "1"; @@ -46,7 +49,7 @@ public class ConfigurationHandler { }; public static final String SCHEMATIC_DIRECTORY_STR = "schematics"; public static final File SCHEMATIC_DIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATIC_DIRECTORY_STR); - public static final String[] EXTRA_AIR_BLOCKS_DEFAULT = { }; + public static final String[] EXTRA_AIR_BLOCKS_DEFAULT = {}; public static final String SORT_TYPE_DEFAULT = ""; public static final boolean PRINTER_ENABLED_DEFAULT = true; public static final boolean SAVE_ENABLED_DEFAULT = true; @@ -104,7 +107,7 @@ public class ConfigurationHandler { private static final Set extraAirBlockList = new HashSet(); - public static void init(File configFile) { + public static void init(final File configFile) { if (configuration == null) { configuration = new Configuration(configFile, VERSION); loadConfiguration(); @@ -220,7 +223,7 @@ private static void loadConfigurationGeneral() { } else { propSchematicDirectory.set(schematicPath.replace("\\", "/")); } - } catch (IOException e) { + } catch (final IOException e) { Reference.logger.warn("Could not canonize path!", e); } @@ -233,8 +236,8 @@ private static void loadConfigurationGeneral() { sortType = propSortType.getString(); extraAirBlockList.clear(); - for (String name : extraAirBlocks) { - final Block block = GameData.getBlockRegistry().getObject(name); + for (final String name : extraAirBlocks) { + final Block block = BLOCK_REGISTRY.getObject(new ResourceLocation(name)); if (block != Blocks.air) { extraAirBlockList.add(block); } @@ -262,7 +265,7 @@ private static void loadConfigurationServer() { private ConfigurationHandler() {} @SubscribeEvent - public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) { + public void onConfigurationChangedEvent(final ConfigChangedEvent.OnConfigChangedEvent event) { if (event.modID.equalsIgnoreCase(Reference.MODID)) { loadConfiguration(); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java index 9e91423e..9059ba07 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/DownloadHandler.java @@ -25,7 +25,7 @@ public class DownloadHandler { private DownloadHandler() {} @SubscribeEvent - public void onServerTick(TickEvent.ServerTickEvent event) { + public void onServerTick(final TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { return; } @@ -48,11 +48,11 @@ private void processQueue() { if (!transfer.state.isWaiting()) { if (++transfer.timeout >= Constants.Network.TIMEOUT) { if (++transfer.retries >= Constants.Network.RETRIES) { - Reference.logger.warn("{}'s download was dropped!", player.getCommandSenderName()); + Reference.logger.warn("{}'s download was dropped!", player.getName()); return; } - Reference.logger.warn("{}'s download timed out, retrying (#{})", player.getCommandSenderName(), transfer.retries); + Reference.logger.warn("{}'s download timed out, retrying (#{})", player.getName(), transfer.retries); sendChunk(player, transfer); transfer.timeout = 0; @@ -69,23 +69,23 @@ private void processQueue() { this.transferMap.put(player, transfer); } - private void sendBegin(EntityPlayerMP player, SchematicTransfer transfer) { + private void sendBegin(final EntityPlayerMP player, final SchematicTransfer transfer) { transfer.setState(SchematicTransfer.State.BEGIN); - MessageDownloadBegin message = new MessageDownloadBegin(transfer.schematic); + final MessageDownloadBegin message = new MessageDownloadBegin(transfer.schematic); PacketHandler.INSTANCE.sendTo(message, player); } - private void sendChunk(EntityPlayerMP player, SchematicTransfer transfer) { + private void sendChunk(final EntityPlayerMP player, final SchematicTransfer transfer) { transfer.setState(SchematicTransfer.State.CHUNK); Reference.logger.trace("Sending chunk {},{},{}", transfer.baseX, transfer.baseY, transfer.baseZ); - MessageDownloadChunk message = new MessageDownloadChunk(transfer.schematic, transfer.baseX, transfer.baseY, transfer.baseZ); + final MessageDownloadChunk message = new MessageDownloadChunk(transfer.schematic, transfer.baseX, transfer.baseY, transfer.baseZ); PacketHandler.INSTANCE.sendTo(message, player); } - private void sendEnd(EntityPlayerMP player, SchematicTransfer transfer) { - MessageDownloadEnd message = new MessageDownloadEnd(transfer.name); + private void sendEnd(final EntityPlayerMP player, final SchematicTransfer transfer) { + final MessageDownloadEnd message = new MessageDownloadEnd(transfer.name); PacketHandler.INSTANCE.sendTo(message, player); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java index 997d2797..fea8e4a2 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/PlayerHandler.java @@ -13,18 +13,18 @@ public class PlayerHandler { private PlayerHandler() {} @SubscribeEvent - public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { + public void onPlayerLoggedIn(final PlayerEvent.PlayerLoggedInEvent event) { if (event.player instanceof EntityPlayerMP) { try { PacketHandler.INSTANCE.sendTo(new MessageCapabilities(ConfigurationHandler.printerEnabled, ConfigurationHandler.saveEnabled, ConfigurationHandler.loadEnabled), (EntityPlayerMP) event.player); - } catch (Exception ex) { + } catch (final Exception ex) { Reference.logger.error("Failed to send capabilities!", ex); } } } @SubscribeEvent - public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) { + public void onPlayerLoggedOut(final PlayerEvent.PlayerLoggedOutEvent event) { if (event.player instanceof EntityPlayerMP) { DownloadHandler.INSTANCE.transferMap.remove(event.player); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index d4c48488..6b2f22ed 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -21,7 +21,7 @@ public class QueueTickHandler { private QueueTickHandler() {} @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) { + public void onClientTick(final TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.START) { return; } @@ -32,13 +32,13 @@ public void onClientTick(TickEvent.ClientTickEvent event) { if (player != null && player.sendQueue != null && !player.sendQueue.getNetworkManager().isLocalChannel()) { processQueue(); } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Something went wrong...", e); } } @SubscribeEvent - public void onServerTick(TickEvent.ServerTickEvent event) { + public void onServerTick(final TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { return; } @@ -72,7 +72,7 @@ private void processQueue() { } } - public void queueSchematic(SchematicContainer container) { + public void queueSchematic(final SchematicContainer container) { this.queue.offer(container); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java index 27bf9709..0e56db10 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java @@ -15,10 +15,10 @@ public class ChatEventHandler { private ChatEventHandler() {} @SubscribeEvent - public void onClientChatReceivedEvent(ClientChatReceivedEvent event) { + public void onClientChatReceivedEvent(final ClientChatReceivedEvent event) { if (this.chatLines < 20) { this.chatLines++; - String message = event.message.getFormattedText(); + final String message = event.message.getFormattedText(); Reference.logger.debug("Message #{}: {}", this.chatLines, message); if (message.contains(Names.SBC.DISABLE_PRINTER)) { Reference.logger.info("Printer is disabled on this server."); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index f941b72c..10d05cbb 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -51,7 +51,7 @@ public class InputHandler { private InputHandler() {} @SubscribeEvent - public void onKeyInput(InputEvent event) { + public void onKeyInput(final InputEvent event) { if (this.minecraft.currentScreen == null) { if (KEY_BINDING_LOAD.isPressed()) { this.minecraft.displayGuiScreen(new GuiSchematicLoad(this.minecraft.currentScreen)); @@ -130,7 +130,7 @@ private void handlePickBlock() { if (revert) { KeyBinding.onTick(keyPickBlock.getKeyCode()); } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Could not pick block!", e); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index c5e17c72..6b09a598 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -20,7 +20,7 @@ public class OverlayHandler { private final Minecraft minecraft = Minecraft.getMinecraft(); @SubscribeEvent - public void onText(RenderGameOverlayEvent.Text event) { + public void onText(final RenderGameOverlayEvent.Text event) { if (this.minecraft.gameSettings.showDebugInfo && ConfigurationHandler.showDebugInfo) { final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null && schematic.isRendering) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 590831ac..4386e082 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -17,7 +17,7 @@ public class RenderTickHandler { private RenderTickHandler() {} @SubscribeEvent - public void onRenderTick(TickEvent.RenderTickEvent event) { + public void onRenderTick(final TickEvent.RenderTickEvent event) { final SchematicWorld schematic = ClientProxy.schematic; ClientProxy.movingObjectPosition = schematic != null ? rayTrace(schematic, 1.0f) : null; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index ac333ee2..8bb89add 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -23,7 +23,7 @@ public class TickHandler { private TickHandler() {} @SubscribeEvent - public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) { + public void onClientConnect(final FMLNetworkEvent.ClientConnectedToServerEvent event) { /* TODO: is this still needed? Reference.logger.info("Scheduling client settings reset."); ClientProxy.isPendingReset = true; @@ -31,13 +31,13 @@ public void onClientConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) } @SubscribeEvent - public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { + public void onClientDisconnect(final FMLNetworkEvent.ClientDisconnectionFromServerEvent event) { Reference.logger.info("Scheduling client settings reset."); ClientProxy.isPendingReset = true; } @SubscribeEvent - public void onClientTick(TickEvent.ClientTickEvent event) { + public void onClientTick(final TickEvent.ClientTickEvent event) { if (this.minecraft.isGamePaused() || event.phase != TickEvent.Phase.END) { return; } diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java index 1da9cc54..c4b58f46 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTConversionException.java @@ -4,15 +4,15 @@ import net.minecraft.tileentity.TileEntity; public class NBTConversionException extends Exception { - public NBTConversionException(String message, Throwable cause) { + public NBTConversionException(final String message, final Throwable cause) { super(message, cause); } - public NBTConversionException(TileEntity tileEntity, Throwable cause) { + public NBTConversionException(final TileEntity tileEntity, final Throwable cause) { super(String.valueOf(tileEntity), cause); } - public NBTConversionException(Entity entity, Throwable cause) { + public NBTConversionException(final Entity entity, final Throwable cause) { super(String.valueOf(entity), cause); } } diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index e53a610e..f7dd9dd7 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -36,7 +36,7 @@ public static NBTTagCompound writeTileEntitiesToCompound(final List public static NBTTagCompound writeTileEntitiesToCompound(final List tileEntities, final NBTTagCompound compound) { final NBTTagList tagList = new NBTTagList(); - for (TileEntity tileEntity : tileEntities) { + for (final TileEntity tileEntity : tileEntities) { final NBTTagCompound tileEntityCompound = writeTileEntityToCompound(tileEntity); tagList.appendTag(tileEntityCompound); } @@ -77,7 +77,7 @@ public static NBTTagCompound writeEntitiesToCompound(final List entities public static NBTTagCompound writeEntitiesToCompound(final List entities, final NBTTagCompound compound) { final NBTTagList tagList = new NBTTagList(); - for (Entity entity : entities) { + for (final Entity entity : entities) { final NBTTagCompound entityCompound = new NBTTagCompound(); entity.writeToNBT(entityCompound); tagList.appendTag(entityCompound); @@ -88,32 +88,32 @@ public static NBTTagCompound writeEntitiesToCompound(final List entities return compound; } - public static TileEntity reloadTileEntity(TileEntity tileEntity) throws NBTConversionException { + public static TileEntity reloadTileEntity(final TileEntity tileEntity) throws NBTConversionException { return reloadTileEntity(tileEntity, 0, 0, 0); } - public static TileEntity reloadTileEntity(TileEntity tileEntity, int offsetX, int offsetY, int offsetZ) throws NBTConversionException { + public static TileEntity reloadTileEntity(TileEntity tileEntity, final int offsetX, final int offsetY, final int offsetZ) throws NBTConversionException { if (tileEntity == null) { return null; } try { - NBTTagCompound tileEntityCompound = writeTileEntityToCompound(tileEntity); + final NBTTagCompound tileEntityCompound = writeTileEntityToCompound(tileEntity); tileEntity = readTileEntityFromCompound(tileEntityCompound); final BlockPos pos = tileEntity.getPos(); tileEntity.setPos(pos.add(-offsetX, -offsetY, -offsetZ)); - } catch (Throwable t) { + } catch (final Throwable t) { throw new NBTConversionException(tileEntity, t); } return tileEntity; } - public static Entity reloadEntity(Entity entity) throws NBTConversionException { + public static Entity reloadEntity(final Entity entity) throws NBTConversionException { return reloadEntity(entity, 0, 0, 0); } - public static Entity reloadEntity(Entity entity, int offsetX, int offsetY, int offsetZ) throws NBTConversionException { + public static Entity reloadEntity(Entity entity, final int offsetX, final int offsetY, final int offsetZ) throws NBTConversionException { if (entity == null) { return null; } @@ -129,7 +129,7 @@ public static Entity reloadEntity(Entity entity, int offsetX, int offsetY, int o entity.posZ -= offsetZ; } } - } catch (Throwable t) { + } catch (final Throwable t) { throw new NBTConversionException(entity, t); } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java index aacb7324..b35a4936 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageCapabilities.java @@ -17,28 +17,28 @@ public MessageCapabilities() { this(false, false, false); } - public MessageCapabilities(boolean isPrinterEnabled, boolean isSaveEnabled, boolean isLoadEnabled) { + public MessageCapabilities(final boolean isPrinterEnabled, final boolean isSaveEnabled, final boolean isLoadEnabled) { this.isPrinterEnabled = isPrinterEnabled; this.isSaveEnabled = isSaveEnabled; this.isLoadEnabled = isLoadEnabled; } @Override - public void fromBytes(ByteBuf buf) { + public void fromBytes(final ByteBuf buf) { this.isPrinterEnabled = buf.readBoolean(); this.isSaveEnabled = buf.readBoolean(); this.isLoadEnabled = buf.readBoolean(); } @Override - public void toBytes(ByteBuf buf) { + public void toBytes(final ByteBuf buf) { buf.writeBoolean(this.isPrinterEnabled); buf.writeBoolean(this.isSaveEnabled); buf.writeBoolean(this.isLoadEnabled); } @Override - public IMessage onMessage(MessageCapabilities message, MessageContext ctx) { + public IMessage onMessage(final MessageCapabilities message, final MessageContext ctx) { SchematicPrinter.INSTANCE.setEnabled(message.isPrinterEnabled); Schematica.proxy.isSaveEnabled = message.isSaveEnabled; Schematica.proxy.isLoadEnabled = message.isLoadEnabled; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java index c2a495b3..a0eefd97 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBegin.java @@ -19,7 +19,7 @@ public class MessageDownloadBegin implements IMessage, IMessageHandler { @Override - public void fromBytes(ByteBuf buf) { + public void fromBytes(final ByteBuf buf) { // NOOP } @Override - public void toBytes(ByteBuf buf) { + public void toBytes(final ByteBuf buf) { // NOOP } @Override - public IMessage onMessage(MessageDownloadBeginAck message, MessageContext ctx) { - EntityPlayerMP player = ctx.getServerHandler().playerEntity; - SchematicTransfer transfer = DownloadHandler.INSTANCE.transferMap.get(player); + public IMessage onMessage(final MessageDownloadBeginAck message, final MessageContext ctx) { + final EntityPlayerMP player = ctx.getServerHandler().playerEntity; + final SchematicTransfer transfer = DownloadHandler.INSTANCE.transferMap.get(player); if (transfer != null) { transfer.setState(SchematicTransfer.State.CHUNK_WAIT); } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java index 3d9fb26c..0dcd5eab 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java @@ -36,7 +36,7 @@ public class MessageDownloadChunk implements IMessage, IMessageHandler 45) { return EnumFacing.DOWN; } else if (player.rotationPitch < -45) { @@ -99,7 +98,7 @@ public static void updatePoints() { pointMax.z = Math.max(pointA.z, pointB.z); } - public static void movePointToPlayer(MBlockPos point) { + public static void movePointToPlayer(final MBlockPos point) { point.x = (int) Math.floor(playerPosition.x); point.y = (int) Math.floor(playerPosition.y); point.z = (int) Math.floor(playerPosition.z); @@ -124,9 +123,9 @@ public static void movePointToPlayer(MBlockPos point) { } } - public static void moveSchematicToPlayer(SchematicWorld schematic) { + public static void moveSchematicToPlayer(final SchematicWorld schematic) { if (schematic != null) { - MBlockPos position = schematic.position; + final MBlockPos position = schematic.position; position.x = (int) Math.floor(playerPosition.x); position.y = (int) Math.floor(playerPosition.y); position.z = (int) Math.floor(playerPosition.z); @@ -153,7 +152,7 @@ public static void moveSchematicToPlayer(SchematicWorld schematic) { } @Override - public void preInit(FMLPreInitializationEvent event) { + public void preInit(final FMLPreInitializationEvent event) { super.preInit(event); final Property[] sliders = { @@ -164,35 +163,34 @@ public void preInit(FMLPreInitializationEvent event) { ConfigurationHandler.propTimeout, ConfigurationHandler.propPlaceDistance }; - for (Property prop : sliders) { + for (final Property prop : sliders) { prop.setConfigEntryClass(GuiConfigEntries.NumberSliderEntry.class); } - for (KeyBinding keyBinding : InputHandler.KEY_BINDINGS) { + for (final KeyBinding keyBinding : InputHandler.KEY_BINDINGS) { ClientRegistry.registerKeyBinding(keyBinding); } } @Override - public void init(FMLInitializationEvent event) { + public void init(final FMLInitializationEvent event) { super.init(event); - FMLCommonHandler.instance().bus().register(InputHandler.INSTANCE); - FMLCommonHandler.instance().bus().register(TickHandler.INSTANCE); - FMLCommonHandler.instance().bus().register(RenderTickHandler.INSTANCE); - FMLCommonHandler.instance().bus().register(ConfigurationHandler.INSTANCE); - - ClientCommandHandler.instance.registerCommand(new CommandSchematicaReplace()); - + MinecraftForge.EVENT_BUS.register(InputHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(TickHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(RenderTickHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(ConfigurationHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(GuiHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(new OverlayHandler()); MinecraftForge.EVENT_BUS.register(new WorldHandler()); + + ClientCommandHandler.instance.registerCommand(new CommandSchematicaReplace()); } @Override - public void postInit(FMLPostInitializationEvent event) { + public void postInit(final FMLPostInitializationEvent event) { super.postInit(event); resetSettings(); @@ -203,7 +201,7 @@ public File getDataDirectory() { final File file = MINECRAFT.mcDataDir; try { return file.getCanonicalFile(); - } catch (IOException e) { + } catch (final IOException e) { Reference.logger.debug("Could not canonize path!", e); } return file; @@ -235,13 +233,13 @@ public void unloadSchematic() { } @Override - public boolean loadSchematic(EntityPlayer player, File directory, String filename) { - ISchematic schematic = SchematicFormat.readFromFile(directory, filename); + public boolean loadSchematic(final EntityPlayer player, final File directory, final String filename) { + final ISchematic schematic = SchematicFormat.readFromFile(directory, filename); if (schematic == null) { return false; } - SchematicWorld world = new SchematicWorld(schematic); + final SchematicWorld world = new SchematicWorld(schematic); Reference.logger.debug("Loaded {} [w:{},h:{},l:{}]", filename, world.getWidth(), world.getHeight(), world.getLength()); @@ -254,12 +252,12 @@ public boolean loadSchematic(EntityPlayer player, File directory, String filenam } @Override - public boolean isPlayerQuotaExceeded(EntityPlayer player) { + public boolean isPlayerQuotaExceeded(final EntityPlayer player) { return false; } @Override - public File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory) { + public File getPlayerSchematicDirectory(final EntityPlayer player, final boolean privateDirectory) { return ConfigurationHandler.schematicDirectory; } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 970267e8..35106788 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,7 +1,6 @@ package com.github.lunatrius.schematica.proxy; import com.github.lunatrius.core.util.MBlockPos; -import com.github.lunatrius.core.version.VersionChecker; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.command.CommandSchematicaList; import com.github.lunatrius.schematica.command.CommandSchematicaRemove; @@ -25,8 +24,9 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLInterModComms; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; @@ -39,24 +39,24 @@ public abstract class CommonProxy { public boolean isSaveEnabled = true; public boolean isLoadEnabled = true; - public void preInit(FMLPreInitializationEvent event) { + public void preInit(final FMLPreInitializationEvent event) { Reference.logger = event.getModLog(); ConfigurationHandler.init(event.getSuggestedConfigurationFile()); - VersionChecker.registerMod(event.getModMetadata(), Reference.FORGE); + FMLInterModComms.sendMessage("LunatriusCore", "checkUpdate", Reference.FORGE); } - public void init(FMLInitializationEvent event) { + public void init(final FMLInitializationEvent event) { PacketHandler.init(); - FMLCommonHandler.instance().bus().register(QueueTickHandler.INSTANCE); - FMLCommonHandler.instance().bus().register(DownloadHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(QueueTickHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(DownloadHandler.INSTANCE); } - public void postInit(FMLPostInitializationEvent event) { + public void postInit(final FMLPostInitializationEvent event) { } - public void serverStarting(FMLServerStartingEvent event) { + public void serverStarting(final FMLServerStartingEvent event) { event.registerServerCommand(new CommandSchematicaSave()); event.registerServerCommand(new CommandSchematicaList()); event.registerServerCommand(new CommandSchematicaRemove()); @@ -84,7 +84,7 @@ public File getDirectory(final String directory) { try { return subDirectory.getCanonicalFile(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } @@ -131,13 +131,13 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, try { final TileEntity reloadedTileEntity = NBTHelper.reloadTileEntity(tileEntity, minX, minY, minZ); schematic.setTileEntity(localPos, reloadedTileEntity); - } catch (NBTConversionException nce) { + } catch (final NBTConversionException nce) { Reference.logger.error("Error while trying to save tile entity '{}'!", tileEntity, nce); schematic.setBlockState(localPos, Blocks.bedrock.getDefaultState()); } } } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Something went wrong!", e); } } @@ -150,27 +150,27 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, final int maxZ1 = localMaxZ | (chunkZ << 4); final AxisAlignedBB bb = AxisAlignedBB.fromBounds(minX1, minY, minZ1, maxX1 + 1, maxY + 1, maxZ1 + 1); final List entities = world.getEntitiesWithinAABB(Entity.class, bb); - for (Entity entity : entities) { + for (final Entity entity : entities) { try { final Entity reloadedEntity = NBTHelper.reloadEntity(entity, minX, minY, minZ); schematic.addEntity(reloadedEntity); - } catch (NBTConversionException nce) { + } catch (final NBTConversionException nce) { Reference.logger.error("Error while trying to save entity '{}'!", entity, nce); } } } - public boolean saveSchematic(EntityPlayer player, File directory, String filename, World world, BlockPos from, BlockPos to) { + public boolean saveSchematic(final EntityPlayer player, final File directory, String filename, final World world, final BlockPos from, final BlockPos to) { try { String iconName = ""; try { - String[] parts = filename.split(";"); + final String[] parts = filename.split(";"); if (parts.length == 2) { iconName = parts[0]; filename = parts[1]; } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Failed to parse icon data!", e); } @@ -190,7 +190,7 @@ public boolean saveSchematic(EntityPlayer player, File directory, String filenam QueueTickHandler.INSTANCE.queueSchematic(container); return true; - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Failed to save schematic!", e); } return false; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 6d246b35..a2b6af7c 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -6,7 +6,7 @@ import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; @@ -16,14 +16,14 @@ public class ServerProxy extends CommonProxy { @Override - public void init(FMLInitializationEvent event) { + public void init(final FMLInitializationEvent event) { super.init(event); - FMLCommonHandler.instance().bus().register(PlayerHandler.INSTANCE); + MinecraftForge.EVENT_BUS.register(PlayerHandler.INSTANCE); } @Override - public void serverStarting(FMLServerStartingEvent event) { + public void serverStarting(final FMLServerStartingEvent event) { super.serverStarting(event); event.registerServerCommand(new CommandSchematicaDownload()); } @@ -33,19 +33,19 @@ public File getDataDirectory() { final File file = MinecraftServer.getServer().getFile("."); try { return file.getCanonicalFile(); - } catch (IOException e) { + } catch (final IOException e) { Reference.logger.info("Could not canonize path!", e); } return file; } @Override - public boolean loadSchematic(EntityPlayer player, File directory, String filename) { + public boolean loadSchematic(final EntityPlayer player, final File directory, final String filename) { return false; } @Override - public boolean isPlayerQuotaExceeded(EntityPlayer player) { + public boolean isPlayerQuotaExceeded(final EntityPlayer player) { int spaceUsed = 0; //Space used by private directory @@ -58,7 +58,7 @@ public boolean isPlayerQuotaExceeded(EntityPlayer player) { return ((spaceUsed / 1024) > ConfigurationHandler.playerQuotaKilobytes); } - private int getSpaceUsedByDirectory(File directory) { + private int getSpaceUsedByDirectory(final File directory) { int spaceUsed = 0; //If we don't have a player directory yet, then they haven't uploaded any files yet. if (directory == null || !directory.exists()) { @@ -69,21 +69,21 @@ private int getSpaceUsedByDirectory(File directory) { if (files == null) { files = new File[0]; } - for (File path : files) { + for (final File path : files) { spaceUsed += path.length(); } return spaceUsed; } @Override - public File getPlayerSchematicDirectory(EntityPlayer player, boolean privateDirectory) { + public File getPlayerSchematicDirectory(final EntityPlayer player, final boolean privateDirectory) { final UUID playerId = player.getUniqueID(); if (playerId == null) { Reference.logger.warn("Unable to identify player {}", player.toString()); return null; } - File playerDir = new File(ConfigurationHandler.schematicDirectory.getAbsolutePath(), playerId.toString()); + final File playerDir = new File(ConfigurationHandler.schematicDirectory.getAbsolutePath(), playerId.toString()); if (privateDirectory) { return new File(playerDir, "private"); } else { diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java index c8366a04..b67085bd 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java @@ -14,7 +14,7 @@ public class Reference { public static final String MINECRAFT = "${mcversion}"; public static final String PROXY_SERVER = "com.github.lunatrius.schematica.proxy.ServerProxy"; public static final String PROXY_CLIENT = "com.github.lunatrius.schematica.proxy.ClientProxy"; - public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.GuiFactory"; + public static final String GUI_FACTORY = "com.github.lunatrius.schematica.client.gui.config.GuiFactory"; public static Logger logger = LogManager.getLogger(Reference.MODID); } diff --git a/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java index ddd91463..829d4c07 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java @@ -7,12 +7,12 @@ public class FileFilterSchematic implements FileFilter { private final boolean directory; - public FileFilterSchematic(boolean dir) { + public FileFilterSchematic(final boolean dir) { this.directory = dir; } @Override - public boolean accept(File file) { + public boolean accept(final File file) { if (this.directory) { return file.isDirectory(); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java index 4be30b95..3e3afbd1 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java +++ b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java @@ -13,7 +13,7 @@ public class WorldDummy extends World { private static WorldDummy instance; - protected WorldDummy(ISaveHandler saveHandler, WorldInfo worldInfo, WorldProvider worldProvider, Profiler profiler, boolean client) { + protected WorldDummy(final ISaveHandler saveHandler, final WorldInfo worldInfo, final WorldProvider worldProvider, final Profiler profiler, final boolean client) { super(saveHandler, worldInfo, worldProvider, profiler, client); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java index 59a2276e..affbe25b 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java @@ -32,7 +32,7 @@ public class SchematicContainer { public final int chunkCount; public int processedChunks; - public SchematicContainer(ISchematic schematic, EntityPlayer player, World world, File file, int minX, int maxX, int minY, int maxY, int minZ, int maxZ) { + public SchematicContainer(final ISchematic schematic, final EntityPlayer player, final World world, final File file, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { this.schematic = schematic; this.player = player; this.world = world; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 7454541d..fa460f31 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; @@ -30,11 +31,11 @@ public class SchematicAlpha extends SchematicFormat { private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); @Override - public ISchematic readFromNBT(NBTTagCompound tagCompound) { - ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); + public ISchematic readFromNBT(final NBTTagCompound tagCompound) { + final ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); - byte localBlocks[] = tagCompound.getByteArray(Names.NBT.BLOCKS); - byte localMetadata[] = tagCompound.getByteArray(Names.NBT.DATA); + final byte[] localBlocks = tagCompound.getByteArray(Names.NBT.BLOCKS); + final byte[] localMetadata = tagCompound.getByteArray(Names.NBT.DATA); boolean extra = false; byte extraBlocks[] = null; @@ -52,28 +53,28 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { extraBlocks = tagCompound.getByteArray(Names.NBT.ADD_BLOCKS_SCHEMATICA); } - short width = tagCompound.getShort(Names.NBT.WIDTH); - short length = tagCompound.getShort(Names.NBT.LENGTH); - short height = tagCompound.getShort(Names.NBT.HEIGHT); + final short width = tagCompound.getShort(Names.NBT.WIDTH); + final short length = tagCompound.getShort(Names.NBT.LENGTH); + final short height = tagCompound.getShort(Names.NBT.HEIGHT); Short id = null; - Map oldToNew = new HashMap(); + final Map oldToNew = new HashMap(); if (tagCompound.hasKey(Names.NBT.MAPPING_SCHEMATICA)) { - NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); - Set names = mapping.getKeySet(); - for (String name : names) { - oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(name)); + final NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); + final Set names = mapping.getKeySet(); + for (final String name : names) { + oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(new ResourceLocation(name))); } } final MBlockPos pos = new MBlockPos(); - ISchematic schematic = new Schematic(icon, width, height, length); + final ISchematic schematic = new Schematic(icon, width, height, length); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { for (int z = 0; z < length; z++) { - int index = x + (y * length + z) * width; + final int index = x + (y * length + z) * width; int blockID = (localBlocks[index] & 0xFF) | (extra ? ((extraBlocks[index] & 0xFF) << 8) : 0); - int meta = localMetadata[index] & 0xFF; + final int meta = localMetadata[index] & 0xFF; if ((id = oldToNew.get((short) blockID)) != null) { blockID = id; @@ -84,22 +85,22 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { try { final IBlockState blockState = block.getStateFromMeta(meta); schematic.setBlockState(pos, blockState); - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Could not set block state at {} to {} with metadata {}", pos, BLOCK_REGISTRY.getNameForObject(block), meta, e); } } } } - NBTTagList tileEntitiesList = tagCompound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); + final NBTTagList tileEntitiesList = tagCompound.getTagList(Names.NBT.TILE_ENTITIES, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < tileEntitiesList.tagCount(); i++) { try { - TileEntity tileEntity = NBTHelper.readTileEntityFromCompound(tileEntitiesList.getCompoundTagAt(i)); + final TileEntity tileEntity = NBTHelper.readTileEntityFromCompound(tileEntitiesList.getCompoundTagAt(i)); if (tileEntity != null) { schematic.setTileEntity(tileEntity.getPos(), tileEntity); } - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("TileEntity failed to load properly!", e); } } @@ -108,9 +109,9 @@ public ISchematic readFromNBT(NBTTagCompound tagCompound) { } @Override - public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { - NBTTagCompound tagCompoundIcon = new NBTTagCompound(); - ItemStack icon = schematic.getIcon(); + public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic schematic) { + final NBTTagCompound tagCompoundIcon = new NBTTagCompound(); + final ItemStack icon = schematic.getIcon(); icon.writeToNBT(tagCompoundIcon); tagCompound.setTag(Names.NBT.ICON, tagCompoundIcon); @@ -118,15 +119,15 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { tagCompound.setShort(Names.NBT.LENGTH, (short) schematic.getLength()); tagCompound.setShort(Names.NBT.HEIGHT, (short) schematic.getHeight()); - int size = schematic.getWidth() * schematic.getLength() * schematic.getHeight(); - byte localBlocks[] = new byte[size]; - byte localMetadata[] = new byte[size]; - byte extraBlocks[] = new byte[size]; - byte extraBlocksNibble[] = new byte[(int) Math.ceil(size / 2.0)]; + final int size = schematic.getWidth() * schematic.getLength() * schematic.getHeight(); + final byte[] localBlocks = new byte[size]; + final byte[] localMetadata = new byte[size]; + final byte[] extraBlocks = new byte[size]; + final byte[] extraBlocksNibble = new byte[(int) Math.ceil(size / 2.0)]; boolean extra = false; final MBlockPos pos = new MBlockPos(); - Map mappings = new HashMap(); + final Map mappings = new HashMap(); for (int x = 0; x < schematic.getWidth(); x++) { for (int y = 0; y < schematic.getHeight(); y++) { for (int z = 0; z < schematic.getLength(); z++) { @@ -140,7 +141,7 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { extra = true; } - String name = String.valueOf(BLOCK_REGISTRY.getNameForObject(block)); + final String name = String.valueOf(BLOCK_REGISTRY.getNameForObject(block)); if (!mappings.containsKey(name)) { mappings.put(name, (short) blockId); } @@ -149,17 +150,17 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { } int count = 20; - NBTTagList tileEntitiesList = new NBTTagList(); - for (TileEntity tileEntity : schematic.getTileEntities()) { + final NBTTagList tileEntitiesList = new NBTTagList(); + for (final TileEntity tileEntity : schematic.getTileEntities()) { try { - NBTTagCompound tileEntityTagCompound = NBTHelper.writeTileEntityToCompound(tileEntity); + final NBTTagCompound tileEntityTagCompound = NBTHelper.writeTileEntityToCompound(tileEntity); tileEntitiesList.appendTag(tileEntityTagCompound); - } catch (Exception e) { + } catch (final Exception e) { final BlockPos tePos = tileEntity.getPos(); final int index = tePos.getX() + (tePos.getY() * schematic.getLength() + tePos.getZ()) * schematic.getWidth(); if (--count > 0) { final IBlockState blockState = schematic.getBlockState(tePos); - Block block = blockState.getBlock(); + final Block block = blockState.getBlock(); Reference.logger.error("Block {}[{}] with TileEntity {} failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName(), e); } localBlocks[index] = (byte) BLOCK_REGISTRY.getId(Blocks.bedrock); @@ -178,22 +179,22 @@ public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { final NBTTagList entityList = new NBTTagList(); final List entities = schematic.getEntities(); - for (Entity entity : entities) { + for (final Entity entity : entities) { try { final NBTTagCompound entityCompound = NBTHelper.writeEntityToCompound(entity); if (entityCompound != null) { entityList.appendTag(entityCompound); } - } catch (Throwable t) { + } catch (final Throwable t) { Reference.logger.error("Entity {} failed to save, skipping!", entity, t); } } - PreSchematicSaveEvent event = new PreSchematicSaveEvent(schematic, mappings); + final PreSchematicSaveEvent event = new PreSchematicSaveEvent(schematic, mappings); MinecraftForge.EVENT_BUS.post(event); - NBTTagCompound nbtMapping = new NBTTagCompound(); - for (Map.Entry entry : mappings.entrySet()) { + final NBTTagCompound nbtMapping = new NBTTagCompound(); + for (final Map.Entry entry : mappings.entrySet()) { nbtMapping.setShort(entry.getKey(), entry.getValue()); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java index 0e291445..23b06f46 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java @@ -2,17 +2,18 @@ import com.github.lunatrius.schematica.api.ISchematic; import net.minecraft.nbt.NBTTagCompound; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; // TODO: http://minecraft.gamepedia.com/Data_values_%28Classic%29 public class SchematicClassic extends SchematicFormat { @Override - public ISchematic readFromNBT(NBTTagCompound tagCompound) { - throw new NotImplementedException(); + public ISchematic readFromNBT(final NBTTagCompound tagCompound) { + // TODO + return null; } @Override - public boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic) { - throw new NotImplementedException(); + public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic schematic) { + // TODO + return false; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 2bc04201..ed4756bd 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -24,7 +24,7 @@ public abstract class SchematicFormat { public abstract boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic); - public static ISchematic readFromFile(File file) { + public static ISchematic readFromFile(final File file) { try { final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); final String format = tagCompound.getString(Names.NBT.MATERIALS); @@ -35,27 +35,27 @@ public static ISchematic readFromFile(File file) { } return schematicFormat.readFromNBT(tagCompound); - } catch (Exception ex) { + } catch (final Exception ex) { Reference.logger.error("Failed to read schematic!", ex); } return null; } - public static ISchematic readFromFile(File directory, String filename) { + public static ISchematic readFromFile(final File directory, final String filename) { return readFromFile(new File(directory, filename)); } - public static boolean writeToFile(File file, ISchematic schematic) { + public static boolean writeToFile(final File file, final ISchematic schematic) { try { final PostSchematicCaptureEvent event = new PostSchematicCaptureEvent(schematic); MinecraftForge.EVENT_BUS.post(event); - NBTTagCompound tagCompound = new NBTTagCompound(); + final NBTTagCompound tagCompound = new NBTTagCompound(); FORMATS.get(FORMAT_DEFAULT).writeToNBT(tagCompound, schematic); - DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); + final DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); try { NBTTagCompound.writeEntry(Names.NBT.ROOT, tagCompound, dataOutputStream); @@ -64,14 +64,14 @@ public static boolean writeToFile(File file, ISchematic schematic) { } return true; - } catch (Exception ex) { + } catch (final Exception ex) { Reference.logger.error("Failed to write schematic!", ex); } return false; } - public static boolean writeToFile(File directory, String filename, ISchematic schematic) { + public static boolean writeToFile(final File directory, final String filename, final ISchematic schematic) { return writeToFile(new File(directory, filename), schematic); } @@ -82,7 +82,8 @@ public static void writeToFileAndNotify(final File file, final ISchematic schema } static { - FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); + // TODO? + // FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index 5a472857..15d35287 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -2,10 +2,14 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; import java.io.File; @@ -14,46 +18,51 @@ public final class SchematicUtil { public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); + public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); + public static final FMLControlledNamespacedRegistry ITEM_REGISTRY = GameData.getItemRegistry(); - public static NBTTagCompound readTagCompoundFromFile(File file) throws IOException { + public static NBTTagCompound readTagCompoundFromFile(final File file) throws IOException { try { return CompressedStreamTools.readCompressed(new FileInputStream(file)); - } catch (Exception ex) { + } catch (final Exception ex) { Reference.logger.warn("Failed compressed read, trying normal read...", ex); return CompressedStreamTools.read(file); } } - public static ItemStack getIconFromName(String iconName) { - ItemStack icon; - String name = ""; + public static ItemStack getIconFromName(final String iconName) { + ResourceLocation rl = null; int damage = 0; - String[] parts = iconName.split(","); + final String[] parts = iconName.split(","); if (parts.length >= 1) { - name = parts[0]; + rl = new ResourceLocation(parts[0]); if (parts.length >= 2) { try { damage = Integer.parseInt(parts[1]); - } catch (NumberFormatException ignored) { + } catch (final NumberFormatException ignored) { } } } - icon = new ItemStack(GameData.getBlockRegistry().getObject(name), 1, damage); - if (icon.getItem() != null) { - return icon; + if (rl == null) { + return DEFAULT_ICON.copy(); } - icon = new ItemStack(GameData.getItemRegistry().getObject(name), 1, damage); - if (icon.getItem() != null) { - return icon; + final ItemStack block = new ItemStack(BLOCK_REGISTRY.getObject(rl), 1, damage); + if (block.getItem() != null) { + return block; + } + + final ItemStack item = new ItemStack(ITEM_REGISTRY.getObject(rl), 1, damage); + if (item.getItem() != null) { + return item; } return DEFAULT_ICON.copy(); } - public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { + public static ItemStack getIconFromNBT(final NBTTagCompound tagCompound) { ItemStack icon = DEFAULT_ICON.copy(); if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { @@ -67,10 +76,10 @@ public static ItemStack getIconFromNBT(NBTTagCompound tagCompound) { return icon; } - public static ItemStack getIconFromFile(File file) { + public static ItemStack getIconFromFile(final File file) { try { return getIconFromNBT(readTagCompoundFromFile(file)); - } catch (Exception e) { + } catch (final Exception e) { Reference.logger.error("Failed to read schematic icon!", e); } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java index 5a1ac31c..e40501df 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/UnsupportedFormatException.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.world.schematic; public class UnsupportedFormatException extends Exception { - public UnsupportedFormatException(String format) { + public UnsupportedFormatException(final String format) { super(String.format("Unsupported format: %s", format)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java index 2dfc30ce..0a102157 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java @@ -20,15 +20,15 @@ public WorldInfo loadWorldInfo() { public void checkSessionLock() throws MinecraftException {} @Override - public IChunkLoader getChunkLoader(WorldProvider provider) { + public IChunkLoader getChunkLoader(final WorldProvider provider) { return null; } @Override - public void saveWorldInfoWithPlayer(WorldInfo info, NBTTagCompound compound) {} + public void saveWorldInfoWithPlayer(final WorldInfo info, final NBTTagCompound compound) {} @Override - public void saveWorldInfo(WorldInfo info) {} + public void saveWorldInfo(final WorldInfo info) {} @Override public IPlayerFileData getPlayerNBTManager() { @@ -44,7 +44,7 @@ public File getWorldDirectory() { } @Override - public File getMapFileFromName(String name) { + public File getMapFileFromName(final String name) { return null; } diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_ES.lang index 5c4163b3..629dc3bd 100644 --- a/src/main/resources/assets/schematica/lang/ca_ES.lang +++ b/src/main/resources/assets/schematica/lang/ca_ES.lang @@ -56,4 +56,6 @@ schematica.key.control=Manipular esquema # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_CZ.lang index d468184c..1390be3d 100644 --- a/src/main/resources/assets/schematica/lang/cs_CZ.lang +++ b/src/main/resources/assets/schematica/lang/cs_CZ.lang @@ -58,4 +58,6 @@ schematica.key.control=Manipulovat se schématem # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_DK.lang index 18a7027e..3b3b19ca 100644 --- a/src/main/resources/assets/schematica/lang/da_DK.lang +++ b/src/main/resources/assets/schematica/lang/da_DK.lang @@ -57,4 +57,6 @@ schematica.key.control=Manipulér schematic # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_DE.lang index 392cd17e..9c702242 100644 --- a/src/main/resources/assets/schematica/lang/de_DE.lang +++ b/src/main/resources/assets/schematica/lang/de_DE.lang @@ -96,4 +96,6 @@ schematica.command.list.noSchematics=Es sind keine Schematics verfügbar. # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_GB.lang index e3eced5f..5a8d5810 100644 --- a/src/main/resources/assets/schematica/lang/en_GB.lang +++ b/src/main/resources/assets/schematica/lang/en_GB.lang @@ -164,5 +164,7 @@ schematica.command.download.started=Started downloading %s... schematica.command.download.downloadSucceeded=Successfully downloaded %s. schematica.command.download.downloadFail=Download failed. +# commands - replace + # messages schematica.message.togglePrinter=Printer: %s diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_PT.lang index 7abd1ce7..8f185b54 100644 --- a/src/main/resources/assets/schematica/lang/en_PT.lang +++ b/src/main/resources/assets/schematica/lang/en_PT.lang @@ -58,4 +58,6 @@ schematica.key.control=Change yer blueprint # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_ES.lang index 8d70e008..d94c7ffd 100644 --- a/src/main/resources/assets/schematica/lang/es_ES.lang +++ b/src/main/resources/assets/schematica/lang/es_ES.lang @@ -57,4 +57,6 @@ schematica.key.control=Editar esquema # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_MX.lang index 6043c9ad..009f764e 100644 --- a/src/main/resources/assets/schematica/lang/es_MX.lang +++ b/src/main/resources/assets/schematica/lang/es_MX.lang @@ -56,4 +56,6 @@ schematica.key.control=Manipular esquema # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_FI.lang index 174fa4a3..6cd46d84 100644 --- a/src/main/resources/assets/schematica/lang/fi_FI.lang +++ b/src/main/resources/assets/schematica/lang/fi_FI.lang @@ -58,4 +58,6 @@ schematica.key.control=Käsittele kaavaa # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index d0a10ad3..d044c470 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -58,4 +58,6 @@ schematica.key.control=Manipuler le schematic # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_HU.lang index 987d3bcf..63287ed5 100644 --- a/src/main/resources/assets/schematica/lang/hu_HU.lang +++ b/src/main/resources/assets/schematica/lang/hu_HU.lang @@ -58,4 +58,6 @@ schematica.key.control=Klisé módosítása # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_IT.lang index f3e8d7b2..39c138c2 100644 --- a/src/main/resources/assets/schematica/lang/it_IT.lang +++ b/src/main/resources/assets/schematica/lang/it_IT.lang @@ -57,4 +57,6 @@ schematica.key.control=Manipola schematica # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_KR.lang index aa6675c7..20c7e6aa 100644 --- a/src/main/resources/assets/schematica/lang/ko_KR.lang +++ b/src/main/resources/assets/schematica/lang/ko_KR.lang @@ -103,4 +103,6 @@ schematica.command.save.saveFailed=Schematic %s을(를) 저장하는데 문제 # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_LA.lang index c80de93c..a853556c 100644 --- a/src/main/resources/assets/schematica/lang/la_LA.lang +++ b/src/main/resources/assets/schematica/lang/la_LA.lang @@ -36,4 +36,6 @@ schematica.gui.materialamount=Numerus # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_LT.lang index 839f46a8..58999484 100644 --- a/src/main/resources/assets/schematica/lang/lt_LT.lang +++ b/src/main/resources/assets/schematica/lang/lt_LT.lang @@ -57,4 +57,6 @@ schematica.key.control=Manipuliuoti schemà # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_NL.lang index 8f2f9405..4d9826e5 100644 --- a/src/main/resources/assets/schematica/lang/nl_NL.lang +++ b/src/main/resources/assets/schematica/lang/nl_NL.lang @@ -57,4 +57,6 @@ schematica.key.control=Bewerk schematic # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_NO.lang index 4319830d..2d388591 100644 --- a/src/main/resources/assets/schematica/lang/no_NO.lang +++ b/src/main/resources/assets/schematica/lang/no_NO.lang @@ -85,4 +85,6 @@ schematica.key.control=Manipuler tegning # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_PL.lang index 01e3912e..f165a957 100644 --- a/src/main/resources/assets/schematica/lang/pl_PL.lang +++ b/src/main/resources/assets/schematica/lang/pl_PL.lang @@ -57,4 +57,6 @@ schematica.key.control=Manipulacja schematem # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_PT.lang index 365aadee..b8b9abd1 100644 --- a/src/main/resources/assets/schematica/lang/pt_PT.lang +++ b/src/main/resources/assets/schematica/lang/pt_PT.lang @@ -58,4 +58,6 @@ schematica.key.control=Manipular schematica # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_RU.lang index 00f4be26..f6c03425 100644 --- a/src/main/resources/assets/schematica/lang/ru_RU.lang +++ b/src/main/resources/assets/schematica/lang/ru_RU.lang @@ -59,4 +59,6 @@ schematica.key.control=Манипулирование схемой # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_SK.lang index d9bf3e7e..c9696c2f 100644 --- a/src/main/resources/assets/schematica/lang/sk_SK.lang +++ b/src/main/resources/assets/schematica/lang/sk_SK.lang @@ -58,4 +58,6 @@ schematica.key.control=Manipulovať so schémou # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_SI.lang index fc0b07f7..d36cc718 100644 --- a/src/main/resources/assets/schematica/lang/sl_SI.lang +++ b/src/main/resources/assets/schematica/lang/sl_SI.lang @@ -58,4 +58,6 @@ schematica.key.control=Manipuliraj shemo # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_TH.lang index 97f0e0e5..ee281203 100644 --- a/src/main/resources/assets/schematica/lang/th_TH.lang +++ b/src/main/resources/assets/schematica/lang/th_TH.lang @@ -58,4 +58,6 @@ schematica.key.control=จัดการ Schematic # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_TR.lang index b31221d0..9755175d 100644 --- a/src/main/resources/assets/schematica/lang/tr_TR.lang +++ b/src/main/resources/assets/schematica/lang/tr_TR.lang @@ -58,4 +58,6 @@ schematica.key.control=Şematiki işleyin # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_UA.lang index 92b2086e..b8f1b8f6 100644 --- a/src/main/resources/assets/schematica/lang/uk_UA.lang +++ b/src/main/resources/assets/schematica/lang/uk_UA.lang @@ -58,4 +58,6 @@ schematica.key.control=маніпулювати технологічною сх # commands - download +# commands - replace + # messages diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_CN.lang index 2f80b584..ae535525 100644 --- a/src/main/resources/assets/schematica/lang/zh_CN.lang +++ b/src/main/resources/assets/schematica/lang/zh_CN.lang @@ -58,4 +58,6 @@ schematica.key.control=调整Schematic文件 # commands - download +# commands - replace + # messages From 2d4202d7145017f3c2a642a82b126fc1273550be Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 21 Dec 2015 20:15:38 +0100 Subject: [PATCH 265/314] Update gradle wrapper. --- gradle/wrapper/gradle-wrapper.jar | Bin 52141 -> 53636 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- gradlew | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 085a1cdc27db1185342f15a00441734e74fe3735..941144813d241db74e1bf25b6804c679fbe7f0a3 100644 GIT binary patch delta 19155 zcmZ5{V{m5S(rs)fZ)|g7Yhou8+qR826Wg|J+qP}noM7&p?|fCa?)}xPx_bZEy?a-$ zXLUc-so+6{;7Gq@z#-s3Kww}%oPIh=#3NC_{KpR7isQudY5+7JobH`KLH=)$*?)q{ zh#~&RPEq~WzB2xgO{4|g`ybGV1m*|csv*g z$U77W2t#5#1ZHAyFLa_R5(Y5QRsmfIW%Tdn=}MqLfPX;&=`~4K-X1F~vMRGG0zlG7 zq{bnI>^Npim;GMZl9c&An5YlgG^<-XuWECMleLlcG570Q=i_5`Rv+Z#jyhB(ZQOt( z57$TB!5Tcu`f$s!^SNZdqMx|&;l*CU}uSSvp$d_#G|=o zI!?p&wLHguE#|q!d#R!8)vOYI=lUi++jg<>U6UNW|MxZP5^l{Z$3{;3Zhh2jj;D`} z=ZO4~y6$P=_Kg>%ISFvfXA^GaM_1Rc>T&zo4=3e%ulmr&lw!sCMcUHCA2sDyl^LNG ze_txZB{~z#Mb}ZwTg~^${C1UMREXpSC1!5L=Im z=pTq*&TYUmfqsXAD23gJV+_At=QG0SWAu>wa6f??WaVBlWxG+&j>TRI_B|eV@@z85{M_*K*B~iCD9lp6);ErQj3IAG>hUJ1n2-#v5!0%%7GFmm+N&& zC|Qw-<_C^C=m$WGio5(;smbX*leLmotXA=LN;ajev1 z5wfJBzbuWA63dt~g`_HCLV{3=RO1445&2Im>9{5YB{KDZGpm1~K|W*E_vZwd3D45j z7ySSG6Ev=%Fhc&fv|%x0|F^WWuvMXv{!`jqJ1yII=pZ0hG>LzSsDbc47{|?mRGsVV z^n-LL0~6Mwq@JOixG0EHacd}XcTB_=ChiGQS7bLc38K|nk zsMoA~TVC>;o12%_tnDwaySrasb~Zm~Ux8+BoS7yl2aLU6W+&cRr+>3*)3BUI6((Lnu-05CRC%aQR?+&mV-+B*p3`^;HL>OOQ+n*_E*aGf#bqIBFn z(j3e@-ZqVlb2w;lwq*0M&vdxihsP_BSwp$~MQ|6~S;RXWJ_Rr7B5vjVchHQ%LvWo5 zQ_zY-r}wJ35~Yj^N1bVQIL5n2;b5%ssA15IS(zeWd2Z^sGq63(J0&WcAkV1g`4P^u zhJMf4L)Cxw_z}#bQrW}RKP3=r43g3F2v<&(ou*}2r&_O^II$vWYXG>~ftJ#y%oY0;)N zTn_Qvaetv&Ti12G2-P+g=D6Jsp5thyzhE(H=NEZ0n>&v6RG1Zhc9PqK4&A6mF;yhs?cK-5^ox6R_R6DKf`M$27t$sZUhoRh}Gk&ee_!l1v@_9Ui z*Fe&(OX=zbOQI~RE_b9oDXJt93@irYj{o+9=Yx|z3h4<{9=EIR%JGjOnCy{jHpIl`&5$?ZHc<%hMLSURPI z=yOPxP;jk?`{S4$Wit&X_-z5AnS+PSoKOAXihJ4`Y|x2NL`D`P$+Ne1lvU5jUNl5(!qWkhk7B&JRRWUoOp zunSoyH3L4SMVk#Tc|1Z;-|ckjIq@l7ZeZ3Xt!C$BJU>Cyv#z*>xsp#~lS@+*)iRW0 zg(v}IUx?S3^f~J0BILLSEh>wRM=YyXXLOut&^0P>=r@MS;?{m#Wrex|`3Z?xOKejn zr_m5ooOuC_1v{^CN3t|_p)ONGNu*Q>6=G#QR$jwU1YVTrk}M_USXfp3QVYza2@sR) z%)QPqh!fXqO)6fB4qri2lX#cO z9&64vaz?w(093j05-DZ3CY%-pOMDQB6G6|{U+c1*3!5KPA8VXT~igZh)@uAN~KofOzqfU%pqU6Y9<15sm3 zL))_aDbm66Qio$@cr&s^5IO5!dfS($nBoQfIzG z$BYlDd15sQFlQ^xuBv6q7~c&O-tQa`ZZ|<$4v?r`Li?MlJ%POi4?y*I`Q+Do-LW4x zrhxF$#Ib|{ z;HH6&fz_l`mtiNreS9u|P-uTq#)zVxqi@MoUgdVN<4HGU#SWW!dZBQ;!Q7g^WLZ@g ztx@JlRHd=Q1wJ}|+MS{A)OtId3scJ%mwub73%^daxL+-s5E#0Vu~eOr9^{BtK!%T= zLXnZgT%z&exoj5Yk`F*E2Hgi-Jjv@U&l>JUaI|>|^NOF#4QY${`Z&7I_ zR0T$6X+Cw6d#McQ2??w%BeW_FK@HQLc+jG? zi12%&LDp;AhhcjuIh2gIYZ#%)OAMtGa6oxKrBTeM4dD0d^B8e(lAu!Go46tzXHN(o ztpdK|Cj?J&%RZI;z>WFkDasx)5psKn1toAUw7$!pNd5}%x2k>@=N+nl%8x7*POv2d z5s4n{A%MKB5^v2U1?MH;{;D1C-apg!&bpJf=6GoTe9t_O zkCT{gwYY*ljxx7>J$^$tZb&LGmXmwP0!FAqP~$sJ;L8J*EZ4_)1J21PkMSEzQ#uH% zniDNYT+TIaLVg`J}>&~2*Qne$bA0+g|#oWQb zQ?}OrunrI}zp1m6dJjZ`F6nX5g0Qzt*GZ5i%t^oU9&}Xmxt{ZtQnXB@+wtM5chS;y z!w14J);HoanJ2Bp=Hzx8mGjlt*e!mk@sW)N?E?goSQ4Y>?cgOu^+U5$uAQf-FE%AQ zM^$r4ImeGmSS6i3E7HqCW@V`SkAQ4Gq9MC%IVH z<7n210|-M{XSv>!u{2}@jq{(r|${L1VFh9R zVfLhTJ{yl`#$g6Xn{PjV5Oe2gtq1m#aK?00m5(>~*F~10@0(WOF_in0IWk-MA+vM} zl`0b@qbdqOo=bN`q}7b56Z&Sr9eYH-3Uga;Dr6;GQ^ibq$oFsIol`b>-?w}PSV#o^$_qztVXlW0FOk3R3Kg#Eb&c0bcMs|6A zSemIa_2!!Wc*OL)<^E2cFz6|Tk)Gjk_zaxz%g}{qIBi0VQ>*kyc?U**3hmB+SoE9l z5IzCkvGkpTo0yF=PQ4(!3XSyUr>AC>0_?UBN5VJvd``JHP z_eT%A-2X>j@e^W4>?g3mWu=O9?u!YH6snRi51M3HbVF>n2%O29gyNi}>MlS$s7DNW zu&T1}dDG)@zdZtJ!F{hp2V77%wgmJMK^(%0;keG)Pi9%!g>sN{5!%vE+pzpqlh*oC zrG=0ruk!#~oGxDar8Kls9LYPU;DS#Yd@K<>k8X~V*cmNP4iqTRS(fAF?7x$++%yaY zwP_#QPwJ`Bo`N)gnD+`XZi-&&og=DHBOh8WSiRU-=kH)!MJs>OlP=xkf6gBY?p$Hiqt zOUfLk!3STE8w$j>0eP@*G42Z$NQNTz6EMq(F6)|5Yh|FB>tY-UiENcH5Oe27Fre2rIAP3kRM!FqaLjPNZ| zgYs3FpWxf*;3bmuYjqmqY_tt%6{_Cc&*Uvj>Ita(rUgRu1kMC&q=PU*Zrrv8y3nfj zbx73v@i_QRiEkskJ#lv(M>=RiUM~1O1!j0KGG6kRo=QFWta4nx-g)QfIV{lhg8zU# z`->9BV@~9WjHu+OEw*0)%HvMZim>2m+hbl{Gp*c)TSHeBdbrmcvI1)5^00|}#MyT9 z*?ERQ&IL4$TN%)h3&wg{EFGHncv5y2tmge`4OL!j8@JLr{)q_gvJYaLBs(7gnP~-J z-aTp2`WvZ&uL9S~^$Yor_J`%A+7Uns2CErA&k||V)`Q@*OK%HoE%}&bmpP#w0aGs^ zRb;Lk=Kd4KDU2`oCz4~I8!Vu38~JhGYT@~4$`%IDC4t<=R z5Cfih4u-hp=$I9A&e*=8t>vnDoTGMJIWByZcefWXEh+4GK~wK~&p9*Uc?EOC7WU0D zXFxT{L0gFiS|SCr*(X!ZX}f70j|Y2Z%m&6O)wOpG#DrS$MY-mvHqzF^X6e}tRywVa z?pgbHHT*Wve!$Rs ztjA4qpbbOi9M#NlPM1-(D~`0e+|*jSeZOK59jio`8^sP^SXz9{>k{IzcGbpKp@5L zmxl9PcN#}WQEG8-PV+7_zAiWYRoB><`Ehh+gWktaA0{5Xbw0%Y$P=$34G)ItzU2Nm?>mfx65wxX zK16ZXgDjI!Omw@@rXJM(p~t*bgQH&_|6H1~-32@XoSSQ0f^!1= zHGZD0R&NUrhca^y6Ir3MTNc~emG~tkbRdD^q-+r-2aU#pZP7wXN`srlcvOvnX^wx* zj76-3@b}5D(=m?OlZdYAvzD1{ycs@gcb6vp{s-M|kwf96G8A@qA}5Eug}1 zvtwpGpIOlhIVDEbCF@jp46Je_)pLw*i8y7Wap~iAiziEo8ATKZ^70k4EUrsBVPgxq zY)pvf&;H@*cQp)kPdAp2efeNn6P#2^u$MlNr$9h+Gs?NKN1e!TVMEuP>zprU-wm-*b2&=v?vY{c z4x5doQg-Ft1W8ujQC3ouC0S~&e9!Dc;$m%r!ohB|s-}2mWB7Z$HP{mb$&Y*Ik=>={ zHiiXk_Qa`uKCejm;(y2ALtb{MngD+}%ar0w?ou1_mKjE6Au%5z4b_FY1E5HbsI3-8 zMu0YPyb{Cfv;miZ2pkIHP!dVIyazKA_7rn~d!l$s(O6_JGdZ$b#BYy`4 zM&c4318F*a$Eqnd=JjI92m8GwDA4lz`h^V?Bj8msI zvZOev3oqtVM@)2@su;yV>D!7RY0AH)@%SHp+|ErmUC*=JS^?dai~(0tVFvoV`HIO( ze5}age)j5jZ;p!*x8RY{6a+D+Kcee$3TU0!+r>GXLo(r_8FZW(Y~ifSJ-%lGn&qzd zJt#%PJmXp z@5%1xi*_SydEjs@EokvTEre>Z65Jht=`*5&RwjwISE-toidqKXf`o0@**=GF&EnJU z*Qc17vtn#ymj#6}o#lC@5lH2gNbKeR>*lq{Q0@i_|EVg+>&kt}C-PWKd4t}#UH8f| zb1PZ>0f~+~YqHy8_IXE1K9+i?=Q3g&TSY(nM^{-Y2k=x-E~v6(k0r1$x*nTrUp9Ub0%wLfXvLOC1BX>Lo9i+Tg=jzOKgNT}T3>>MnXxF1dmBXAMn zBb2V?hZIgkkMpSwS(D_iE7~6YtH*1F@;$>I{)Y682nQ2wRxgn%LYoD4&aLxfUzRwJ z?e*`F#lRs&`+*IkS!2jj&tf+PE3+i5mYj%lPqX7MculRihZh-X9#)YRou_PzQ`LAx zFbo-7w3g&iKSSmyW)|(2!p)kfVFB`3IOTeornSf@w_*lf|7fw@T*#Y4jPH+X2ozEN z7UMLPBo)||M8f+yI>}hCGpGe#zNhgbcds*LDPZrINUfNpo!g9vQ~Rd=&h1O;sz9%5 znSY35PFOtdPi_TJy3@R<>3kDrYmfn8_^VHRH>; zbPGdO15zqp(BA1~%yCi&EVZe8BYKP{{(m%TLGnqctWo13?JOEYRXtcKrW#{G9Gi#F z3b?7WYI0H*+|`cXJmHo@eK=ubf~kt3D>qMtKe8ZsX&6Mx5UPl7$s4tSiR(&bXKm?= z;u;U##vf^_N#9zU4|o_a@WZ5QvI1ddD4J2b*F?EE28TS`Ku?v$sfu;{y&Xv!&RRhE0_V0OkJ}JZl?jD}(Uduo z8ac`$_!ALm>&?OJX-<7`oRZ2$Jmp_-VKuCY6m7i0p50FP{4?k`+86o}CJvg?fhoZT zAvU(!g^4yJIlT-6Mb5EYNzO3uQnm0U&JXuBg=xW#5!){l=6rFZdX%)qkIVY6irHEj@V z4^Uuj-O3+rE0DiVaiRlK`CZVH1#RLP?&zO;LC$3&y8(|^!ACyA;;aRdOC9U!@DqF zm*xdm!vYVtrmm8AkS};T2-0^}SFM?2V7Nl>5_<*r(nciv+U%h_%wRr_Kp^~ecTjJS z2n^C#YqY1faACzSi4mTW<{wx=$q>pNLXgX9iiTn9Dx>z``V%-xng69;? z9^5qzy6#gQ8G=36Ti*@8^%B#Nz7Ks_&auv^oUh-35j#(n?A-YwGEy&drRVS%j zNLn#ao{KBw#iWooayqFQO?Is(d%~BqbSl^rk~HKrNxISrw+15bIVh*Dw|WNyjg4ngMzR>9YZzF((G}oh=x7Yr z#4lIyy+m%Fmkc-$@>yC@W8beXTxv_f@NZs-H{uqz_b${d3h#Em1^-`G9E4j`+3=4G z3q$-P!?gb)!wKC`jqrlgaQ`!qUY|kr$oscv(S(#31A&_$jSN(`cE?)=Y_H;KM(|1D zgMuoCLNF22tw|%mlFJLD^ZE-hlgJ;8$Z3x(5XZ9SC`yn~MBuryeP87G)(l2!qicGC?SGC~z?S z71#e-csJC69T=NnQL^EHF*>x@hCpOBh|$$V2BK>L8pt zC+dLaJO|~zX$nXw-ZU$IrvpJn=AoDGJ5k4L%W1tVyeTKJL4@r z!?7sAU-*lu`$=-{Wi`{uuYh^#u5G^4^3lOkiG&cM5s@mFu;h2*X^*T z=^V|U5L;m6HpgWBCjne6RVs^4T98@ch8CljVx*!wfy&&UZT!X_7Gv&{UzSc&PcL}J zN}(R&6Haq?^f>Ct8C6Q4aDVa+nF4GvA}QHd>Fd*GqIFuu&FNLV8!GF2n1KyU>R-R) zBeslOX>|y(Sw7sn<~ZBoR?#1&26>IVe!n}7vN;2XL0`*^JH_RNqS4ZCFP zeYXK8o%c$4{6er?ZTi&+@ahyLYQwZ0Dr4lRv> zvd+)nxb^1m;kzchp4%i`WGCB@YtKCh?9V)uhqMd4@ouSuyx~GlFW-vGfWi8#TGd7_ z9rAo%lmYIpU7^Z6JEPF3pK7DGcisd<2gpF4@32KwpQ1yBH)jZ<%QRF$)2mZMCWDO< zMtMm*%BAO+#ciA^aR;?gDlV*keV0$bX?i>OjEGu3aSM4L&u;O4>6`56>6`HA?$EJ6 zeTOj(VWM0#yNX7m2`a3U-vquTMoo_ce!#R>$$lpIQO-b03AETELyv`ha6-dq>M2kT zSW8j|b|A_{$U-?SzA-~&cCfkccOlQg&5l`K(X}^Jb_+!te3>{cUp;bII!%kTB(45? z5^>840G>q`?tH2--z?M9zIr#Bj!l-y9?56Uc~>;8^8mYH@{fpEO~a;7y%Xb6NIqVz z2C#K2vDgXdkBsrVcm-lz68o24h$=2MLL~eC~ZbM(>;JdaSe-4V*63vQik^|>%dSNV{ zr`ppHwczVC!JfW$?NhweTXmgqj}hQwhDaXE%Iac}#|Z^Q7A$P-Q#%n2HnnX%2UWH7 zoRU*sb&8M0#!g+r{`#(stZ%MwMq-Mt?WAc5f+u%)LNS!z-~=hb+Cpj3qUH#3C0k?* zSzjQK63sV2@=|Ma6Gizz7X$Uqcf;%ph#t5O(G?C()aD3-KOQTUVoU^AG~^MoWDamCN=m;1d?ErBpo-6XE6D^4!{<(q7XC8RfPLR zt>9`cVP1H>ip8}b-PQmB5f|$=k`dRaco=6;&?KukQ4h@3*sMRdrK-JbXY_|q;Uj-n zG}TP=Gc&=;7=9OeuwaMaeyI_ln5pZ2xAozr^;T<9G;u^?ICuGx=V#Z{30Lq$EGKnK zCWvT{6(F=br*%V*WdYGmrllTEMATmRs{j7Ze&cl8r+cd8f>MFrMYeWK?H~xW0(&hx z94kv)E7a?c^UCH!FS$Cb%|pN1mMRJ1a^}A=VvJ%OPw!-gk!w>rR#cMPC-hV0s&d=c zGqN=70vaNRpcI^{w#DkRdm&+C`*h~|y($(evTpSx`n^Ky9P#KW0&+r>O}Bi!U`azO zK~A=Q5tgkH4M`S%VIryaL?3L*g1kA$^WrA=)`I@Ot*(*o7u5eQT(K*uz`*=x;fe|; z=wH**62U;CkyE{!WK?EiQ)jBHV_|AxVf!~S)nY-@{1;{5Fg!N{0s?{y3Ic)+l33G^ z3uIRivKu5u>3U42wZJkqCTcrUE1#fHtObNbiie&2een0C}T5ZP9f+V7jQ2&$W)`58HfN$~5u?5k3)zO%3O4UWK6jSaH@;Q(4$U{mw{7o81DF-b$ zbZb(DIP;|Wv2bl^nf$rn;$p~*6kpcJ-$iV&l!7UoZ}&5J_FZ@CC_TKaxH2nk%#5t3 zJKV3lr#|NG3xeMtqk`aXOgjpB=phKKzfqzvj}%iJX@I}WI_riCNeAWghPTTp>w_kx zbov`S_{a`5adKty0ODYq_c~~~qoz2sRQF&#D5H@qJ!yOOj1+S*sU|+$zwNLceZ;!- zV-5lLeySE-l=6P;;kEk>8h*MUJ|ZKRj$QFTk$cjIGCgF@d}R1~7zpjh-(rHU&DK}s z3Y|8B{S?V(8Dl%Bs_Km~GS(HJ-iE^+czO_LwJh%A9 zEtdD0N^Wm1;K^~@wA)dGPcv8R9+Z;2MvQ04AlsBa7ZYaDFE7L)-=W4-P3*7PRd3RuRE-sTDzrS1P%aXPDug5s7pXM`HAeSrK z7wt;pi3#yIQ>>{v8(blI4O65yx&~Xhx`Ev$n59h=)km-95_JthI(wmVU_>x2IQW0s z5k;2^Hoc&m0qh@VA?*n@stR8w>#I%eQXrd4!u>*gg((#qluwO1g)%pi>pIbn$0K8#vK-SF_dp#1D24X_Z+agROfA4ntQVO8Ja(EF4a6G#5_gI?>VU35cT*qr{?|KSNWng23X_`?PSzH7 zHH?2OH{~9kV@UkQ^i!pO_Rbj=y4#T}>%9DkH5x0vbJasTyc?=d`INCC4luQs6ae@P zP@kn#4s;h2DBMeZ1B8m#2GGdT0nEhtz%|H4EtPO)jJXyCKc=xi(*-G$8HyT2KGA_TkChYx_P8w-k!S7@ zL&PvP$QeZlUDRi5ST5AmQ!0mRho18E`yTmBdbElTGDOIC>Q+=hQHeNA0%X`go!~o? zn)S2qKg6q{9991TB;>$%fhdxRL4P)XCX<`4gic5rcf9;|ZJ6DkK}JbNS5QZ;%<}cY zMh8#{U)I0KWlvY@}9Oz#K zNOkLL#&F$&9Nms*dev^a+_Ptbm3;e*1L#~^Qi`OlfaK{rf*uVR{Bd_P1XOyk4@)9FD-=Smy{Gsb2!VhWD zH(t=;K7V>L*IYSrcdolS3S2Ai)+VxhPwfxBtp&C}vM0_&@VUv)#8LpM=G6oybA#l* zS*~tb81hc$8SIpNm=Nam(6P!94GZG znKy{s;vu0cRG$D|QX$*+@653*z!l3MXkm?KOIa?sfouuP32XR?Pes)-0^x=!mbDl6W4#=VX)E(m*+LVa|8(3h<>bL#!e)F`iT=n{=1Hha6V)=zYq35Re2`C5(jEskW)hc}i4$f?zrOVt#axHH$!o6U6{Y}uX-DpBL{4H0a*z=PL3!jShhe5W;4?&ui zDvNHEB8dgNP``3K_c%P*j<+n?ve>Pn&xmbws~uuU4pR-LENA&9S2uQNMl{y~y= z`fX;tPjSwo9hE=-!+;N2=87sS&^Pek(feK5ejJM`~QzXG{OhZ{cr!@4XOAq zNeC`(!ZJq#0U4qF*Vq4%1hT~La2O!GhstuZ9^E5XVj?(sJV+oPDe|~+0*J8x9gC<+ z5(E=WNT`RTe8TT>*|c;J#j=7W+GoYe0s~+5@@h3PsW8Q=>RTh*O5be(o7?N>9qmnT zd+$vzYwh#im-O^0StQDr!^10n@7nH_jm!JnX7`=Xw{~<bE@6G%P5ECTLb1ul?wpI2F+QBV-=^lg@~A+>RKoewM_gM{(>WyB#p@h8DGbW7Jyo zR>o(Gx_8yer(9kg=FnA#xcm7a!v6^jSO4UYa(xvlTg$WXiR0a)QRCDpyY&vhli9UA zI$Z$!IbYB?TrFUiIPMl5C_7|Q1ru6rp*t2eT!p=urkZ_kK)!_?3pHr#8XqIiYBfTp z7~RS&SHo(&65%ifHwp~6-;<}y45QiA%kHt`U2KyX+#HP8HS~6B#);OPA8EsBWkV7= z7%ok}G@y0BMq&jlLmM-PwU}EM+FHSRm)k~bD|)k)I0jiZ;c^RNM-St5wg}fEv2KAu zO;)W)E=}OBwy~P}Z|IsWO~gg=jZI?r`9-@}GiTRZJ#PRiae*ytODl}K4IOUR8^@_^ zOz-M;tnL}Ay7vZUv{ucUot0{tjursDF*aHwy3Q)zabp!+*Y0)LjI9v^?X@U(vHHQ| z^v1}mToTqTHB(lNHWoD7N~_2W29nAOZj37FD_c`0oArqwI$$}FX4Dw#szh71&E!+V zLwI%I>^b|4Q$UOsjcmorb(J1}3~FS&jfTK@TJ|OZ+#x27TxL08nu?Shtf+Kt5ls3U zT?_>1Lzy%kisH+(E!TKV84mbn+zy@=t@&nQ7)3g=X)}v#9K?y+p*-Fl!XR8_0Ym#1 zb5S2D>DnM^Qbs}Vxba0AnY5E+8+@DL1slZ(piIV32jG}B;Tvo}k_|}qq&uhfxc?C0 zNotW|wLfLU;C?u3(f}-wc^YQ{cM-}Ixy_^60iFfwM(_7r1o@#l{cT>4e~=ma^uUIs zaLXhH5_iAlSY1^E9GMkONh(P2}9P*fI}o_drTNw;<=-juw}mKhtIdxwY` zww#bNhmDWZABsE*06iFPpvDl(eD!>UaX)uDS!774zE`QiOfhpKqWn{-cS%blI;x#H z0BtwSg!t)9vS~PiGI5L$&}xZoNyarAS-W+P)w3USIosrtRLYxUYI#I0wU!yd7UX2pAzzg@-QHO&fKJf)16LEIEOSk{hCiOssE{QMBz83R6&m| zFeo$}Y>#?&Ei7ywT+6Y5yZW1O>v+7@zWiB@>fTL#=- zMGTgttQ$toaoNoww@u~^cA*n_{StTuL4oG*$j7lBrF1;tJ)?$qx9r;7v+G&N3q5Bp zImnL*6uOEZ!PPgtBix}w5G2d3Os@##d%?fd()5iU`9SDNsa^Ew?aw{FMEu6z1%hNv z#xMlhAAyGjM!*FM&T{^{s7J%reSxXTd5B$Bw&wAEFntWQI{=N)liX`?XZtA@Xn)EJ zVnHEeTnrmAoNNlUI}ROu_9O82L&f2VYgU{L2uwFaZ1l%#lMi?8rOX{g^b6?C*)j)P8r-Z- zQE`~TqkO!Q$?8{lP{z?Nj~1V{<7Q#=!~Km)&2g6cL>Cwv0h+sSjwmpq0JPjPo>ORF z-8BW>3RYKqfyhLher?~vE&-TiDvgx zJnQ{UN>MEizR{9Sg3+lk{+6&CuA28i{m=JiH!er8QH*b%EcmxSxdT z9jLYX%rF^xmce457;t384k^gKHpAWwhsuo1+}y7>3(`Qir)f}WG!;Ll zf~vaqiPqo9xo~O=5Wz##8Q&V91=5M)XTW?NSbj0#fK8%@8D5jGYET ziZpO-%M3UiY`d(ZlE=*M_tOD*2t^F1k)ct1ZU zP-6V*I*%EyjuAqJeR1q^$g7&=DO1%H^qOM;26mj7=VMOr*W#dGCBRu6?se3;IHU`b zf_L=&1bptX)f7Fs0E-L%vISS3v8}w1#HL>lQU`_fNF(`TMuWIex5{KiPCW_%Anw>&BRBkTm z`5Kr)3%bM_%wtx6yX4ri=BKX@wzf1@S2RcqBBj;1QVz(-foF>?b^V6$f2XcD@3YNJ zgwwD!yH}_1N1T7IG=^d#v}$x7>-I%6RHG2pI_zZB5KB|gEwWIp`e?0thO^SS)o*2V zmvlUV>Ee6lmS`mg2og$dZ_D7T60MsJD?THX)oucm$I#dwL#iCKyL5wT5aO_4IYkGg zpik%~jyO^xfqpd{v(oIR!F3zI&d~Ru&kKx2%0mMKqVQXZ48+Yy^K9oHt2CV1(tNHjlc=KJkvMQl zlDjsm?M!px!4scLG)BolVSC?}tRo8Ug+6&cqK6}EfCK_BbmM*SLS8TkpqJ;2H0W6@ z-o$Hs)%i8pO}N)4a`;7qQQJcweE|x^)@HwW3&?b8Dlb^fLe;eHbMM`QF>1t?uYLU$ z31~;e_bLH)Ei5)BjJ2&;3@&>*xksF|(V3sqFlh@$!vTtw6t2kV5N88HD^U)rt&a+l zUZK4az&XvPz>KglnZsfaaYhNd+o311T=_f=-E0Tg_aKMDl9XB@z+14o%0gI|95kj8vji04?#?rkur&$f z#Z+c<>+HfZr^$)f#W6zMXO)O*_48KRXjQui)gS!Au}0r8e;Tf9_x=t(VYdgBUlKpf zg5$Xh9&c-ig*%54=;~iyT8tJm5BH#dHI#t z1Lxjw6@qscMa&5gs6KNBVENhZQI201izqdD+V^30Bliyoc`i|+|Lrh>AJFi#HIH1r zzRa;R*Fh!*{gQ-4Q{d_y_5w2$FFMzKrQ(@qdneX6-RjPaT z?xN`!mngqt0{rg4UkatE%>}zt8IIHd0~X-c+HBrl7f#@dPGRpK%Sozi%y+`>uxAu3 zp(TCL{warxGQ*s?$X^%c>kOTVce9F~y}ium4lSFzm9fLBm;=Sh+1x9iVVD3UstSre z*3*3^_)eG2vua+zrg%jhZ-sod`y4GzN?6dij7zC=G6RE3kc(4M&L>PCabtY=fQ<#A zC(z_MI;k6PJeb&G`5Z~!wzL8rX~!H1-7QI8PqOO++okDj7mC~B z$~TbfeF;lO!I<4q3nD><)%(gOVD4@S-WzyFJWzr2k?36Qn{IoAXz`jm;T!FPU$V~5 zWKjLw`fW!l@!Zi1tXm?^hNVP^bucIR2S+xPrSjS36Ztv5$c$hxpncA&GUHju&aOaR zx^{6fZ!s^hdnGjc3v|T`t=IaU+Y5>xIr)*dZirdx8Q+}+dEOi1&;Cjuuvg5EKq5u{ zSYMHdA3F1uidkHdKR3RbW2oEz8`g{YH;*$jDNb#2J4uNR2#n2M2c9&(H24n&NFC^G z%_9UOM@EgU(>^1jgfEIr$j+{^uGu|-{_y#vp90BV0VHI;Xz&OrLC zfT^XjgF;?d&#o`$PalnjgN zr5-;rV$uwsTCw@j{(s82@~9@xEj~n62|^J=2wOll5ee%9WeH0W1j?#n5fECCU|Cv_ zMOh*cpJh8#KZHUbf<87|1dV|r1QJ0O;V6qBKGyQ21zW`Su3S!KlqNQjn?YrNBBy~?yqb06vq zi>MQuQghK)W|tY)1s9*YoBR5wU!7MAQ(Jq+C?4JbM;mO+v0{Cq=quwiA9}FfOSo^; zFX2h^5qHrmz~X6tK*H}@jH&!eZ?yzXoQsW?yu_U2{sOvP(|??P84{N~7^Zl#Xx^^K zIe%RGfg5>oTSRC%hS9$vUNEV~u(s<Nu7Ykuo0!~H8yawewy z7xgEdsnb5Qotr1N8188U)RVHSYoD)6n0(zI-Xb`G8^(j3W>oWzkyJG%>?mpbYi_M9r*1noPM)!Nntj?{kkk>M?^89`+U~1b`!bN z@pf>+#rCxMt?AKQ3!{%`a=o1NUiI5gwMi5?{o_T78M4ul;yb2M9!iOQEhe{G_I9N# z^R#Z$?SOe3S)mC@yb@)|1UE_Tr>z^4x9p4D>8TOc^m{$CQ9A0|Zixo*$Fid(jjdjq z8@_SqeOq$RoVrp3w6C6%YenH^w!qFXa=E>&4xy7lS)5qFK! zEyAi#w7T}>4cD~~u<`Xe{Er$Tj(X=zs83~amdd(n(6{Y7E}ZytbKUv_#qv8(J)>X# zsj;KF)lUyHl(sjTTdEv81yxGXnetrAILnBtSm9);#zJLdt4e85IVjBtX zV~HhL+F~hFO6f+W=tT2P!^ciMI zu_G~q&UVF&UbYWr=r;RH2@F#KdChLBJdbCxa@eoJ2%-SHf()SO`SD<-t^uJIDw&5V zzhcmM7K(j{2!g171i&jRRgVCKIER290T04D@mQ{#EhHR=i26CigFHVKmkRrGK$@6fkF^<0W5HXSS4_oD~HvY%_ZSt&R~g%QsBG?QP0Cg2q(7>?j#(P z!`rx9Upgx)h(o1R8bQY5zz69?nfw2&IFyDs9 z{M*o<7mmhQK0AVvD}6>R&8!Po)8kDn5P*9ewX?PNp%q90B$ca4++|Z|) zK;gP2c=()O&Z7n;N{EhuImVnaqUd_;Nz zX;Z3UVd`LaXSQK5qjs0r{<%6zpe^i#SAa!_@|Gn)5YL2QC6LXO-YcB@oP-;GjFN0W z*TGh-+fBkLHh@5;#UAb^^vyp(alPFt8166Vb6}%BN{{y5uWdjN0XND4a^g&E+qP}nwkOsElS$tEGxxo_{`<~adv)zPUv+iw zUHjBN{Z$7Sf>x)3A}Gp$g24a*K|ukTFe!@1BalJ;(;7YhP>JW!M8|$`x^n^s`X5jk z5!fH_6vf~6nc+{HNDaLAM`%OR?9HlV`*1PBNT z0tkpMF&+#fQ62#okg#dDD2Nnlp2#VW&oPrvM|UciAEWafq76t%Er}hkNKi>wCp>dP zD(ZrIE&j@XNF_itcnBP^PlVWPRX&pzHyn0$YGy{@!Siw#;P(OI&&{hS7@&<1#g!KH zglD4&h|Q3*lC^3vDVuc2_1|zFq;%jJ9DCve2{}oB8fWGM@Gv9l)aD>j%I^p?3TFy( z)tu|(7`NQbIKOnXs=G)FejFeefkz+cx@|sfS%e8{*Wx3OUB2>lt!C7i_hS29uJ!X& zE}FBv*DMP(fTZRmnviq5ihwki5OS8FYIgV7`XN;H_aRIjuHC%uK(1m#U_x!}e<_ z9|i|al~P%yfEgC zHi(lBRKl?k0gRCPFp(C)5waD*ED#krk$W%^GhzcBSUU|wyk}f#*?Kmxvb5kzn)oN| zzr$I{7vJ(23#5+DP>EV^0Pg*=CTgT(GBofCkd68-#=_gOX9n>63M&`b4r1N?><^1&kM z`lv5dQS_Pe>l1qJbK)HU^9vBizK|(Yk#{rc01ApalhzNO3bsbdqZi@}^AofR0LDp# zTP##@oCjwrr0$tMa4ck1%mLbk$5M-wmfQdX?ulNj-X^@y2BL*s#M4eK>CIJjyFt_p zd)MtF;lH{cv^t5T>>(1z?O8YwPvrVA0%Q+!djez+?Zmd4bg#Yx5zxlo=gPba+YEt? zgKh`2U}%?;UmT_5*$Kykwu4;+5F*ERgWj_Xd8X{*kfZ=(A90@u=@dO`A-Xwqd$mEl z-|o`qzlm4t9C&69>GVc$f%`$gw}_9=>GfrU%Y)Uc>~m^ArVuh+xZAv0qB$iv1YdC+!{D*+sQA?fQ(ZdOk%-CX(VY1zJW1Q0!7!yvj8+ zEx45>NiIt_)0B^8(8S|Sud1BEw-PUZaVP@a-_^brG8n?x)})?`CvUPaQuqc;n(q#W zcyaEMo3ezrqa9&*)_xA2_t1(fHMleD((%Lg$je*GZrW{|iQGOFdo?}f8AqyHfQ7$E zM}iG60({Dl&QZ1z?sdiv;C01BI^9%5X<9Ew0(>1bm{POu)f(TDeoal?@8}*XBoQ?q zRlFXWzNK-Bv(2a@N?{bSKj2)_u_+E7en4c8ErR_@(1ap;O#fD7*9u1v4q{>|EP6@r zuhNFP*$vy8zGT4+jROro5d`A4t=zsG8Rwrz!t08wo|DR@q!yM6Koytn$ro-5%So`d z4Czc$kN)mP+(23az1^}hBhkodfl=Pnph&mv<+aAFT=Q+G%}}Tb{Te=tLfZ>ClE?a_ zb3m2)6d@kG?&_iZDs@bzjRe%$1h~~TlFCy8@4P$1RBbSr0@LY6?o0~LA*p<*ufU}b zOU}w|WC4@LnD~tZFr`-P+G(y#II~7FYq*WWv0ypRm1RKOVl0dTsrLG7W@_x4-T579 z2ZnngyY1*S+@-RT;G4f?v~|lBkO%5F<~=ERVq-L{i#k*3cXzX>;K*U(mVU;0%S}kKRhm72wOKoOMY!1$|)wB==dmV`y!Hh_n+QiK@J31cXC5V9k6y6{{ zkG@E#MeDbg1jK1z7+g!4jXe3-Da{-oG&wOnRaMdxva6`fn*jeh;Yx@3@r-^t@zi?6 zYfN#*!-~4W|to4)aC|V11Krp<7RUAY}MUqH4#Dc@esoMGC<&H^$W}YI^b#+YXv1Yq zeGHD5;iFDZQnt)eR7WiHAtY4gq<-jB_2YQ1*c$EjklE5rvTDPIuJB7nyfeJjqs$n1 zuJj4!2gIs!pSDUcOKoDUK2XJ;=l{gpiXZ5}Tvt!r!3fXv;!a?_g3`loG5bQQ?F3_x z!f%tA0GvU}mq_JvcK6LzTs#hj^sR{9hN6UI^T9!7nljz_5fMInxMc#=M-_`u^%aZI zoZD4}yrF54$WVM_7aNjVppWTjnd|1Nj@DLM7od5J`skUga34gSo3L!jU$}58YTZvv zny%JW_lBf=K25#Ai@d$$55~*OZdYLC@#A`@x?w~l&{Xr7bC8vkIyPc28TRIwNgToj zci||){tKIiFDYrsGKP|86nye52$R5+2n>ZPfw>ETbp)mXE1DQ{v3H46g4{j>*&ykI z3m}c3u?OHDk*;)a1>vOM8gLwR>)5(vktEChAIc~V+l{;eW~Qqm#m4{ zyF<<#hsd^xoBijCcQAqS`=3L=)DbE4lmJQP0XDzh0Yb&sF3xGlR}rpehKfdN0Wu6P zZN?fMi*%6(7zZ`O7Yu@Mr5t2jU(I6u0)6!ttz?0LZ5V*+@#%{(H6TkMfU(!Jq)&&u zm6RA_@=Eg!l+WC5v;;hKXj5Vbw|Ty7YSXR}ydTz}KNDX`Rj0KMGJGpSp@c=|9FVu8 zq>rNASN>2l$-<-YE69Jcm2%!)ckbjuFzNeh!|ZTO!43cDc^p+33x-~tn+ztUl7(Y?#n(b_MX7Az05uG?TYP!Uzh z^5zR@-=3sa)8=`6|N zUjo`77Qb&4IMtNX-7C5a1CzJlox|KrKT*)1_JGnjMrKW=I@0C#VAj*r zfkp4hMxGWyr4an9*=cIwX-W)Zo=lZ$%j{st`BAAEO&QYC}b5nstTrXQy)+ZZ$#fonFlx$Ba=!iZB@p;ZwTQqi?a ziTA*Y&?Rhbein1V`4tir!0p}Tw_krsZA+P7C7J``yBm84MF%JaKC?r*$19}w$`joE z|=MipPeU>#6vtj_2@wJ@>&FYV5Bd%!<$~(|=KKlb&r-`tF=gDrk4n|A!lSc4UlyY6*=Cq}`-NVJ zWW8agazhPg6lnl_qV9&ih+CRqoKR`n+ETedn|_o%0rYc-`+n%Qg$fIZB3(R0kFf@1 zC0Apx8}aC@KsF?LQhL1Zr(BosWrtV-p#n`EHT^H}id4fNIu1WGB9FRxWzg$G=T@*c zRz`m{s^UKA7j~pks0tuGgyKLL^^90r;icu5u-mWk$V~%md+O{nv~x=793($!n}xMD zMR-aqDS+G!GfK7>n@&;i(~7(6wK`bHZ{4RAH{q_V2SeO++dActpRQt?!SzZf>QFjH zpF$iA3^K0y{LV*O2Pas6zXTVs(XZ3fPHveh02VJ)H6-8rgb$psIuIi#!fCP30TdT&4$14fF??Vr z%)MDw@PWbDf_glOo|Cd&_`69$@dHU4+V0lo-jE1O$p`=J$5V7|w_xUX{AVlOUeFIV zksLn24$RHN(LmyaE5?Cij9mkmE5c^~Ry-YGpZ7<<#U5(h>Tq1}quNQ-Q>)hx+ zX6Gy&pIK5Z(l1`j2PU3mIQXeV2@|IM8(|=8^g~5U6`5!q%!O!}CjnFZ$7!e7=5Ecd zKvF?_;zDiHFl|y;p=F`gtOHcnp*&l#D%pYYGr}_DtR{wjcyFEq^P}hnUfA5(GZgs% zE0ZN`FYpe&kPWxwo=cM*SWiAZ|H#htCy<7owr!ZUH#RT$48#H38WEixpX9S4u8nmY zJ6{a%0}?ix?nkSVRH zveZZtFYn`sL3Hiw*mH#lrtx9N-C(K9k8;pY^RcZ2a2X_mU9l2z_r1P(#Q#}JY6P&r zg8x|z>K7xL5c&NNycq)si1I&+L6C{r!w7(6O?Ly_W$e#vQi%p9$8R>~`~FbCJPoES zGLpg;ydWidn)1qFE$3PtYnUe4oY~B0k~$Webhc8MbKv;rb{66AZGtkJa|_+i^xNKZ za<9Jb=I2Ga3%6mrozFWQfL#v-zsqq*0uYB96qv&mMm_ZY%EGdK>wz}92yMJ5;eLR% z>8Yz>7k?l}@ZAWd-6+1&(*6u3#-0I|eS{G*!b<%8G;^0&XzRo+`+kp1XlKaL6>^uz ziTlJ%=h1~C*iFhSA9EK+;Pd#qA2vTyKcwkL99-C78$}>u#ak_cas=t59Xr1b^TMyM!tQ%^swZL7U z*#;}`<*KopIDOI;$90D~EuG$yHx};C z@LS9{%c^UVRlnIXw*1n--P#UtZWU2!V%=nPHnCc>)Mm9v&1vz5i!8LfQgINoE=KRC zRwycUug#%X#!?IJn1;jGS+YNR>_1p)vx|o51e=z%Ua!tD9oyJMTjRAxqb+pJ>D#By zIg1?C<#Q4KQPh7{&Cex~dPE1{tJU&~RWg8y z!4wenF5e zy_ivL-eL)-iw~T+V58G2Ezc!sle1Y8*deQ>>ASMTJlG>@%SFWs-uf-xxcGcSRSMPf z&1p)>-P;#y*KCQxWiu84*}o?*hCyv%?aNJtyMjL!zO7cRfv@u{l<-!BXwn#9{jT< z-y?V1tIE+j@KUXtztLV1mC73QMP6N5e779E(OIt9t(Av^=~)giNx%pLzK~28Rgxv@ z9@$b~VZklh6R7st+f}xjn+l^{dA4o3pyQUbSrNh7BeE+!lQZXzn8|b4)7wA_gr#+-;ps&uWe8DErxO3VnJ2)+< z2{h7dq)>Yoru3r<``#?hFP7$-`lR7>dl3PeddT5)tHWghb(R)fwn=Nof&jOmb>Izx z)Hp>2S&z`a?@lf2c<@Z}g7{JxAuzt0TOZj?sxmLxcrXnJXcxW3DT(Ncqpy}hLCTM?iIpx)Z>r?4Yzr4zK4Sgh$`eRg(GNNLM@&U~ThxJf?HIM6u$-9+rZe>f{ z>Y|ZdC2CaSGQRJ??Ie^=suA{;S3q`Qj=RMUJ=VmvebO#GGg>e-Z8P|Syw-P zF5p%G-kI&F<4d=uq!I&w%bVp$hM+8GWE6z%i|nLoO%)x6*iQ?(_ASAm(^}Py=NeV| zx%|qv6El(*YN@`rH|ZIw4`28>s@-!lpqO@Br)LztmI$oCwWtOAkRl`f3K9;0)p_iEFIlj=a`d z^+ukOd!Ej9V_#OLbxVCN)V__IPTr(#wa!e@tfqUSI_pVh&-Ocy-|^N!Fy-p@MQBkP zH9sz6L`ozfS(p$tJyrR%mfkdU6;6m}Jjt{W{ zNZbw9X}^yc&CdmCGO{zocOZU;!{Dd&LJj!-ohjBBH>7EC8X+9icKsU=)x7zhi`pnLE5eq#`CtiWgr!F~OeS!?3 z$-(EjgT|xe!TG0l*wQh;SEK-K@JGE# zDD?f)Yu`HS#{17fNE}#Fgh%BkNHEg+ih|a*5!@mk$ikHmeV`*AUZy#)C7|^}0X|MG z8Es8JP^;KtjoK55o(l|dpsyKq^DUbQ?Px}6Pb@C-f9RF9MV+smMs8ZoMrfDZEsrfk zP}K-$IrDPJbkw^1021QBkdZGuq{NslNE}bk>gQtNd}gfXuH{yPD0ljn&UsL#`V~1x zy0^ebY94jUa-TQvarVIHWE?zv4G^-#7;Qd8e-QVr`biy=r_vR@@@dBkG|W<07#Wx9 zU?Jeg8jJPz7Yfz#dPUmwjFA#sUA7j5!V5o_RfA1pS}cdH^L6r^=5Up!S_q7YVi(TL zCoqVrP~h*T%Lt5T*xGjW6A?vg({J9$D*EqobG^V$dV`BNIlIXK*kKQ;a-d?olL`8fhhH%%SX6r7hsZ)x_qp%IEq^?Lk*R_R9?a&#=73&gFMth% zvxmqPZ-iX!IPfS9X=}&DJ{6GqOw8^e@*G}DcB&PR4{Z4{Gi7ix`J!Q}QQkE8!T(JHHI|C}fcZo59Mm|NApT|~AK?;Xz;F_; zhaeIs<)H!U=NhOQXrFw{UznnB9BI&!)i**7pdvP4EW`wh#Z{3ME2~AAL+1_2vt zfAh@0Kfq!*(1UAeIT>`!GKkR&CB~{UxMx-h9W_WMhR&3lh%_{d^>AE>RN>{j8a%|S z##N|W#wIlMSqLiS_1Fk92YVlk&@0ST5)&vQYq9R2t|M~N#a184z&>$p6vVz5YAV{U z(EJ8cGOHI-xCy5F-4`hok zsJmo8X|swnwnDi;n5j&Ss@f#Oe%+)XYEEa`7$5j%R`#_#A9#7A7VdUug0yRye|W(o z+f*7(4G6@k)UZrFv*t@8wWIn>V3`?RK-z(|S~S__G_nXsa+*J<=$H))vQn5@ww2)6`{I^p8AjAF zvz(5B)(3(DnNw#KJ)`A#SXYRWOIB0`bdBXgP$L+7E5lc&gMB{G(Pc`BjMc(n_+fc~ z)={%-$v_jQ(&D!gS{b%W2VB#L05sT52ffC#^ZlWx@F3svLNC$NgvtkaA6N`22WobztVWP_^P!ZJ2G{+;+@JD=jZ?n2l!%A5sCeU`L z60tG_aEBbzg!tmRI0y%%AEaZfs}qUT+H%tdEC(35%jS>Xg=;sxj^lAQuX|;uF!)aYG(uil3G#|4 z;U|urnwk-VW7|trSC&WEw!pO({R!XM=W%k?O_VEA-+Xx?sNt2@@=~b;;7^npHCB{z zE2kI_F)<0nn|gv{VZ}^a{LvN=o%#8UI=!A$YVJMpFv2x>z|-Gu)UkwYmY>mM75M14 zDs=zzRSC$VYBuJP)kNHj>8x{F>{Gmo;tHPCS^`?yvI=e`S_Eu0s_+XIP8f|QakL1G zp2#_RLW%*Y634oK*N%cJ;P*?#9Z*KUK7z~71Po8wa|(c+QFbTrbN}8frPQD^=uXfo zqO|qsBM*>3j)0u7Q0tO)Q*pn8ay%@ z`COHp7FH$2;XfP^i_4`ZMB~UE7>e(EK42_qRUGK`2vbmO1^qV+P}zioBV5y@J(Hw8 zayT*Pf+tm{GF2yb0e3`phBP0-m6W6GN+Im^Fjq!|+(Sy2NbGJAEN5uu^)!oc+mF$H zIW{edgY9D#F(<@UK?3F7Ed}T(ts*UIAO}z_@v3`uWnwxd!1nvp+;#Z$_gzptlGKLg zE#r7v6tBMDI8hwkUUi_2hb%d)?BXql7YuL$>b1O@Sz!$pDBQ6Nd!Y@^r#8Z6{v>(&6Dh@Jo%8aZkjEs%U ztWC^ys)_st%kalirRfTwsEFe|{C6`YUphs};&{3OXEb9{@17z}F`xK}lk7k> zW}^2ZaQ#$l>rH6V4Bx|KD6f2A0YhCM*L&qOLV6M+BN31C`$jzR(fg`olg@%^zwo4{+lv6+Yb zYck|Q0Qy%tapwj__{SBA*SK~9I1o@ed?IiVdZI%tY@@t)8Ten+oBu2D9~3ETs3P_6 zj@yuaqv!#aI=HLoeiEDC4B^B_8pMpMI1Pen3pwSqA(6FzSNkySeJL7Qvt0m=9#+gJ zE<|RsOstVgEs{yFlYdU8x66Dizv}So@UhPQ2=%*2{fOwe>1IJe!LfP^Xg}TI+WeX0 zJo^psei{paaDeMwjvH!-h_!+;YzNg!QmeA~=9LMEfYA}z+N^Rr@Z`)c8$gfEh+so! zus9oO2&LCOAL7PCXK*_(e(}I#DEH7RT&G~Y?59xkkrsiObo9}#$_+nkH1ZX*=%S_- zSPh>YMBZe8g49>N)5fc{#_CJuzBBa^JM&TF-BG+N3AFQGZoZU$8hWd`&`d^AC`pNC zBh?2uS3CJ_Xwp%hr8P^V4_0%P1U6RNk9OIvmnGfj1PvrzCEb&aQl?D58?8?WSaPa0 zdMxN^F;NdwRT||aBEud&ZZ&^TQ)@i%l2~5ZYb=pT{;8t?0wOJOg1*W`o~3LXa(!mu zp17W*hMoh_f@gb3&2FYf>#p11BbzvYz3Kvp3Te>7;;$ugTAy4+6>uERu zB)Slw$E@>2wD=|17P=rPlF$UZ@-0VAp$z8Q`r2w*EzXLCQ>k%6OeIOZxuTS=RGRL% zpv(rTs}BKxv)<022VX|Kc}KyU-MrEP$Km{jB#Xu=hQt-KaMG$s@=%h^&vtdD-kLqtPO#Wyn^( zrJWF2>cRudK7LLvfjs&+%tR7_=J67uJ3TT)P6OGL7cUR zm@j0b&WqirA(Yt1UJ#`E(>lV1cSk8=jDlwa$&UFN%Fi-wVv(!kMs7aZYnx&5MH zx&4A*uS8qwi-@w2j}@9`@n_U0KXvO#wXek&&1vWTCVs{{$_NGG9RxuhkP3z$78Dg|;MOe9vEj@ZJ`_0|?v(C4 zfs3EyNC+?^e+A`?3U1pZqP`Z!+RxGGs23RFyKyxBL}IN$JnT-|g{1uTn0J44d?`n{ zz6mwGEBeAsf>wxTyqd2Jh*G(1L%15FbD>U~*$%APqn=S-E8eR;%V>|b`+i9fjn^HJ zqa#U)6^N&d`_o%gxnA`M!)q{Yv+ZFvny1%WgM@456pH&*mN>BcT`NbF z@P}dC?DHXk?17#pr$6RgET$t8197xO8J`pw2B0^#z#q$uDVT{DFaZD}5BJGRLHPp+_9oo}Kn`x3JAEoAQL1W_B__dc+r#q~{9|up$S&L`DNg8%1{rB5#V7(c zF~HO55on%(bOe%VS|$FDvvFb%=^4BsV^4(<3pt$~%Lj)gp`Vj(c3+BQ{_K=0CoEGF zUAqxpJvV;{`l8V*l%jx|Z=ICG!9iY8`tck|!Yo@{j+%D@;4)%rBsH5CFNzqco5ut0 z+_snahM^JvoiTfRb*a<$X=j@y(R7xeBf{cnVnKb31w@5?}}| zl1LLWe-t8{&~Fh5KoI><-%^jrvD2o4)1i?*e{m^A{1wvoq4zW)`JVR|*pYgnl$Al>EZ6#(})&8tafR z+s%eCJo=M-4Gb zkk`070#b;NH+sz?CshIEg;&0R1e%?Daml7mGd%^Qq60Rl2{owAPue#*Ozq0-?B?$_K~Hn!95Zuz@428;e)sy?l*0gZOC5bt zyh#MmsX@5KiTAekXGq$O#;ILAXEyXf#+0=0ZY$9BI>xbwx*aaiNR+Sk34dgV@JQ4& zZ=6ZJ$H-l%K*`iLg#c5?hPON9fX+Cg8W{Iyuku}zECm*c0FlHu* zX;~iT=ALd#j~Zq}V38|lL0y@!7>FPr7{3L`)1-bY@6*d}x5Hh0i7ePGtpBRy?G%lz zpm{e^l-|U;6NAsdIj$RQ*)-_@siNe|8Q-_^!^XBtPEIIwW2FeaRRR@9B7LMR-g)3o zw4vUb=IA?PA)P_pmR0m{_3vLRV@uGbYvx1sm7Z+bS1nLUIMPLJ+0rV#M!Vzhp>*(o z<|mq#s`9U`cEcg?viWM8Q`u%}8q9d*5jwUj*A;ALD9U1(OwkeR1N1lYcUZ|nU+vuj z$=9&#A~VKoI9YY$`8wA=u$c;N)!2i?Dvj=1Dq7msQR*u)NcX8FTGjT;Okq1Ms61lW zN#oaQ-frzGhnX-@^+Dj5JW_fYRo09Et|QfEDz6}&f*xygJ3M%m$|AT2hHyboREuOu z2Uh3n`@!vOM*RmL!}}JT?MdS*${ji5I+)h=qFUdU=a%c2BWh8FZJMc9Y{XYG@9N&& zAiBqYFb<`?L3ga@#9zrQIB}7T`+>Iy$@a)=4Y2l_92(H1oY)n=w3^sJA-qllKn3dS zVR7@0BDSa1sfi4m!O5^yX^6uuIJ>Uk$m$LmN?5|0MjnOMLFxTyHUgspIyFd|jLKio zCp*6}Sk|tKI@htETwXDSi0FB6Gt-iiB=e8GiJkA;upzr=w@0+MEz5a+rE|IWS(&Ra zr{QDgsp#NQi9bGpPc2GF(qgj#Y#4evPY6PQ1Y}7{FNs6mJ9>>1iQ56!(uh~a?^F-M zn{lw~u@HpubR*M5n7KI9+xR%Wam^(lU;sx8(W0!MtyqxN??qk44-XD9bgM9)76h+D zP=qq`scf!?L$x--gxe1_AbH8s?idZLNSVY&X!^IRA4e=n3WaJ`4nW5PmKwLeL)cuh zl73xVG8ap9eC-~vi)@JZ?7&G;tFI{n%c~3?6U-99|IRsP<|uE4#Y);39O}>mRTZ$Z zXn1Xwkzy^hdYhe7I43oR(O$mqHq};>!|`}`)G^aZhanzJM?bEqj~OXiWp?b?8s`Q~ zLl^_?=tQ1Sz0(0N3--JOFd?~$*y7uZ2u`LqdDrRG))}TagtTqaogQ7?lXW`C{=vd#fAwyX_oz9tNEi|z}q7(y;YxVxoHv!&oAGKeFr`lAc zNsET@Iupw!ofI-?&RNz5MGMjWRq`ylzQ%*ainIT&K1g#41p;ClAmxtj;(yI}2J2EO zq+i67MqcDmdoAteMrNood0E#w$7wkC%w;)8d_53G5I4IGGz1Jj%Yu5Ph(gg58HIDh z>VbK~en#w-RPIrhXnd_P`fM-}aWR zYj2FFliBgO(oSiiiB*RaA2pi{p{xG{ed>2ijZoX?T9l9zi6Pzv&PN-0G|3i2j9=wd-(DbNZqA8hO&ebEm3`NCzxEaF*C7?4Csp8^gc zz<|xUg8z-pPv|VRkbj(V7O2VA49wL|19Ilv1wN)>QoY;bBx-2tz@cC*is)6RBT~oV zL!vrGi)1*`=%g0+J;6joE*m>~Bw^T0M#hoWxH`NUFux?(D3>Uiac6Q@do$|r-Tc<+l{-}JwcZ_DGl$Jz3Za@fbIg6>VrP-wiRWUrq&9xg4$@_!$Go6euCw^2#w(tOu+%9BDu}Z3u??Q?&twGp zV+j*OG_0}$f~=9$q?{^Vxa=ZM^z@PT-S13|0AH-(nYq>B{F_eaCA*NIV!>%Nx0>U= zIoc=Ynv0Mi3E;jfvx5GOY}HuyGWc$#Cu3Qua-D#$bB1pA$+%v;=^acM$!$qBsbjc9 zG4w16W5kl}uwXQhT35NP;h}?V?O(HSWnFCLIP-N>8y1?k2#Dvi^9RW2soz;RY*t&- z0P!EZ$feA6cdFba=M)Zj;-)u*vEXu^JtfB{a0kTH{Sy(`>nJH$JBh(z-+( z#=YhAE&j+FI}}utMP&*j3(pTI8uJn@T2e_Ipa&OjmT2{0E$_%Q8!0v#hA^Nm+lgs^VwedB@mfo6P2+Jt zWJ660r7Y!_oxHDAv7@|#y$E%jDN_F8WaOq9y^=_YUx%{5eYByO$3raDd*nV&HwuW9 z3$-NsbgR@!H$Un#>84t_lM);4sUAhC)-_>;_J51ohwEY$yL3b2|G zZkNu7WYe=EsR5!K?bt{zKV>*l^8itIt1_N}zf^Mum3mPTCA*fNtaNPt>xwAa+R;^n z&_Fe8p$_@QN-VRQ7I%H};z}%1mvgoBC3<3y9DoT@(xe&guw^Bs-v$QU!I;lRs=EyT zj+(G@%s}XZbCpLxo-jX|2*BlL+Aeu(Jrtn7r~n8yhd8BDP-8Kq3cnM8YwJ$m z{X+4hBWCczqPw8bUqrrtPFRr%C`AwQzFnS2p(~7c!Pt(>F-%8yP?$N9L#9B8&iu4M)y-PclN*sSLEV-*!k+Xz&#CL!MQl$PZO%PrFU2tQ z=$fH;SPA#)b+#1r?lGpp38)Vv$1e)>%h>uNQ_6~W;?1bLB~prC1f2)>D#+U$Rr(uCya$)I8_Q+K9IORW|uuhOKKD+1F( zoGT#5aSWA=UqGUm8uW&A{Hy|wr}j#c;$JqxU={Z6%SwX?%%bk`3dqJ!c6rPh>=ai? z$`EOe8BNp?k~tot9ldC z2CBZ5dCbr%G;dtOPw~n)?h5@S#P4%(JlF)+aAX>BF-2H{Eiz6f+TpbR9y&-kTXUHY zj*g;0fUY1>2C^H?3Lx0$i)L4$`zn39h@mZ!8XpeWw4`xWVfiXW=R&GAR;Mnih07;% z^@tL3&eIg_2UGD(B}}LUnVm-&n}-!!D4!$B)0TFiD=n3y@O4X)$CLExz;h1J{cpprS`M@}z9(sdKrAd^r&SS=fF_)fWEiZiJNu7D%}3{7C1Rb>Xe!EW9n zP4Viv<(y?)zaFl?S#MZ#&d`mvUrdhBtiZVQB zOxZWAJPhgH>wx`w!2CKjfSr&YLSi&rMDIE3CO|0}^6djhWC|@I-XDIyf5S$ko})+6 z20X|7{i_TX1~yC6X~HIL^zkUdtGV@@?j3lZw*{I zndu+s+6{1V6EVfn|7ig(JFjrs=W@E@L6gj80nx08@#jMO`Q!fV)wVuOZ4ayYBN z)D9%8PTa_rDZ_~7(pHt413KT~FWLO;mw^M*W++Rz9JFqj!OY0#c>5SGAsjFeYTSg= zDHzN)@I!4vqYE)!y$u6&N0G7Uc|L?7KR4PxE(lPd4$NsIWY0 z@wFLopIC+-r>lsi+oW4F|9A2^wt7&ZfnoU3BPb^alc)5Z{l}a*Wm6qV@ho|nGT7Xv zu19%w5<_Iy_=Q6gW=u`RBIio#U^M z1iQildm3jF@7%xAc0p3ny6^>uZ&Uoyzk(a2#K9ZgNSxc=uGIa!dbIU|+aA3-3aFAmy7sFe#x3w!+f>{uy)ywMV@Lo;+xq{!nfJ!hfsL_}4dhP7IP=Z* z^N&NkpL`T~Lrx$Xnq7z`4hTEB-;VpCelOgJc}77!{l#)d)OzxDu_;Rcv~0us7oIVD zEXM-xj)eC2`@qX3fnGsauCsT)4!9ZCi*A`oeNw>whMK8w6I&x=KDNA}@?oaSw?K3N z=R+ok>X_jw2_ItIaoBAY8xVct7h5p`NfPgvp_;;T4WQpOdUHNNd9MnpfuA80SF25d z{Hi;eFqYJccE4zT;kv-)-}v*#Oz0cpm+wHL?fx7QIOOT(@yy+J<=YNR! zUn0LngEm~%MOpZEb@d#)C@VC#j`5rWgf`TajFdT>T5++?_s>uU)L;=fQ60brwfg_Gj$J zUPD?~J)1r-gDRBv9o#I%CC-)R}bG^*fy*g`LVD3 znsUXw=}sc&{1C2OEoz@n=HV>_5Z`d;cfdNH@QU1j^#lG}rwk7C4|CM`o`3rv0_wJC z_dn8NX*1Yg?kK7X1oRIn)zVkzoc4QptKxSB$v>nNbt29zM&oX6!GBCb8gzmGnjAL@ z{>PZAZT3I9_jZ-PoS1kE)H5F_5YPlP5D?FwRkGM=@I<(I^v0Yn2~eniMl{ok7@2t0 zEAao3ignEFs)>Sq)PFbN+x4;h;UNFn(Vtk}$Ng7(+DHFa!0u=JD=7E#{S^}X<^Bps z{dRu^^#R$xLdk%}UjcaVEBwE9@F!Xi%K!bUdk_a?3@I^S7(MZNkm|1vcL)dMC;A`V zR}8pB%^^6Vf2?PmE+Wu>^K5nqKtSZb$-n>mX$pwJ`UAejLQSmt5BR@3uYrJw{x9-( z+Z1q0_y>G7g#FhW%rFiJFT)=l&oKEPPyZ?||Cg~0>u(_YU&GGdhD-c^3@?XC{}}$a z7zhZ6 z|KpH<4+HC8KqQ^SkWunKp_f=YiUWeAn>aa&|M&dz_ql*>;(jT1;*23qBF`AyU%kv2 z4#?~QM#~iY zzdhLfjv|478T&aU_D{(D@$g^L_kY8z%k|Gtg#%G+x*y|2ZoJE~6^c z9)%o@VkJ?eZ>?Aa?|P}TsgvO&?zunwqLdGfXM&@{w&L5j&`(`4BT?%)v870qa32gdAf zpgWCFG>UHlYt-E(IN9J7Bsft@OBBU<+khcr3(iNdGSdyHzy*lqQ53T5n(TYgkga_e GNE85|cjx{9 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b0f507e7..d4dbf3d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Mar 09 02:47:32 CET 2015 +#Mon Dec 21 19:04:15 CET 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip diff --git a/gradlew b/gradlew index 91a7e269..9d82f789 100755 --- a/gradlew +++ b/gradlew @@ -42,11 +42,6 @@ case "`uname`" in ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do fi done SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- +cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" -cd "$SAVED" >&- +cd "$SAVED" >/dev/null CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -114,6 +109,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` From 9fc04bacb07e20eededf78ee5554e409b3c70472 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 30 Dec 2015 16:30:54 +0100 Subject: [PATCH 266/314] Update to 1.8.9. Remove SBC support. --- gradle.properties | 10 ++--- .../handler/client/ChatEventHandler.java | 37 ------------------- .../schematica/proxy/ClientProxy.java | 4 -- .../lunatrius/schematica/reference/Names.java | 6 --- 4 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java diff --git a/gradle.properties b/gradle.properties index b3552cbe..af9b29ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=7 -version_minecraft=1.8.8 -version_forge=11.15.0.1636-1.8.8 -version_minforge=11.15.0.1636 -version_mappings=snapshot_20151219 -version_lunatriuscore=1.1.2.31 +version_minecraft=1.8.9 +version_forge=11.15.0.1661 +version_minforge=11.15.0.1656 +version_mappings=snapshot_20151230 +version_lunatriuscore=1.1.2.32 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java deleted file mode 100644 index 0e56db10..00000000 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/ChatEventHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.github.lunatrius.schematica.handler.client; - -import com.github.lunatrius.schematica.Schematica; -import com.github.lunatrius.schematica.client.printer.SchematicPrinter; -import com.github.lunatrius.schematica.reference.Names; -import com.github.lunatrius.schematica.reference.Reference; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -public class ChatEventHandler { - public static final ChatEventHandler INSTANCE = new ChatEventHandler(); - - public int chatLines = 0; - - private ChatEventHandler() {} - - @SubscribeEvent - public void onClientChatReceivedEvent(final ClientChatReceivedEvent event) { - if (this.chatLines < 20) { - this.chatLines++; - final String message = event.message.getFormattedText(); - Reference.logger.debug("Message #{}: {}", this.chatLines, message); - if (message.contains(Names.SBC.DISABLE_PRINTER)) { - Reference.logger.info("Printer is disabled on this server."); - SchematicPrinter.INSTANCE.setEnabled(false); - } - if (message.contains(Names.SBC.DISABLE_SAVE)) { - Reference.logger.info("Saving is disabled on this server."); - Schematica.proxy.isSaveEnabled = false; - } - if (message.contains(Names.SBC.DISABLE_LOAD)) { - Reference.logger.info("Loading is disabled on this server."); - Schematica.proxy.isLoadEnabled = false; - } - } - } -} diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index fff7b936..859572f1 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -8,7 +8,6 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.command.client.CommandSchematicaReplace; import com.github.lunatrius.schematica.handler.ConfigurationHandler; -import com.github.lunatrius.schematica.handler.client.ChatEventHandler; import com.github.lunatrius.schematica.handler.client.GuiHandler; import com.github.lunatrius.schematica.handler.client.InputHandler; import com.github.lunatrius.schematica.handler.client.OverlayHandler; @@ -181,7 +180,6 @@ public void init(final FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(RenderTickHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(ConfigurationHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(RenderSchematic.INSTANCE); - MinecraftForge.EVENT_BUS.register(ChatEventHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(GuiHandler.INSTANCE); MinecraftForge.EVENT_BUS.register(new OverlayHandler()); MinecraftForge.EVENT_BUS.register(new WorldHandler()); @@ -211,8 +209,6 @@ public File getDataDirectory() { public void resetSettings() { super.resetSettings(); - ChatEventHandler.INSTANCE.chatLines = 0; - SchematicPrinter.INSTANCE.setEnabled(true); unloadSchematic(); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index e52525ee..7a18064a 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -223,10 +223,4 @@ public static final class NBT { public static final String ENTITIES = "Entities"; public static final String EXTENDED_METADATA = "ExtendedMetadata"; } - - public static final class SBC { - public static final String DISABLE_PRINTER = "\u00a70\u00a72\u00a70\u00a70\u00a7e\u00a7f"; - public static final String DISABLE_SAVE = "\u00a70\u00a72\u00a71\u00a70\u00a7e\u00a7f"; - public static final String DISABLE_LOAD = "\u00a70\u00a72\u00a71\u00a71\u00a7e\u00a7f"; - } } From 61ef75ed870c0ba7bd2050cb1c10ccb99e00d885 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 30 Dec 2015 16:55:30 +0100 Subject: [PATCH 267/314] Fix a file name in the README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 503d6607..3a8cf804 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ This section assumes that you're using the command-line version of Git. #### Compile Schematica 1. Execute `gradlew setupDevWorkspace`. This sets up Forge and downloads the necessary libraries to build Schematica. This might take some time, be patient. - * You will generally only have to do this once until the Forge version in `build.properties` changes. + * You will generally only have to do this once until the Forge version in `gradle.properties` changes. 2. Execute `gradlew build`. If you did everything right, `BUILD SUCCESSFUL` will be displayed after it finishes. This should be relatively quick. * If you see `BUILD FAILED`, check the error output (it should be right around `BUILD FAILED`), fix everything (if possible), and try again. 3. Go to `mcdev\Schematica\build\libs`. From 9dab0893f8e646d956481606df30b2f7de52ab58 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 18 Jan 2016 19:48:22 +0100 Subject: [PATCH 268/314] Minor tweaks to rendering code. --- .../chunk/OverlayRenderDispatcher.java | 27 +++---------- .../SchematicChunkRenderContainerList.java | 2 +- .../SchematicChunkRenderContainerVbo.java | 40 +++++++++++++------ 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java index a429bba2..ecc8ad7f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java @@ -3,7 +3,6 @@ import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlayList; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListenableFutureTask; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.WorldRenderer; @@ -15,27 +14,13 @@ public class OverlayRenderDispatcher extends ChunkRenderDispatcher { @Override public ListenableFuture uploadChunk(final EnumWorldBlockLayer layer, final WorldRenderer worldRenderer, final RenderChunk renderChunk, final CompiledChunk compiledChunk) { - if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { - if (OpenGlHelper.useVbo()) { - uploadVertexBuffer(worldRenderer, renderChunk.getVertexBufferByLayer(layer.ordinal())); - } else { - uploadDisplayList(worldRenderer, ((RenderOverlayList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); - } + if (!Minecraft.getMinecraft().isCallingFromMinecraftThread() || OpenGlHelper.useVbo()) { + return super.uploadChunk(layer, worldRenderer, renderChunk, compiledChunk); + } - worldRenderer.setTranslation(0.0, 0.0, 0.0); - return Futures.immediateFuture(null); - } else { - final ListenableFutureTask listenableFutureTask = ListenableFutureTask.create(new Runnable() { - @Override - public void run() { - uploadChunk(layer, worldRenderer, renderChunk, compiledChunk); - } - }, null); + uploadDisplayList(worldRenderer, ((RenderOverlayList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); - synchronized (this.queueChunkUploads) { - this.queueChunkUploads.add(listenableFutureTask); - return listenableFutureTask; - } - } + worldRenderer.setTranslation(0.0, 0.0, 0.0); + return Futures.immediateFuture(null); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java index b63e29cc..d2b64b1a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java @@ -12,7 +12,7 @@ public class SchematicChunkRenderContainerList extends SchematicChunkRenderConta @Override public void renderChunkLayer(final EnumWorldBlockLayer layer) { if (this.initialized) { - for (final RenderChunk renderchunk : (Iterable) this.renderChunks) { + for (final RenderChunk renderchunk : this.renderChunks) { final ListedRenderChunk listedRenderChunk = (ListedRenderChunk) renderchunk; GlStateManager.pushMatrix(); preRenderChunk(renderchunk); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java index dae0b9b9..39ea99f5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java @@ -15,16 +15,10 @@ public class SchematicChunkRenderContainerVbo extends SchematicChunkRenderContainer { @Override public void renderChunkLayer(final EnumWorldBlockLayer layer) { - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); - OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + preRenderChunk(); if (this.initialized) { - for (final RenderChunk renderChunk : (Iterable) this.renderChunks) { + for (final RenderChunk renderChunk : this.renderChunks) { final VertexBuffer vertexbuffer = renderChunk.getVertexBufferByLayer(layer.ordinal()); GlStateManager.pushMatrix(); preRenderChunk(renderChunk); @@ -40,6 +34,20 @@ public void renderChunkLayer(final EnumWorldBlockLayer layer) { this.renderChunks.clear(); } + postRenderChunk(); + } + + private void preRenderChunk() { + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + } + + private void postRenderChunk() { final List elements = DefaultVertexFormats.BLOCK.getElements(); for (final VertexFormatElement element : elements) { @@ -77,8 +85,7 @@ private void setupArrayPointers() { @Override public void renderOverlay() { if (this.initialized) { - GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); - GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + preRenderOverlay(); for (final RenderOverlay renderOverlay : this.renderOverlays) { final VertexBuffer vertexBuffer = renderOverlay.getVertexBufferByLayer(EnumWorldBlockLayer.TRANSLUCENT.ordinal()); @@ -95,11 +102,20 @@ public void renderOverlay() { GlStateManager.resetColor(); this.renderOverlays.clear(); - GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); - GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + postRenderOverlay(); } } + private void preRenderOverlay() { + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + } + + private void postRenderOverlay() { + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + } + private void setupArrayPointersOverlay() { GL11.glVertexPointer(3, GL11.GL_FLOAT, 16, 0); GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 16, 12); From 5d0a1beffee22cba155280ad0e1d61a117a72e21 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 30 Jan 2016 14:33:02 +0100 Subject: [PATCH 269/314] Compute the air block highlight based on the real world blocks. Fixes #109 --- .../renderer/chunk/overlay/RenderOverlay.java | 55 +++++++++++-------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index d2505621..a0559e64 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -100,8 +100,9 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun if (!isMcAirBlock) { if (isSchAirBlock && ConfigurationHandler.highlightAir) { render = true; - sides = GeometryMasks.Quad.ALL; color = 0xBF00BF; + + sides = getSides(mcBlock, mcWorld, mcPos, sides); } } @@ -122,29 +123,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } if (render) { - if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) { - sides |= GeometryMasks.Quad.DOWN; - } - - if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.UP), EnumFacing.UP)) { - sides |= GeometryMasks.Quad.UP; - } - - if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) { - sides |= GeometryMasks.Quad.NORTH; - } - - if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { - sides |= GeometryMasks.Quad.SOUTH; - } - - if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) { - sides |= GeometryMasks.Quad.WEST; - } - - if (schBlock.shouldSideBeRendered(schematic, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) { - sides |= GeometryMasks.Quad.EAST; - } + sides = getSides(schBlock, schematic, pos, sides); } } @@ -167,6 +146,34 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun compiledOverlay.setVisibility(visgraph.computeVisibility()); } + private int getSides(final Block block, final World world, final BlockPos pos, int sides) { + if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) { + sides |= GeometryMasks.Quad.DOWN; + } + + if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.UP), EnumFacing.UP)) { + sides |= GeometryMasks.Quad.UP; + } + + if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) { + sides |= GeometryMasks.Quad.NORTH; + } + + if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { + sides |= GeometryMasks.Quad.SOUTH; + } + + if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) { + sides |= GeometryMasks.Quad.WEST; + } + + if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) { + sides |= GeometryMasks.Quad.EAST; + } + + return sides; + } + @Override public void preRenderBlocks(final WorldRenderer worldRenderer, final BlockPos pos) { worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); From f035d8a91bd8e761039e2f39924ebdef6c854096 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 28 Feb 2016 14:46:25 +0100 Subject: [PATCH 270/314] License year update. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 04f0f698..09cda891 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2015 Jadran "Lunatrius" Kotnik +Copyright (c) 2014-2016 Jadran "Lunatrius" Kotnik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From cc430773f17adad42676cb20e72307996e76a0a7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 26 Mar 2016 20:51:23 +0100 Subject: [PATCH 271/314] Update to 1.9. --- gradle.properties | 10 +- .../lunatrius/schematica/api/ISchematic.java | 2 +- .../api/event/DuplicateMappingException.java | 2 +- .../api/event/PostSchematicCaptureEvent.java | 2 +- .../api/event/PreSchematicSaveEvent.java | 8 +- .../block/state/BlockStateHelper.java | 8 +- .../state/pattern/BlockStateReplacer.java | 10 +- .../gui/control/GuiSchematicControl.java | 2 +- .../client/gui/save/GuiSchematicSave.java | 2 +- .../client/printer/SchematicPrinter.java | 50 +++-- .../client/printer/nbtsync/NBTSync.java | 2 +- .../printer/nbtsync/NBTSyncCommandBlock.java | 16 +- .../client/printer/nbtsync/NBTSyncSign.java | 12 +- .../printer/registry/IValidPlayerFacing.java | 2 +- .../printer/registry/PlacementData.java | 2 +- .../printer/registry/PlacementRegistry.java | 14 +- .../client/renderer/RenderSchematic.java | 196 ++++++++++++------ .../client/renderer/SchematicRenderCache.java | 2 +- .../client/renderer/ViewFrustumOverlay.java | 10 +- .../renderer/chunk/CompiledOverlay.java | 18 +- .../chunk/OverlayRenderDispatcher.java | 12 +- .../SchematicChunkRenderContainerList.java | 12 +- .../SchematicChunkRenderContainerVbo.java | 6 +- .../overlay/ISchematicRenderChunkFactory.java | 2 +- .../renderer/chunk/overlay/RenderOverlay.java | 43 ++-- .../chunk/overlay/RenderOverlayList.java | 6 +- .../chunk/proxy/SchematicRenderChunkList.java | 2 +- .../chunk/proxy/SchematicRenderChunkVbo.java | 2 +- .../schematica/client/util/BlockList.java | 12 +- .../client/util/BlockStateToItemStack.java | 9 +- .../schematica/client/util/FlipHelper.java | 8 +- .../client/util/RotationHelper.java | 8 +- .../client/world/SchematicWorld.java | 30 ++- .../world/chunk/ChunkProviderSchematic.java | 79 ++----- .../client/world/chunk/ChunkSchematic.java | 2 +- .../command/CommandSchematicaBase.java | 22 +- .../command/CommandSchematicaDownload.java | 11 +- .../command/CommandSchematicaList.java | 44 ++-- .../command/CommandSchematicaRemove.java | 43 ++-- .../command/CommandSchematicaSave.java | 17 +- .../client/CommandSchematicaReplace.java | 15 +- .../handler/ConfigurationHandler.java | 2 +- .../schematica/handler/QueueTickHandler.java | 6 +- .../schematica/handler/client/GuiHandler.java | 4 +- .../handler/client/InputHandler.java | 18 +- .../handler/client/OverlayHandler.java | 29 +-- .../handler/client/RenderTickHandler.java | 14 +- .../handler/client/WorldHandler.java | 20 +- .../lunatrius/schematica/nbt/NBTHelper.java | 5 +- .../network/message/MessageDownloadChunk.java | 2 +- .../network/message/MessageDownloadEnd.java | 4 +- .../schematica/proxy/ClientProxy.java | 9 +- .../schematica/proxy/CommonProxy.java | 8 +- .../schematica/proxy/ServerProxy.java | 7 +- .../schematica/world/WorldDummy.java | 4 +- .../world/WorldProviderSchematic.java | 11 +- .../world/schematic/SchematicAlpha.java | 4 +- .../world/schematic/SchematicFormat.java | 4 +- .../world/storage/SaveHandlerSchematic.java | 3 +- .../schematica/world/storage/Schematic.java | 2 +- src/main/resources/META-INF/schematica_at.cfg | 10 +- 61 files changed, 479 insertions(+), 442 deletions(-) diff --git a/gradle.properties b/gradle.properties index af9b29ca..e2206dea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=7 -version_minecraft=1.8.9 -version_forge=11.15.0.1661 -version_minforge=11.15.0.1656 -version_mappings=snapshot_20151230 -version_lunatriuscore=1.1.2.32 +version_minecraft=1.9 +version_forge=12.16.0.1811-1.9 +version_minforge=12.16.0.1766 +version_mappings=snapshot_20160326 +version_lunatriuscore=1.1.2.33 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java index 28716fb3..2175c24a 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -4,7 +4,7 @@ import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import java.util.List; diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java b/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java index a2791d0f..213589f6 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/DuplicateMappingException.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.api.event; public class DuplicateMappingException extends Exception { - public DuplicateMappingException(String s) { + public DuplicateMappingException(final String s) { super(s); } } diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java index afcb8a55..d923a45c 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PostSchematicCaptureEvent.java @@ -14,7 +14,7 @@ public class PostSchematicCaptureEvent extends Event { */ public final ISchematic schematic; - public PostSchematicCaptureEvent(ISchematic schematic) { + public PostSchematicCaptureEvent(final ISchematic schematic) { this.schematic = schematic; } } diff --git a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java index ab3880d5..00702c6b 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java +++ b/src/api/java/com/github/lunatrius/schematica/api/event/PreSchematicSaveEvent.java @@ -25,11 +25,11 @@ public class PreSchematicSaveEvent extends Event { public final NBTTagCompound extendedMetadata; @Deprecated - public PreSchematicSaveEvent(Map mappings) { + public PreSchematicSaveEvent(final Map mappings) { this(null, mappings); } - public PreSchematicSaveEvent(ISchematic schematic, Map mappings) { + public PreSchematicSaveEvent(final ISchematic schematic, final Map mappings) { this.schematic = schematic; this.mappings = mappings; this.extendedMetadata = new NBTTagCompound(); @@ -47,7 +47,7 @@ public PreSchematicSaveEvent(ISchematic schematic, Map mappings) * @return true if a mapping was replaced. * @throws DuplicateMappingException */ - public boolean replaceMapping(String oldName, String newName) throws DuplicateMappingException { + public boolean replaceMapping(final String oldName, final String newName) throws DuplicateMappingException { if (this.mappings.containsKey(newName)) { throw new DuplicateMappingException( String.format( @@ -57,7 +57,7 @@ public boolean replaceMapping(String oldName, String newName) throws DuplicateMa ); } - Short id = this.mappings.get(oldName); + final Short id = this.mappings.get(oldName); if (id != null) { this.mappings.remove(oldName); this.mappings.put(newName, id); diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java index 8d4ec8fe..6711bcf0 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import java.util.ArrayList; import java.util.List; @@ -34,15 +34,15 @@ public static > T getPropertyValue(final IBlockState blo public static List getFormattedProperties(final IBlockState blockState) { final List list = new ArrayList(); - for (final Map.Entry entry : blockState.getProperties().entrySet()) { + for (final Map.Entry, Comparable> entry : blockState.getProperties().entrySet()) { final IProperty key = entry.getKey(); final Comparable value = entry.getValue(); String formattedValue = value.toString(); if (Boolean.TRUE.equals(value)) { - formattedValue = EnumChatFormatting.GREEN + formattedValue + EnumChatFormatting.RESET; + formattedValue = TextFormatting.GREEN + formattedValue + TextFormatting.RESET; } else if (Boolean.FALSE.equals(value)) { - formattedValue = EnumChatFormatting.RED + formattedValue + EnumChatFormatting.RESET; + formattedValue = TextFormatting.RED + formattedValue + TextFormatting.RESET; } list.add(key.getName() + ": " + formattedValue); diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java index 6f2324c6..48c6cb9b 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java @@ -6,7 +6,7 @@ import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; -import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; @@ -34,8 +34,8 @@ public IBlockState getReplacement(final IBlockState original, final Map properties) { - for (final Map.Entry entry : properties.entrySet()) { + private IBlockState applyProperties(IBlockState blockState, final Map properties) { + for (final Map.Entry entry : properties.entrySet()) { try { blockState = blockState.withProperty(entry.getKey(), entry.getValue()); } catch (final IllegalArgumentException ignored) { @@ -50,8 +50,8 @@ public static BlockStateReplacer forBlockState(final IBlockState replacement) { } @SuppressWarnings({ "rawtypes", "unchecked" }) - public static BlockStateHelper getMatcher(final BlockStateInfo blockStateInfo) { - final BlockStateHelper matcher = BlockStateHelper.forBlock(blockStateInfo.block); + public static BlockStateMatcher getMatcher(final BlockStateInfo blockStateInfo) { + final BlockStateMatcher matcher = BlockStateMatcher.forBlock(blockStateInfo.block); for (final Map.Entry entry : blockStateInfo.stateData.entrySet()) { matcher.where(entry.getKey(), new Predicate() { @Override diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index 49159b91..2e7b8637 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -14,8 +14,8 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.config.GuiUnicodeGlyphButton; import java.io.IOException; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index f290fcb9..4bc1b13f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -12,7 +12,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import java.io.File; import java.io.IOException; diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 53ef07a1..19ce9afe 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.printer; -import com.github.lunatrius.core.util.BlockPosHelper; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.BlockPosHelper; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.printer.nbtsync.NBTSync; import com.github.lunatrius.schematica.client.printer.nbtsync.SyncRegistry; @@ -19,13 +19,16 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.C0BPacketEntityAction; -import net.minecraft.util.BlockPos; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; @@ -209,7 +212,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, return false; } - final ItemStack itemStack = BlockStateToItemStack.getItemStack(blockState, new MovingObjectPosition(player), this.schematic, pos); + final ItemStack itemStack = BlockStateToItemStack.getItemStack(blockState, new RayTraceResult(player), this.schematic, pos, player); if (itemStack == null || itemStack.getItem() == null) { Reference.logger.debug("{} is missing a mapping!", blockState); return false; @@ -236,7 +239,7 @@ private boolean isSolid(final World world, final BlockPos pos, final EnumFacing return false; } - if (block.isAir(world, offset)) { + if (block.isAir(blockState, world, offset)) { return false; } @@ -316,7 +319,8 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, } private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos pos, final EnumFacing direction, final float offsetX, final float offsetY, final float offsetZ, final int extraClicks) { - final ItemStack itemStack = player.getCurrentEquippedItem(); + final EnumHand hand = EnumHand.MAIN_HAND; + final ItemStack itemStack = player.getHeldItem(hand); boolean success = false; if (!this.minecraft.playerController.isInCreativeMode() && itemStack != null && itemStack.stackSize <= extraClicks) { @@ -325,11 +329,11 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final BlockPos offset = pos.offset(direction); final EnumFacing side = direction.getOpposite(); - final Vec3 hitVec = new Vec3(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ); + final Vec3d hitVec = new Vec3d(offset.getX() + offsetX, offset.getY() + offsetY, offset.getZ() + offsetZ); - success = placeBlock(world, player, itemStack, offset, side, hitVec); + success = placeBlock(world, player, itemStack, offset, side, hitVec, hand); for (int i = 0; success && i < extraClicks; i++) { - success = placeBlock(world, player, itemStack, offset, side, hitVec); + success = placeBlock(world, player, itemStack, offset, side, hitVec, hand); } if (itemStack != null && itemStack.stackSize == 0 && success) { @@ -339,21 +343,23 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, return success; } - private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack, final BlockPos pos, final EnumFacing side, final Vec3 hitVec) { - boolean success = !ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, pos, side).isCanceled(); - if (success) { - success = this.minecraft.playerController.onPlayerRightClick(player, world, itemStack, pos, side, hitVec); - if (success) { - player.swingItem(); - } + private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack, final BlockPos pos, final EnumFacing side, final Vec3d hitVec, final EnumHand hand) { + if (ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, pos, side, hitVec).isCanceled()) { + return false; } - return success; + final EnumActionResult result = this.minecraft.playerController.processRightClickBlock(player, world, itemStack, pos, side, hitVec, hand); + if ((result != EnumActionResult.SUCCESS)) { + return false; + } + + player.swingArm(hand); + return true; } private void syncSneaking(final EntityPlayerSP player, final boolean isSneaking) { player.setSneaking(isSneaking); - player.sendQueue.addToSendQueue(new C0BPacketEntityAction(player, isSneaking ? C0BPacketEntityAction.Action.START_SNEAKING : C0BPacketEntityAction.Action.STOP_SNEAKING)); + player.sendQueue.addToSendQueue(new CPacketEntityAction(player, isSneaking ? CPacketEntityAction.Action.START_SNEAKING : CPacketEntityAction.Action.STOP_SNEAKING)); } private boolean swapToItem(final InventoryPlayer inventory, final ItemStack itemStack) { @@ -409,6 +415,6 @@ private int getNextSlot() { } private boolean swapSlots(final int from, final int to) { - return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, from, to, 2, this.minecraft.thePlayer) == null; + return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, from, to, ClickType.SWAP, this.minecraft.thePlayer) == null; } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java index 5d0cd322..22a334eb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java @@ -5,7 +5,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public abstract class NBTSync { diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java index 01527821..813b8028 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncCommandBlock.java @@ -1,13 +1,13 @@ package com.github.lunatrius.schematica.client.printer.nbtsync; import io.netty.buffer.Unpooled; -import net.minecraft.command.server.CommandBlockLogic; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.PacketBuffer; -import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.network.play.client.CPacketCustomPayload; +import net.minecraft.tileentity.CommandBlockBaseLogic; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityCommandBlock; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class NBTSyncCommandBlock extends NBTSync { @@ -17,18 +17,18 @@ public boolean execute(final EntityPlayer player, final World schematic, final B final TileEntity mcTileEntity = mcWorld.getTileEntity(mcPos); if (tileEntity instanceof TileEntityCommandBlock && mcTileEntity instanceof TileEntityCommandBlock) { - final CommandBlockLogic commandBlockLogic = ((TileEntityCommandBlock) tileEntity).getCommandBlockLogic(); - final CommandBlockLogic mcCommandBlockLogic = ((TileEntityCommandBlock) mcTileEntity).getCommandBlockLogic(); + final CommandBlockBaseLogic commandBlockLogic = ((TileEntityCommandBlock) tileEntity).getCommandBlockLogic(); + final CommandBlockBaseLogic mcCommandBlockLogic = ((TileEntityCommandBlock) mcTileEntity).getCommandBlockLogic(); if (!commandBlockLogic.getCommand().equals(mcCommandBlockLogic.getCommand())) { final PacketBuffer packetBuffer = new PacketBuffer(Unpooled.buffer()); - packetBuffer.writeByte(mcCommandBlockLogic.func_145751_f()); - mcCommandBlockLogic.func_145757_a(packetBuffer); + packetBuffer.writeByte(mcCommandBlockLogic.getCommandBlockType()); + mcCommandBlockLogic.fillInInfo(packetBuffer); packetBuffer.writeString(commandBlockLogic.getCommand()); packetBuffer.writeBoolean(mcCommandBlockLogic.shouldTrackOutput()); - return sendPacket(new C17PacketCustomPayload("MC|AdvCdm", packetBuffer)); + return sendPacket(new CPacketCustomPayload("MC|AdvCdm", packetBuffer)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java index 16817048..186ec56a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSyncSign.java @@ -1,11 +1,11 @@ package com.github.lunatrius.schematica.client.printer.nbtsync; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.play.client.C12PacketUpdateSign; +import net.minecraft.network.play.client.CPacketUpdateSign; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntitySign; -import net.minecraft.util.BlockPos; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import java.util.Arrays; @@ -17,11 +17,11 @@ public boolean execute(final EntityPlayer player, final World schematic, final B final TileEntity mcTileEntity = mcWorld.getTileEntity(mcPos); if (tileEntity instanceof TileEntitySign && mcTileEntity instanceof TileEntitySign) { - final IChatComponent[] signText = ((TileEntitySign) tileEntity).signText; - final IChatComponent[] mcSignText = ((TileEntitySign) mcTileEntity).signText; + final ITextComponent[] signText = ((TileEntitySign) tileEntity).signText; + final ITextComponent[] mcSignText = ((TileEntitySign) mcTileEntity).signText; if (!Arrays.equals(signText, mcSignText)) { - return sendPacket(new C12PacketUpdateSign(mcPos, signText)); + return sendPacket(new CPacketUpdateSign(mcPos, signText)); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java index 2c938abd..e094cb07 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/IValidPlayerFacing.java @@ -2,7 +2,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IValidPlayerFacing { diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java index 7bcc7b80..59afa8cf 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementData.java @@ -2,8 +2,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.ArrayList; diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 77ca659e..44717fda 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -28,9 +28,9 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import java.util.ArrayList; @@ -54,28 +54,28 @@ private void populateMappings() { final IValidPlayerFacing playerFacingEntity = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); return facing == player.getHorizontalFacing(); } }; final IValidPlayerFacing playerFacingEntityOpposite = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); return facing == player.getHorizontalFacing().getOpposite(); } }; final IValidPlayerFacing playerFacingPiston = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == BlockPistonBase.getFacingFromEntity(world, pos, player); + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == BlockPistonBase.getFacingFromEntity(pos, player); } }; final IValidPlayerFacing playerFacingRotateY = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); return facing == player.getHorizontalFacing().rotateY(); } }; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 2457d823..7d66b170 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -2,7 +2,7 @@ import com.github.lunatrius.core.client.renderer.GeometryMasks; import com.github.lunatrius.core.client.renderer.GeometryTessellator; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.client.renderer.chunk.OverlayRenderDispatcher; import com.github.lunatrius.schematica.client.renderer.chunk.container.SchematicChunkRenderContainer; @@ -19,6 +19,7 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; @@ -27,7 +28,7 @@ import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; @@ -42,12 +43,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -57,6 +60,7 @@ import org.lwjgl.opengl.GL20; import org.lwjgl.util.vector.Vector3f; +import java.util.Collection; import java.util.EnumSet; import java.util.Iterator; import java.util.LinkedList; @@ -83,7 +87,7 @@ public class RenderSchematic extends RenderGlobal { private Set chunksToUpdate = Sets.newLinkedHashSet(); private Set overlaysToUpdate = Sets.newLinkedHashSet(); private List renderInfos = Lists.newArrayListWithCapacity(CHUNKS); - private ViewFrustumOverlay viewFrustum; + private ViewFrustumOverlay viewFrustum = null; private double frustumUpdatePosX = Double.MIN_VALUE; private double frustumUpdatePosY = Double.MIN_VALUE; private double frustumUpdatePosZ = Double.MIN_VALUE; @@ -95,8 +99,8 @@ public class RenderSchematic extends RenderGlobal { private double lastViewEntityZ = Double.MIN_VALUE; private double lastViewEntityPitch = Double.MIN_VALUE; private double lastViewEntityYaw = Double.MIN_VALUE; - private final ChunkRenderDispatcher renderDispatcher = new ChunkRenderDispatcher(); - private final OverlayRenderDispatcher renderDispatcherOverlay = new OverlayRenderDispatcher(); + private ChunkRenderDispatcher renderDispatcher = null; + private OverlayRenderDispatcher renderDispatcherOverlay = null; private SchematicChunkRenderContainer renderContainer; private int renderDistanceChunks = -1; private int countEntitiesTotal; @@ -116,8 +120,8 @@ public RenderSchematic(final Minecraft minecraft) { this.mc = minecraft; this.profiler = minecraft.mcProfiler; this.renderManager = minecraft.getRenderManager(); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GlStateManager.bindTexture(0); this.vboEnabled = OpenGlHelper.useVbo(); @@ -183,7 +187,7 @@ public void setWorldAndLoadRenderers(final WorldClient worldClient) { public void setWorldAndLoadRenderers(final SchematicWorld world) { if (this.world != null) { - this.world.removeWorldAccess(this); + this.world.removeEventListener(this); } this.frustumUpdatePosX = Double.MIN_VALUE; @@ -196,8 +200,30 @@ public void setWorldAndLoadRenderers(final SchematicWorld world) { this.world = world; if (world != null) { - world.addWorldAccess(this); + world.addEventListener(this); loadRenderers(); + } else { + this.chunksToUpdate.clear(); + this.overlaysToUpdate.clear(); + this.renderInfos.clear(); + + if (this.viewFrustum != null) { + this.viewFrustum.deleteGlResources(); + } + + this.viewFrustum = null; + + if (this.renderDispatcher != null) { + this.renderDispatcher.stopWorkerThreads(); + } + + this.renderDispatcher = null; + + if (this.renderDispatcherOverlay != null) { + this.renderDispatcherOverlay.stopWorkerThreads(); + } + + this.renderDispatcherOverlay = null; } } @@ -206,14 +232,14 @@ public void onRenderWorldLast(final RenderWorldLastEvent event) { final EntityPlayerSP player = this.mc.thePlayer; if (player != null) { this.profiler.startSection("schematica"); - ClientProxy.setPlayerData(player, event.partialTicks); + ClientProxy.setPlayerData(player, event.getPartialTicks()); final SchematicWorld schematic = ClientProxy.schematic; final boolean isRenderingSchematic = schematic != null && schematic.isRendering; this.profiler.startSection("schematic"); if (isRenderingSchematic) { GlStateManager.pushMatrix(); - renderSchematic(schematic, event.partialTicks); + renderSchematic(schematic, event.getPartialTicks()); GlStateManager.popMatrix(); } @@ -317,10 +343,10 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - renderBlockLayer(EnumWorldBlockLayer.SOLID, partialTicks, PASS, entity); - renderBlockLayer(EnumWorldBlockLayer.CUTOUT_MIPPED, partialTicks, PASS, entity); + renderBlockLayer(BlockRenderLayer.SOLID, partialTicks, PASS, entity); + renderBlockLayer(BlockRenderLayer.CUTOUT_MIPPED, partialTicks, PASS, entity); this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); - renderBlockLayer(EnumWorldBlockLayer.CUTOUT, partialTicks, PASS, entity); + renderBlockLayer(BlockRenderLayer.CUTOUT, partialTicks, PASS, entity); this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); GlStateManager.disableBlend(); GlStateManager.shadeModel(GL11.GL_FLAT); @@ -350,7 +376,7 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { this.profiler.endStartSection("translucent"); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, partialTicks, PASS, entity); + renderBlockLayer(BlockRenderLayer.TRANSLUCENT, partialTicks, PASS, entity); GlStateManager.disableBlend(); GlStateManager.popMatrix(); GlStateManager.depthMask(true); @@ -376,6 +402,14 @@ public void refresh() { @Override public void loadRenderers() { if (this.world != null) { + if (this.renderDispatcher == null) { + this.renderDispatcher = new ChunkRenderDispatcher(); + } + + if (this.renderDispatcherOverlay == null) { + this.renderDispatcherOverlay = new OverlayRenderDispatcher(); + } + this.displayListEntitiesDirty = true; this.renderDistanceChunks = ConfigurationHandler.renderDistance; final boolean vbo = this.vboEnabled; @@ -409,7 +443,7 @@ protected void stopChunkUpdates() { } @Override - public void createBindEntityOutlineFbs(final int p_72720_1_, final int p_72720_2_) {} + public void createBindEntityOutlineFbs(final int width, final int height) {} @Override public void renderEntities(final Entity renderViewEntity, final ICamera camera, final float partialTicks) { @@ -443,6 +477,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, this.profiler.endStartSection("blockentities"); RenderHelper.enableStandardItemLighting(); + TileEntityRendererDispatcher.instance.preDrawBatch(); for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { for (final TileEntity tileEntity : renderInfo.renderChunk.getCompiledChunk().getTileEntities()) { final AxisAlignedBB renderBB = tileEntity.getRenderBoundingBox(); @@ -460,6 +495,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, this.countTileEntitiesRendered++; } } + TileEntityRendererDispatcher.instance.drawBatch(entityPass); this.mc.entityRenderer.disableLightmap(); this.profiler.endSection(); @@ -468,6 +504,12 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, @Override public String getDebugInfoRenders() { final int total = this.viewFrustum.renderChunks.length; + final int rendered = getRenderedChunks(); + return String.format("C: %d/%d %sD: %d, %s", rendered, total, this.mc.renderChunksMany ? "(s) " : "", this.renderDistanceChunks, this.renderDispatcher.getDebugInfo()); + } + + @Override + protected int getRenderedChunks() { int rendered = 0; for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { @@ -478,7 +520,7 @@ public String getDebugInfoRenders() { } } - return String.format("C: %d/%d %sD: %d, %s", rendered, total, this.mc.renderChunksMany ? "(s) " : "", this.renderDistanceChunks, this.renderDispatcher.getDebugInfo()); + return rendered; } @Override @@ -524,8 +566,8 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin this.profiler.endStartSection("culling"); final BlockPos posEye = new BlockPos(posX, posY + viewEntity.getEyeHeight(), posZ); - final RenderChunk renderchunk = this.viewFrustum.getRenderChunk(posEye); - final RenderOverlay renderoverlay = this.viewFrustum.getRenderOverlay(posEye); + final RenderChunk renderChunkCurrent = this.viewFrustum.getRenderChunk(posEye); + final RenderOverlay renderOverlayCurrent = this.viewFrustum.getRenderOverlay(posEye); this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || posX != this.lastViewEntityX || posY != this.lastViewEntityY || posZ != this.lastViewEntityZ || viewEntity.rotationPitch != this.lastViewEntityPitch || viewEntity.rotationYaw != this.lastViewEntityYaw; this.lastViewEntityX = posX; @@ -534,6 +576,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin this.lastViewEntityPitch = viewEntity.rotationPitch; this.lastViewEntityYaw = viewEntity.rotationYaw; + this.profiler.endStartSection("update"); if (this.displayListEntitiesDirty) { this.displayListEntitiesDirty = false; this.renderInfos = Lists.newArrayListWithCapacity(CHUNKS); @@ -541,7 +584,7 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final LinkedList renderInfoList = Lists.newLinkedList(); boolean renderChunksMany = this.mc.renderChunksMany; - if (renderchunk == null) { + if (renderChunkCurrent == null) { final int chunkY = posEye.getY() > 0 ? 248 : 8; for (int chunkX = -this.renderDistanceChunks; chunkX <= this.renderDistanceChunks; chunkX++) { @@ -559,10 +602,10 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin } } else { boolean add = false; - final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderchunk, renderoverlay, null, 0); + final ContainerLocalRenderInformation renderInfo = new ContainerLocalRenderInformation(renderChunkCurrent, renderOverlayCurrent, null, 0); final Set visibleSides = getVisibleSides(posEye); - if (!visibleSides.isEmpty() && visibleSides.size() == 1) { + if (visibleSides.size() == 1) { final Vector3f viewVector = getViewVector(viewEntity, partialTicks); final EnumFacing facing = EnumFacing.getFacingFromVector(viewVector.x, viewVector.y, viewVector.z).getOpposite(); visibleSides.remove(facing); @@ -575,26 +618,26 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin if (add && !playerSpectator) { this.renderInfos.add(renderInfo); } else { - if (playerSpectator && this.world.getBlockState(posEye).getBlock().isOpaqueCube()) { + if (playerSpectator && this.world.getBlockState(posEye).isOpaqueCube()) { renderChunksMany = false; } - renderchunk.setFrameIndex(frameCount); - renderoverlay.setFrameIndex(frameCount); + renderChunkCurrent.setFrameIndex(frameCount); + renderOverlayCurrent.setFrameIndex(frameCount); renderInfoList.add(renderInfo); } } + this.profiler.startSection("iteration"); while (!renderInfoList.isEmpty()) { final ContainerLocalRenderInformation renderInfo = renderInfoList.poll(); final RenderChunk renderChunk = renderInfo.renderChunk; final EnumFacing facing = renderInfo.facing; - final BlockPos posChunk = renderChunk.getPosition(); this.renderInfos.add(renderInfo); for (final EnumFacing side : EnumFacing.VALUES) { - final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, posChunk, side); - final RenderOverlay neighborRenderOverlay = getNeighborRenderOverlay(posEye, posChunk, side); + final RenderChunk neighborRenderChunk = getNeighborRenderChunk(posEye, renderChunk, side); + final RenderOverlay neighborRenderOverlay = getNeighborRenderOverlay(posEye, renderChunk, side); if ((!renderChunksMany || !renderInfo.setFacing.contains(side.getOpposite())) && (!renderChunksMany || facing == null || renderChunk.getCompiledChunk().isVisible(facing.getOpposite(), side)) && neighborRenderChunk != null && neighborRenderChunk.setFrameIndex(frameCount) && camera.isBoundingBoxInFrustum(neighborRenderChunk.boundingBox)) { final ContainerLocalRenderInformation renderInfoNext = new ContainerLocalRenderInformation(neighborRenderChunk, neighborRenderOverlay, side, renderInfo.counter + 1); @@ -604,13 +647,14 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin } } } + this.profiler.endSection(); } - this.renderDispatcher.clearChunkUpdates(); - this.renderDispatcherOverlay.clearChunkUpdates(); + this.profiler.endStartSection("rebuild"); final Set set = this.chunksToUpdate; final Set set1 = this.overlaysToUpdate; this.chunksToUpdate = Sets.newLinkedHashSet(); + this.overlaysToUpdate = Sets.newLinkedHashSet(); for (final ContainerLocalRenderInformation renderInfo : this.renderInfos) { final RenderChunk renderChunk = renderInfo.renderChunk; @@ -639,16 +683,16 @@ private Set getVisibleSides(final BlockPos pos) { final BlockPos posChunk = new BlockPos(pos.getX() & ~0xF, pos.getY() & ~0xF, pos.getZ() & ~0xF); for (final BlockPos.MutableBlockPos mutableBlockPos : BlockPos.getAllInBoxMutable(posChunk, posChunk.add(15, 15, 15))) { - if (this.world.getBlockState(mutableBlockPos).getBlock().isOpaqueCube()) { - visgraph.func_178606_a(mutableBlockPos); + if (this.world.getBlockState(mutableBlockPos).isOpaqueCube()) { + visgraph.setOpaqueCube(mutableBlockPos); } } - return visgraph.func_178609_b(pos); + return visgraph.getVisibleFacings(pos); } - private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final BlockPos posChunk, final EnumFacing side) { - final BlockPos offset = posChunk.offset(side, 16); + private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final RenderChunk renderChunkBase, final EnumFacing side) { + final BlockPos offset = renderChunkBase.getBlockPosOffset16(side); if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { return null; } @@ -664,8 +708,8 @@ private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final BlockPos return this.viewFrustum.getRenderChunk(offset); } - private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final BlockPos posChunk, final EnumFacing side) { - final BlockPos offset = posChunk.offset(side, 16); + private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final RenderChunk renderChunkBase, final EnumFacing side) { + final BlockPos offset = renderChunkBase.getBlockPosOffset16(side); if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { return null; } @@ -682,10 +726,15 @@ private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final Bloc } @Override - public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partialTicks, final int pass, final Entity entity) { + protected Vector3f getViewVector(final Entity entity, final double partialTicks) { + return super.getViewVector(entity, partialTicks); + } + + @Override + public int renderBlockLayer(final BlockRenderLayer layer, final double partialTicks, final int pass, final Entity entity) { RenderHelper.disableStandardItemLighting(); - if (layer == EnumWorldBlockLayer.TRANSLUCENT) { + if (layer == BlockRenderLayer.TRANSLUCENT) { this.profiler.startSection("translucent_sort"); final double posX = PLAYER_POSITION_OFFSET.x; final double posY = PLAYER_POSITION_OFFSET.y; @@ -714,7 +763,7 @@ public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partia this.profiler.startSection("filterempty"); int count = 0; - final boolean isTranslucent = layer == EnumWorldBlockLayer.TRANSLUCENT; + final boolean isTranslucent = layer == BlockRenderLayer.TRANSLUCENT; final int start = isTranslucent ? this.renderInfos.size() - 1 : 0; final int end = isTranslucent ? -1 : this.renderInfos.size(); final int step = isTranslucent ? -1 : 1; @@ -742,7 +791,7 @@ public int renderBlockLayer(final EnumWorldBlockLayer layer, final double partia return count; } - private void renderBlockLayer(final EnumWorldBlockLayer layer) { + private void renderBlockLayer(final BlockRenderLayer layer) { this.mc.entityRenderer.enableLightmap(); this.renderContainer.renderChunkLayer(layer); @@ -778,8 +827,13 @@ public void updateChunks(final long finishTimeNano) { break; } - renderChunk.setNeedsUpdate(false); + renderChunk.clearNeedsUpdate(); chunkIterator.remove(); + + final long diff = finishTimeNano - System.nanoTime(); + if (diff < 0L) { + break; + } } this.displayListEntitiesDirty |= this.renderDispatcherOverlay.runChunkUploads(finishTimeNano); @@ -791,8 +845,13 @@ public void updateChunks(final long finishTimeNano) { break; } - renderOverlay.setNeedsUpdate(false); + renderOverlay.clearNeedsUpdate(); overlayIterator.remove(); + + final long diff = finishTimeNano - System.nanoTime(); + if (diff < 0L) { + break; + } } } @@ -800,17 +859,17 @@ public void updateChunks(final long finishTimeNano) { public void renderWorldBorder(final Entity entity, final float partialTicks) {} @Override - public void drawBlockDamageTexture(final Tessellator tessellator, final WorldRenderer worldRenderer, final Entity entity, final float partialTicks) {} + public void drawBlockDamageTexture(final Tessellator tessellator, final VertexBuffer buffer, final Entity entity, final float partialTicks) {} @Override - public void drawSelectionBox(final EntityPlayer player, final MovingObjectPosition movingObjectPosition, final int p_72731_3_, final float partialTicks) {} + public void drawSelectionBox(final EntityPlayer player, final RayTraceResult rayTraceResult, final int execute, final float partialTicks) {} @Override - public void markBlockForUpdate(final BlockPos pos) { + public void notifyBlockUpdate(final World world, final BlockPos pos, final IBlockState oldState, final IBlockState newState, final int flags) { final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); - markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, (flags & 8) != 0); } @Override @@ -818,58 +877,63 @@ public void notifyLightSet(final BlockPos pos) { final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); - markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + markBlocksForUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1, true); } @Override public void markBlockRangeForRenderUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { - markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1); + markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1, true); } - private void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2) { + private void markBlocksForUpdate(final int x1, final int y1, final int z1, final int x2, final int y2, final int z2, final boolean needsUpdate) { if (this.world == null) { return; } final MBlockPos position = this.world.position; - this.viewFrustum.markBlocksForUpdate(x1 - position.x, y1 - position.y, z1 - position.z, x2 - position.x, y2 - position.y, z2 - position.z); + this.viewFrustum.markBlocksForUpdate(x1 - position.x, y1 - position.y, z1 - position.z, x2 - position.x, y2 - position.y, z2 - position.z, needsUpdate); } @Override - public void playRecord(final String name, final BlockPos pos) {} + public void playRecord(final SoundEvent soundEvent, final BlockPos pos) {} @Override - public void playSound(final String name, final double x, final double y, final double z, final float volume, final float pitch) {} + public void playSoundToAllNearExcept(final EntityPlayer player, final SoundEvent soundEvent, final SoundCategory category, final double x, final double y, final double z, final float volume, final float pitch) {} @Override - public void playSoundToNearExcept(final EntityPlayer player, final String name, final double x, final double y, final double z, final float volume, final float pitch) {} + public void spawnParticle(final int particleID, final boolean ignoreRange, final double x, final double y, final double z, final double xOffset, final double yOffset, final double zOffset, final int... parameters) {} @Override - public void spawnParticle(final int p_180442_1_, final boolean p_180442_2_, final double p_180442_3_, final double p_180442_5_, final double p_180442_7_, final double p_180442_9_, final double p_180442_11_, final double p_180442_13_, final int... p_180442_15_) {} + public void onEntityAdded(final Entity entity) {} @Override - public void onEntityAdded(final Entity entityIn) {} - - @Override - public void onEntityRemoved(final Entity entityIn) {} + public void onEntityRemoved(final Entity entity) {} @Override public void deleteAllDisplayLists() {} @Override - public void broadcastSound(final int p_180440_1_, final BlockPos pos, final int p_180440_3_) {} + public void broadcastSound(final int soundID, final BlockPos pos, final int data) {} @Override - public void playAuxSFX(final EntityPlayer player, final int sfxType, final BlockPos blockPosIn, final int p_180439_4_) {} + public void playAuxSFX(final EntityPlayer player, final int sfxType, final BlockPos pos, final int data) {} @Override public void sendBlockBreakProgress(final int breakerId, final BlockPos pos, final int progress) {} + @Override + public boolean hasNoChunkUpdates() { + return this.chunksToUpdate.isEmpty() && this.renderDispatcher.hasChunkUpdates(); + } + @Override public void setDisplayListEntitiesDirty() { this.displayListEntitiesDirty = true; } + @Override + public void updateTileEntities(final Collection tileEntitiesToRemove, final Collection tileEntitiesToAdd) {} + @SideOnly(Side.CLIENT) class ContainerLocalRenderInformation { final RenderChunk renderChunk; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java index 88d77567..ac6e23fb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -6,7 +6,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class SchematicRenderCache extends RegionRenderCache { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java index 9bfbe766..149947f6 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java @@ -4,8 +4,8 @@ import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlay; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.ViewFrustum; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -83,8 +83,8 @@ private int getPosition(final int xz, final int y, final int chunk) { } @Override - public void markBlocksForUpdate(final int fromX, final int fromY, final int fromZ, final int toX, final int toY, final int toZ) { - super.markBlocksForUpdate(fromX, fromY, fromZ, toX, toY, toZ); + public void markBlocksForUpdate(final int fromX, final int fromY, final int fromZ, final int toX, final int toY, final int toZ, final boolean needsUpdate) { + super.markBlocksForUpdate(fromX, fromY, fromZ, toX, toY, toZ, needsUpdate); final int x0 = MathHelper.bucketInt(fromX, 16); final int y0 = MathHelper.bucketInt(fromY, 16); @@ -116,7 +116,7 @@ public void markBlocksForUpdate(final int fromX, final int fromY, final int from final int index = (z * this.countChunksY + y) * this.countChunksX + x; final RenderOverlay renderOverlay = this.renderOverlays[index]; - renderOverlay.setNeedsUpdate(true); + renderOverlay.setNeedsUpdate(needsUpdate); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java index 0169023e..bb58973c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/CompiledOverlay.java @@ -1,30 +1,30 @@ package com.github.lunatrius.schematica.client.renderer.chunk; import net.minecraft.client.renderer.chunk.CompiledChunk; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; public class CompiledOverlay extends CompiledChunk { @Override - public void setLayerStarted(final EnumWorldBlockLayer layer) { - if (layer == EnumWorldBlockLayer.TRANSLUCENT) { + public void setLayerStarted(final BlockRenderLayer layer) { + if (layer == BlockRenderLayer.TRANSLUCENT) { super.setLayerStarted(layer); } } @Override - public void setLayerUsed(final EnumWorldBlockLayer layer) { - if (layer == EnumWorldBlockLayer.TRANSLUCENT) { + public void setLayerUsed(final BlockRenderLayer layer) { + if (layer == BlockRenderLayer.TRANSLUCENT) { super.setLayerUsed(layer); } } @Override - public boolean isLayerStarted(final EnumWorldBlockLayer layer) { - return layer == EnumWorldBlockLayer.TRANSLUCENT && super.isLayerStarted(layer); + public boolean isLayerStarted(final BlockRenderLayer layer) { + return layer == BlockRenderLayer.TRANSLUCENT && super.isLayerStarted(layer); } @Override - public boolean isLayerEmpty(final EnumWorldBlockLayer layer) { - return layer == EnumWorldBlockLayer.TRANSLUCENT && super.isLayerEmpty(layer); + public boolean isLayerEmpty(final BlockRenderLayer layer) { + return layer == BlockRenderLayer.TRANSLUCENT && super.isLayerEmpty(layer); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java index ecc8ad7f..4217ebe1 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java @@ -5,22 +5,22 @@ import com.google.common.util.concurrent.ListenableFuture; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; public class OverlayRenderDispatcher extends ChunkRenderDispatcher { @Override - public ListenableFuture uploadChunk(final EnumWorldBlockLayer layer, final WorldRenderer worldRenderer, final RenderChunk renderChunk, final CompiledChunk compiledChunk) { + public ListenableFuture uploadChunk(final BlockRenderLayer layer, final VertexBuffer buffer, final RenderChunk renderChunk, final CompiledChunk compiledChunk, final double distanceSq) { if (!Minecraft.getMinecraft().isCallingFromMinecraftThread() || OpenGlHelper.useVbo()) { - return super.uploadChunk(layer, worldRenderer, renderChunk, compiledChunk); + return super.uploadChunk(layer, buffer, renderChunk, compiledChunk, distanceSq); } - uploadDisplayList(worldRenderer, ((RenderOverlayList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); + uploadDisplayList(buffer, ((RenderOverlayList) renderChunk).getDisplayList(layer, compiledChunk), renderChunk); - worldRenderer.setTranslation(0.0, 0.0, 0.0); + buffer.setTranslation(0.0, 0.0, 0.0); return Futures.immediateFuture(null); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java index d2b64b1a..2bcd2dc4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerList.java @@ -5,17 +5,17 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.chunk.ListedRenderChunk; import net.minecraft.client.renderer.chunk.RenderChunk; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import org.lwjgl.opengl.GL11; public class SchematicChunkRenderContainerList extends SchematicChunkRenderContainer { @Override - public void renderChunkLayer(final EnumWorldBlockLayer layer) { + public void renderChunkLayer(final BlockRenderLayer layer) { if (this.initialized) { - for (final RenderChunk renderchunk : this.renderChunks) { - final ListedRenderChunk listedRenderChunk = (ListedRenderChunk) renderchunk; + for (final RenderChunk renderChunk : this.renderChunks) { + final ListedRenderChunk listedRenderChunk = (ListedRenderChunk) renderChunk; GlStateManager.pushMatrix(); - preRenderChunk(renderchunk); + preRenderChunk(renderChunk); GL11.glCallList(listedRenderChunk.getDisplayList(layer, listedRenderChunk.getCompiledChunk())); GlStateManager.popMatrix(); } @@ -32,7 +32,7 @@ public void renderOverlay() { final RenderOverlayList renderOverlayList = (RenderOverlayList) renderOverlay; GlStateManager.pushMatrix(); preRenderChunk(renderOverlay); - GL11.glCallList(renderOverlayList.getDisplayList(EnumWorldBlockLayer.TRANSLUCENT, renderOverlayList.getCompiledChunk())); + GL11.glCallList(renderOverlayList.getDisplayList(BlockRenderLayer.TRANSLUCENT, renderOverlayList.getCompiledChunk())); GlStateManager.popMatrix(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java index 39ea99f5..e3090cf4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/container/SchematicChunkRenderContainerVbo.java @@ -7,14 +7,14 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import org.lwjgl.opengl.GL11; import java.util.List; public class SchematicChunkRenderContainerVbo extends SchematicChunkRenderContainer { @Override - public void renderChunkLayer(final EnumWorldBlockLayer layer) { + public void renderChunkLayer(final BlockRenderLayer layer) { preRenderChunk(); if (this.initialized) { @@ -88,7 +88,7 @@ public void renderOverlay() { preRenderOverlay(); for (final RenderOverlay renderOverlay : this.renderOverlays) { - final VertexBuffer vertexBuffer = renderOverlay.getVertexBufferByLayer(EnumWorldBlockLayer.TRANSLUCENT.ordinal()); + final VertexBuffer vertexBuffer = renderOverlay.getVertexBufferByLayer(BlockRenderLayer.TRANSLUCENT.ordinal()); GlStateManager.pushMatrix(); preRenderChunk(renderOverlay); renderOverlay.multModelviewMatrix(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java index ecad012a..041920ed 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java @@ -2,7 +2,7 @@ import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.IRenderChunkFactory; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ISchematicRenderChunkFactory extends IRenderChunkFactory { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index a0559e64..070ddbfb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -11,16 +11,15 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.VisGraph; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; @@ -69,8 +68,8 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final World mcWorld = Minecraft.getMinecraft().theWorld; - final EnumWorldBlockLayer layer = EnumWorldBlockLayer.TRANSLUCENT; - final WorldRenderer worldRenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); + final BlockRenderLayer layer = BlockRenderLayer.TRANSLUCENT; + final net.minecraft.client.renderer.VertexBuffer buffer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); GeometryTessellator.setStaticDelta(ConfigurationHandler.blockDelta); @@ -86,8 +85,8 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final IBlockState schBlockState = schematic.getBlockState(pos); final Block schBlock = schBlockState.getBlock(); - if (schBlock.isOpaqueCube()) { - visgraph.func_178606_a(pos); + if (schBlock.isOpaqueCube(schBlockState)) { + visgraph.setOpaqueCube(pos); } final BlockPos mcPos = pos.add(schematic.position); @@ -102,7 +101,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun render = true; color = 0xBF00BF; - sides = getSides(mcBlock, mcWorld, mcPos, sides); + sides = getSides(mcBlockState, mcBlock, mcWorld, mcPos, sides); } } @@ -123,51 +122,51 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } if (render) { - sides = getSides(schBlock, schematic, pos, sides); + sides = getSides(schBlockState, schBlock, schematic, pos, sides); } } if (render && sides != 0) { if (!compiledOverlay.isLayerStarted(layer)) { compiledOverlay.setLayerStarted(layer); - preRenderBlocks(worldRenderer, from); + preRenderBlocks(buffer, from); } - GeometryTessellator.drawCuboid(worldRenderer, pos, sides, 0x3F000000 | color); + GeometryTessellator.drawCuboid(buffer, pos, sides, 0x3F000000 | color); compiledOverlay.setLayerUsed(layer); } } if (compiledOverlay.isLayerStarted(layer)) { - postRenderBlocks(layer, x, y, z, worldRenderer, compiledOverlay); + postRenderBlocks(layer, x, y, z, buffer, compiledOverlay); } } compiledOverlay.setVisibility(visgraph.computeVisibility()); } - private int getSides(final Block block, final World world, final BlockPos pos, int sides) { - if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) { + private int getSides(final IBlockState blockState, final Block block, final World world, final BlockPos pos, int sides) { + if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) { sides |= GeometryMasks.Quad.DOWN; } - if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.UP), EnumFacing.UP)) { + if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.UP), EnumFacing.UP)) { sides |= GeometryMasks.Quad.UP; } - if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) { + if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) { sides |= GeometryMasks.Quad.NORTH; } - if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { + if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { sides |= GeometryMasks.Quad.SOUTH; } - if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) { + if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) { sides |= GeometryMasks.Quad.WEST; } - if (block.shouldSideBeRendered(world, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) { + if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) { sides |= GeometryMasks.Quad.EAST; } @@ -175,9 +174,9 @@ private int getSides(final Block block, final World world, final BlockPos pos, i } @Override - public void preRenderBlocks(final WorldRenderer worldRenderer, final BlockPos pos) { - worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - worldRenderer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ()); + public void preRenderBlocks(final net.minecraft.client.renderer.VertexBuffer buffer, final BlockPos pos) { + buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); + buffer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ()); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java index 163e4d0b..c7ffc4f2 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java @@ -3,8 +3,8 @@ import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.CompiledChunk; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class RenderOverlayList extends RenderOverlay { @@ -14,7 +14,7 @@ public RenderOverlayList(final World world, final RenderGlobal renderGlobal, fin super(world, renderGlobal, pos, index); } - public int getDisplayList(final EnumWorldBlockLayer layer, final CompiledChunk compiledChunk) { + public int getDisplayList(final BlockRenderLayer layer, final CompiledChunk compiledChunk) { return !compiledChunk.isLayerEmpty(layer) ? this.displayList : -1; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java index 58e2208a..87434ecb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.ListedRenderChunk; import net.minecraft.client.renderer.chunk.SetVisibility; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java index 78a53380..0129be80 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -8,7 +8,7 @@ import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.SetVisibility; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 160929e3..31a55303 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.util; -import com.github.lunatrius.core.util.BlockPosHelper; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.BlockPosHelper; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; @@ -10,8 +10,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.ArrayList; @@ -25,7 +25,7 @@ public List getList(final EntityPlayer player, final Schematic return blockList; } - final MovingObjectPosition movingObjectPosition = new MovingObjectPosition(player); + final RayTraceResult rtr = new RayTraceResult(player); final MBlockPos mcPos = new MBlockPos(); for (final MBlockPos pos : BlockPosHelper.getAllInBox(BlockPos.ORIGIN, new BlockPos(world.getWidth() - 1, world.getHeight() - 1, world.getLength() - 1))) { @@ -48,7 +48,7 @@ public List getList(final EntityPlayer player, final Schematic ItemStack stack = null; try { - stack = block.getPickBlock(movingObjectPosition, world, pos, player); + stack = block.getPickBlock(blockState, rtr, world, pos, player); } catch (final Exception e) { Reference.logger.debug("Could not get the pick block for: {}", blockState, e); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java index c4117fff..4fc171c0 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java @@ -4,16 +4,17 @@ import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; public class BlockStateToItemStack { - public static ItemStack getItemStack(final IBlockState blockState, final MovingObjectPosition movingObjectPosition, final SchematicWorld world, final BlockPos pos) { + public static ItemStack getItemStack(final IBlockState blockState, final RayTraceResult rayTraceResult, final SchematicWorld world, final BlockPos pos, final EntityPlayer player) { final Block block = blockState.getBlock(); try { - final ItemStack itemStack = block.getPickBlock(movingObjectPosition, world, pos); + final ItemStack itemStack = block.getPickBlock(blockState, rayTraceResult, world, pos, player); if (itemStack != null) { return itemStack; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java index 4c481912..c2f814b8 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.util; -import com.github.lunatrius.core.util.BlockPosHelper; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.BlockPosHelper; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; @@ -14,9 +14,9 @@ import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3i; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index a84a7fc1..3732105f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.util; -import com.github.lunatrius.core.util.BlockPosHelper; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.BlockPosHelper; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.block.state.BlockStateHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; @@ -16,9 +16,9 @@ import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3i; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 29552ef4..8d727acc 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -1,22 +1,23 @@ package com.github.lunatrius.schematica.client.world; -import com.github.lunatrius.core.util.BlockPosHelper; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.BlockPosHelper; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.block.state.pattern.BlockStateReplacer; import com.github.lunatrius.schematica.client.world.chunk.ChunkProviderSchematic; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; -import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.Entity; +import net.minecraft.init.Biomes; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.WorldSettings; @@ -99,7 +100,7 @@ public float getLightBrightness(final BlockPos pos) { @Override public boolean isBlockNormalCube(final BlockPos pos, final boolean _default) { - return getBlockState(pos).getBlock().isNormalCube(this, pos); + return getBlockState(pos).isNormalCube(); } @Override @@ -111,19 +112,15 @@ protected void calculateInitialWeather() {} @Override public void setSpawnPoint(final BlockPos pos) {} - @Override - protected int getRenderDistanceChunks() { - return 0; - } - @Override public boolean isAirBlock(final BlockPos pos) { - return getBlockState(pos).getBlock().isAir(this, pos); + final IBlockState blockState = getBlockState(pos); + return blockState.getBlock().isAir(blockState, this, pos); } @Override public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { - return BiomeGenBase.jungle; + return Biomes.jungle; } public int getWidth() { @@ -147,7 +144,8 @@ public boolean extendedLevelsInChunkCache() { @Override protected IChunkProvider createChunkProvider() { - return new ChunkProviderSchematic(this); + this.chunkProvider = new ChunkProviderSchematic(this); + return this.chunkProvider; } @Override @@ -162,7 +160,7 @@ public boolean isSideSolid(final BlockPos pos, final EnumFacing side) { @Override public boolean isSideSolid(final BlockPos pos, final EnumFacing side, final boolean _default) { - return getBlockState(pos).getBlock().isSideSolid(this, pos, side); + return getBlockState(pos).isSideSolid(this, pos, side); } public void setSchematic(final ISchematic schematic) { @@ -206,7 +204,7 @@ public String getDebugDimensions() { } @SuppressWarnings({ "rawtypes", "unchecked" }) - public int replaceBlock(final BlockStateHelper matcher, final BlockStateReplacer replacer, final Map properties) { + public int replaceBlock(final BlockStateMatcher matcher, final BlockStateReplacer replacer, final Map properties) { int count = 0; for (final MBlockPos pos : BlockPosHelper.getAllInBox(0, 0, 0, getWidth(), getHeight(), getLength())) { @@ -226,7 +224,7 @@ public int replaceBlock(final BlockStateHelper matcher, final BlockStateReplacer } if (this.schematic.setBlockState(pos, replacement)) { - markBlockForUpdate(pos.add(this.position)); + notifyBlockUpdate(pos.add(this.position), blockState, replacement, 3); count++; } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index dbbfdf8b..77473de3 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -1,17 +1,11 @@ package com.github.lunatrius.schematica.client.world.chunk; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.BlockPos; -import net.minecraft.util.IProgressUpdate; import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.IChunkProvider; -import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -22,47 +16,38 @@ public class ChunkProviderSchematic implements IChunkProvider { public ChunkProviderSchematic(final SchematicWorld world) { this.world = world; - this.emptyChunk = new EmptyChunk(world, 0, 0); + this.emptyChunk = new EmptyChunk(world, 0, 0) { + @Override + public boolean isEmpty() { + return false; + } + }; } - @Override - public boolean chunkExists(final int x, final int z) { + private boolean chunkExists(final int x, final int z) { return x >= 0 && z >= 0 && x < this.world.getWidth() && z < this.world.getLength(); } @Override - public Chunk provideChunk(final int x, final int z) { - if (chunkExists(x, z)) { - final long key = ChunkCoordIntPair.chunkXZ2Int(x, z); - - ChunkSchematic chunk = this.chunks.get(key); - if (chunk == null) { - chunk = new ChunkSchematic(this.world, x, z); - this.chunks.put(key, chunk); - } - - return chunk; + public Chunk getLoadedChunk(final int x, final int z) { + if (!chunkExists(x, z)) { + return this.emptyChunk; } - return this.emptyChunk; - } - - @Override - public Chunk provideChunk(final BlockPos pos) { - return provideChunk(pos.getX() >> 4, pos.getZ() >> 4); - } + final long key = ChunkCoordIntPair.chunkXZ2Int(x, z); - @Override - public void populate(final IChunkProvider provider, final int x, final int z) {} + ChunkSchematic chunk = this.chunks.get(key); + if (chunk == null) { + chunk = new ChunkSchematic(this.world, x, z); + this.chunks.put(key, chunk); + } - @Override - public boolean func_177460_a(final IChunkProvider chunkProvider, final Chunk chunk, final int x, final int z) { - return false; + return chunk; } @Override - public boolean saveChunks(final boolean saveExtra, final IProgressUpdate progressUpdate) { - return true; + public Chunk provideChunk(final int x, final int z) { + return getLoadedChunk(x, z); } @Override @@ -70,34 +55,8 @@ public boolean unloadQueuedChunks() { return false; } - @Override - public boolean canSave() { - return false; - } - @Override public String makeString() { return "SchematicChunkCache"; } - - @Override - public List getPossibleCreatures(final EnumCreatureType creatureType, final BlockPos pos) { - return null; - } - - @Override - public BlockPos getStrongholdGen(final World world, final String name, final BlockPos pos) { - return null; - } - - @Override - public int getLoadedChunkCount() { - return this.world.getWidth() * this.world.getLength(); - } - - @Override - public void recreateStructures(final Chunk chunk, final int x, final int z) { } - - @Override - public void saveExtraData() {} } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java index 6787983c..f992da5d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java @@ -2,7 +2,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java index cdd041d9..12af41be 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java @@ -3,6 +3,11 @@ import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.event.ClickEvent; public abstract class CommandSchematicaBase extends CommandBase { @Override @@ -11,8 +16,21 @@ public int getRequiredPermissionLevel() { } @Override - public boolean canCommandSenderUseCommand(final ICommandSender sender) { + public boolean checkPermission(final MinecraftServer server, final ICommandSender sender) { // TODO: add logic for the client side when ready - return super.canCommandSenderUseCommand(sender) || (sender instanceof EntityPlayerMP && getRequiredPermissionLevel() <= 0); + return super.checkPermission(server, sender) || (sender instanceof EntityPlayerMP && getRequiredPermissionLevel() <= 0); + } + + protected T withStyle(final T component, final TextFormatting formatting, final String command) { + final Style style = new Style(); + style.setColor(formatting); + + if (command != null) { + style.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)); + } + + component.setStyle(style); + + return component; } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 2f2d9b31..78e8252d 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -14,8 +14,9 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; import org.apache.commons.io.FilenameUtils; import java.io.File; @@ -36,7 +37,7 @@ public String getCommandUsage(final ICommandSender sender) { } @Override - public List addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) { + public List getTabCompletionOptions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { if (!(sender instanceof EntityPlayer)) { return null; } @@ -58,7 +59,7 @@ public List addTabCompletionOptions(final ICommandSender sender, final S } @Override - public void processCommand(final ICommandSender sender, final String[] args) throws CommandException { + public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { if (args.length < 1) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -79,7 +80,7 @@ public void processCommand(final ICommandSender sender, final String[] args) thr if (schematic != null) { DownloadHandler.INSTANCE.transferMap.put(player, new SchematicTransfer(schematic, filename)); - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_STARTED, filename)); + sender.addChatMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_STARTED, filename)); } else { throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 9688fa76..4e3bef57 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -9,12 +9,11 @@ import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.ClickEvent; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import org.apache.commons.io.FilenameUtils; import java.io.File; @@ -34,15 +33,15 @@ public String getCommandUsage(final ICommandSender sender) { } @Override - public void processCommand(final ICommandSender sender, final String[] arguments) throws CommandException { + public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { if (!(sender instanceof EntityPlayer)) { throw new CommandException(Names.Command.Save.Message.PLAYERS_ONLY); } int page = 0; try { - if (arguments.length > 0) { - page = Integer.parseInt(arguments[0]) - 1; + if (args.length > 0) { + page = Integer.parseInt(args[0]) - 1; if (page < 0) { page = 0; } @@ -57,7 +56,7 @@ public void processCommand(final ICommandSender sender, final String[] arguments final int pageEnd = pageStart + pageSize; int currentFile = 0; - final LinkedList componentsToSend = new LinkedList(); + final LinkedList componentsToSend = new LinkedList(); final File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (schematicDirectory == null) { @@ -77,25 +76,15 @@ public void processCommand(final ICommandSender sender, final String[] arguments if (currentFile >= pageStart && currentFile < pageEnd) { final String fileName = FilenameUtils.removeExtension(path.getName()); - final IChatComponent chatComponent = new ChatComponentText(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), fileName)); - final String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); + final ITextComponent chatComponent = new TextComponentString(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), fileName)); - final IChatComponent removeLink = new ChatComponentTranslation(Names.Command.List.Message.REMOVE) - .setChatStyle( - new ChatStyle() - .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, removeCommand)) - .setColor(EnumChatFormatting.RED) - ); + final String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); + final ITextComponent removeLink = withStyle(new TextComponentTranslation(Names.Command.List.Message.REMOVE), TextFormatting.RED, removeCommand); chatComponent.appendSibling(removeLink); chatComponent.appendText("]["); final String downloadCommand = String.format("/%s %s", Names.Command.Download.NAME, fileName); - final IChatComponent downloadLink = new ChatComponentTranslation(Names.Command.List.Message.DOWNLOAD) - .setChatStyle( - new ChatStyle() - .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, downloadCommand)) - .setColor(EnumChatFormatting.GREEN) - ); + final ITextComponent downloadLink = withStyle(new TextComponentTranslation(Names.Command.List.Message.DOWNLOAD), TextFormatting.GREEN, downloadCommand); chatComponent.appendSibling(downloadLink); chatComponent.appendText("]"); @@ -105,7 +94,7 @@ public void processCommand(final ICommandSender sender, final String[] arguments } if (currentFile == 0) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.NO_SCHEMATICS)); + sender.addChatMessage(new TextComponentTranslation(Names.Command.List.Message.NO_SCHEMATICS)); return; } @@ -114,9 +103,8 @@ public void processCommand(final ICommandSender sender, final String[] arguments throw new CommandException(Names.Command.List.Message.NO_SUCH_PAGE); } - sender.addChatMessage(new ChatComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1) - .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_GREEN))); - for (final IChatComponent chatComponent : componentsToSend) { + sender.addChatMessage(withStyle(new TextComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1), TextFormatting.DARK_GREEN, null)); + for (final ITextComponent chatComponent : componentsToSend) { sender.addChatMessage(chatComponent); } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 15f80cf7..401010d7 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -11,12 +11,11 @@ import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.ClickEvent; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import java.io.File; import java.util.Arrays; @@ -33,8 +32,8 @@ public String getCommandUsage(final ICommandSender sender) { } @Override - public void processCommand(final ICommandSender sender, final String[] arguments) throws CommandException{ - if (arguments.length < 1) { + public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { + if (args.length < 1) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -45,14 +44,14 @@ public void processCommand(final ICommandSender sender, final String[] arguments final EntityPlayer player = (EntityPlayer) sender; boolean delete = false; - String name = Strings.join(arguments, " "); + String name = Strings.join(args, " "); - if (arguments.length > 1) { + if (args.length > 1) { //check if the last parameter is a hash, which constitutes a confirmation. - final String potentialNameHash = arguments[arguments.length - 1]; + final String potentialNameHash = args[args.length - 1]; if (potentialNameHash.length() == 32) { //We probably have a match. - final String[] a = Arrays.copyOfRange(arguments, 0, arguments.length - 1); + final String[] a = Arrays.copyOfRange(args, 0, args.length - 1); //The name then should be everything except the last element name = Strings.join(a, " "); @@ -75,27 +74,17 @@ public void processCommand(final ICommandSender sender, final String[] arguments if (file.exists()) { if (delete) { if (file.delete()) { - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_REMOVED, name)); + sender.addChatMessage(new TextComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_REMOVED, name)); } else { throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } } else { final String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); final String confirmCommand = String.format("/%s %s %s", Names.Command.Remove.NAME, name, hash); - final IChatComponent chatComponent = new ChatComponentTranslation(Names.Command.Remove.Message.ARE_YOU_SURE_START, name) - .appendSibling(new ChatComponentText(" [")) - .appendSibling( - //Confirmation link - new ChatComponentTranslation(Names.Command.Remove.Message.YES) - .setChatStyle( - new ChatStyle() - .setColor(EnumChatFormatting.RED) - .setChatClickEvent( - new ClickEvent(ClickEvent.Action.RUN_COMMAND, confirmCommand) - ) - ) - ) - .appendSibling(new ChatComponentText("]")); + final ITextComponent chatComponent = new TextComponentTranslation(Names.Command.Remove.Message.ARE_YOU_SURE_START, name); + chatComponent.appendSibling(new TextComponentString(" [")); + chatComponent.appendSibling(withStyle(new TextComponentTranslation(Names.Command.Remove.Message.YES), TextFormatting.RED, confirmCommand)); + chatComponent.appendSibling(new TextComponentString("]")); sender.addChatMessage(chatComponent); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 2e15e64e..41b621aa 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.command; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Names; @@ -10,7 +10,8 @@ import net.minecraft.command.NumberInvalidException; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.TextComponentTranslation; import java.io.File; @@ -26,8 +27,8 @@ public String getCommandUsage(final ICommandSender sender) { } @Override - public void processCommand(final ICommandSender sender, final String[] arguments) throws CommandException { - if (arguments.length < 7) { + public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { + if (args.length < 7) { throw new WrongUsageException(getCommandUsage(sender)); } @@ -47,10 +48,10 @@ public void processCommand(final ICommandSender sender, final String[] arguments final String name; try { - from.set(parseCoord(arguments[0]), parseCoord(arguments[1]), parseCoord(arguments[2])); - to.set(parseCoord(arguments[3]), parseCoord(arguments[4]), parseCoord(arguments[5])); + from.set(parseCoord(args[0]), parseCoord(args[1]), parseCoord(args[2])); + to.set(parseCoord(args[3]), parseCoord(args[4]), parseCoord(args[5])); - name = arguments[6]; + name = args[6]; filename = String.format("%s.schematic", name); } catch (final NumberFormatException exception) { throw new WrongUsageException(getCommandUsage(sender)); @@ -73,7 +74,7 @@ public void processCommand(final ICommandSender sender, final String[] arguments try { Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), from, to); - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); + sender.addChatMessage(new TextComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); } catch (final Exception e) { throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java index e5be90a1..056a6798 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java +++ b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java @@ -7,11 +7,12 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; -import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; @@ -31,7 +32,7 @@ public String getCommandUsage(final ICommandSender sender) { } @Override - public List addTabCompletionOptions(final ICommandSender sender, final String[] args, final BlockPos pos) { + public List getTabCompletionOptions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { if (args.length < 3) { return getListOfStringsMatchingLastWord(args, BLOCK_REGISTRY.getKeys()); } @@ -40,7 +41,7 @@ public List addTabCompletionOptions(final ICommandSender sender, final S } @Override - public void processCommand(final ICommandSender sender, final String[] args) throws CommandException { + public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { final SchematicWorld schematic = ClientProxy.schematic; if (schematic == null) { throw new CommandException(Names.Command.Replace.Message.NO_SCHEMATIC); @@ -52,14 +53,14 @@ public void processCommand(final ICommandSender sender, final String[] args) thr try { final BlockStateReplacer.BlockStateInfo patternInfo = BlockStateReplacer.fromString(args[0]); - final BlockStateHelper matcher = BlockStateReplacer.getMatcher(patternInfo); + final BlockStateMatcher matcher = BlockStateReplacer.getMatcher(patternInfo); final BlockStateReplacer.BlockStateInfo replacementInfo = BlockStateReplacer.fromString(args[1]); final BlockStateReplacer replacer = BlockStateReplacer.forBlockState(replacementInfo.block.getDefaultState()); final int count = schematic.replaceBlock(matcher, replacer, replacementInfo.stateData); - sender.addChatMessage(new ChatComponentTranslation(Names.Command.Replace.Message.SUCCESS, count)); + sender.addChatMessage(new TextComponentTranslation(Names.Command.Replace.Message.SUCCESS, count)); } catch (final Exception e) { Reference.logger.error("Something went wrong!", e); throw new CommandException(e.getMessage()); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index bd15c1b2..2a1f2389 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -266,7 +266,7 @@ private ConfigurationHandler() {} @SubscribeEvent public void onConfigurationChangedEvent(final ConfigChangedEvent.OnConfigChangedEvent event) { - if (event.modID.equalsIgnoreCase(Reference.MODID)) { + if (event.getModID().equalsIgnoreCase(Reference.MODID)) { loadConfiguration(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 6b2f22ed..89aa95dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -6,7 +6,7 @@ import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -58,8 +58,8 @@ private void processQueue() { if (container.hasNext()) { if (container.isFirst()) { - final ChatComponentTranslation chatComponent = new ChatComponentTranslation(Names.Command.Save.Message.SAVE_STARTED, container.chunkCount, container.file.getName()); - container.player.addChatMessage(chatComponent); + final TextComponentTranslation component = new TextComponentTranslation(Names.Command.Save.Message.SAVE_STARTED, container.chunkCount, container.file.getName()); + container.player.addChatMessage(component); } container.next(); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java index 4915c2a6..6d8e3ed6 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/GuiHandler.java @@ -11,8 +11,8 @@ public class GuiHandler { @SubscribeEvent public void onGuiOpen(final GuiOpenEvent event) { if (SchematicPrinter.INSTANCE.isPrinting()) { - if (event.gui instanceof GuiEditSign) { - event.gui = null; + if (event.getGui() instanceof GuiEditSign) { + event.setGui(null); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 10d05cbb..92a48488 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -13,9 +13,9 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.resources.I18n; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; @@ -100,7 +100,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_PRINTER_TOGGLE.isPressed()) { if (ClientProxy.schematic != null) { final boolean printing = SchematicPrinter.INSTANCE.togglePrinting(); - this.minecraft.thePlayer.addChatComponentMessage(new ChatComponentTranslation(Names.Messages.TOGGLE_PRINTER, I18n.format(printing ? Names.Gui.ON : Names.Gui.OFF))); + this.minecraft.thePlayer.addChatComponentMessage(new TextComponentTranslation(Names.Messages.TOGGLE_PRINTER, I18n.format(printing ? Names.Gui.ON : Names.Gui.OFF))); } } @@ -124,7 +124,7 @@ private void handlePickBlock() { boolean revert = true; if (schematic != null && schematic.isRendering) { - revert = pickBlock(schematic, ClientProxy.movingObjectPosition); + revert = pickBlock(schematic, ClientProxy.objectMouseOver); } if (revert) { @@ -136,19 +136,19 @@ private void handlePickBlock() { } } - private boolean pickBlock(final SchematicWorld schematic, final MovingObjectPosition objectMouseOver) { + private boolean pickBlock(final SchematicWorld schematic, final RayTraceResult objectMouseOver) { boolean revert = false; // Minecraft.func_147112_ai if (objectMouseOver != null) { final EntityPlayerSP player = this.minecraft.thePlayer; - if (objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.MISS) { + if (objectMouseOver.typeOfHit == RayTraceResult.Type.MISS) { revert = true; } - final MovingObjectPosition mcObjectMouseOver = this.minecraft.objectMouseOver; - if (mcObjectMouseOver != null && mcObjectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + final RayTraceResult mcObjectMouseOver = this.minecraft.objectMouseOver; + if (mcObjectMouseOver != null && mcObjectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) { if (mcObjectMouseOver.getBlockPos().subtract(schematic.position).equals(objectMouseOver.getBlockPos())) { return true; } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index 6b09a598..a51f5883 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -8,13 +8,15 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; +import java.util.ArrayList; + public class OverlayHandler { private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -24,22 +26,25 @@ public void onText(final RenderGameOverlayEvent.Text event) { if (this.minecraft.gameSettings.showDebugInfo && ConfigurationHandler.showDebugInfo) { final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null && schematic.isRendering) { - event.left.add(""); - event.left.add("[§6Schematica§r] " + schematic.getDebugDimensions()); + final ArrayList left = event.getLeft(); + final ArrayList right = event.getRight(); + + left.add(""); + left.add("[§6Schematica§r] " + schematic.getDebugDimensions()); // event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); - event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); - event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); + left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); + left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); - final MovingObjectPosition mop = ClientProxy.movingObjectPosition; - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - final BlockPos pos = mop.getBlockPos(); + final RayTraceResult rtr = ClientProxy.objectMouseOver; + if (rtr != null && rtr.typeOfHit == RayTraceResult.Type.BLOCK) { + final BlockPos pos = rtr.getBlockPos(); final IBlockState blockState = schematic.getBlockState(pos); - event.right.add(""); - event.right.add(String.valueOf(BLOCK_REGISTRY.getNameForObject(blockState.getBlock())) + " [§6S§r]"); + right.add(""); + right.add(String.valueOf(BLOCK_REGISTRY.getNameForObject(blockState.getBlock())) + " [§6S§r]"); for (final String formattedProperty : BlockStateHelper.getFormattedProperties(blockState)) { - event.right.add(formattedProperty + " [§6S§r]"); + right.add(formattedProperty + " [§6S§r]"); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 4386e082..49f35850 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -4,8 +4,8 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -20,10 +20,10 @@ private RenderTickHandler() {} public void onRenderTick(final TickEvent.RenderTickEvent event) { final SchematicWorld schematic = ClientProxy.schematic; - ClientProxy.movingObjectPosition = schematic != null ? rayTrace(schematic, 1.0f) : null; + ClientProxy.objectMouseOver = schematic != null ? rayTrace(schematic, 1.0f) : null; } - private MovingObjectPosition rayTrace(final SchematicWorld schematic, final float partialTicks) { + private RayTraceResult rayTrace(final SchematicWorld schematic, final float partialTicks) { final Entity renderViewEntity = this.minecraft.getRenderViewEntity(); if (renderViewEntity == null) { return null; @@ -39,9 +39,9 @@ private MovingObjectPosition rayTrace(final SchematicWorld schematic, final floa renderViewEntity.posY -= schematic.position.y; renderViewEntity.posZ -= schematic.position.z; - final Vec3 vecPosition = renderViewEntity.getPositionEyes(partialTicks); - final Vec3 vecLook = renderViewEntity.getLook(partialTicks); - final Vec3 vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); + final Vec3d vecPosition = renderViewEntity.getPositionEyes(partialTicks); + final Vec3d vecLook = renderViewEntity.getLook(partialTicks); + final Vec3d vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); renderViewEntity.posX = posX; renderViewEntity.posY = posY; diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java index 3e8e8a5a..a93989e3 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/WorldHandler.java @@ -4,7 +4,7 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Reference; -import net.minecraft.world.IWorldAccess; +import net.minecraft.world.IWorldEventListener; import net.minecraft.world.World; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -12,30 +12,32 @@ public class WorldHandler { @SubscribeEvent public void onLoad(final WorldEvent.Load event) { - if (event.world.isRemote && !(event.world instanceof SchematicWorld)) { + final World world = event.getWorld(); + if (world.isRemote && !(world instanceof SchematicWorld)) { RenderSchematic.INSTANCE.setWorldAndLoadRenderers(ClientProxy.schematic); - addWorldAccess(event.world, RenderSchematic.INSTANCE); + addWorldAccess(world, RenderSchematic.INSTANCE); } } @SubscribeEvent public void onUnload(final WorldEvent.Unload event) { - if (event.world.isRemote) { - removeWorldAccess(event.world, RenderSchematic.INSTANCE); + final World world = event.getWorld(); + if (world.isRemote) { + removeWorldAccess(world, RenderSchematic.INSTANCE); } } - public static void addWorldAccess(final World world, final IWorldAccess schematic) { + public static void addWorldAccess(final World world, final IWorldEventListener schematic) { if (world != null && schematic != null) { Reference.logger.debug("Adding world access to {}", world); - world.addWorldAccess(schematic); + world.addEventListener(schematic); } } - public static void removeWorldAccess(final World world, final IWorldAccess schematic) { + public static void removeWorldAccess(final World world, final IWorldEventListener schematic) { if (world != null && schematic != null) { Reference.logger.debug("Removing world access from {}", world); - world.removeWorldAccess(schematic); + world.removeEventListener(schematic); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index f7dd9dd7..77565952 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -7,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; @@ -143,7 +143,8 @@ public static NBTTagCompound writeTileEntityToCompound(final TileEntity tileEnti } public static TileEntity readTileEntityFromCompound(final NBTTagCompound tileEntityCompound) { - return TileEntity.createAndLoadEntity(tileEntityCompound); + // FIXME: the server is currently not used, but might be in the future... + return TileEntity.createTileEntity(null, tileEntityCompound); } public static NBTTagCompound writeEntityToCompound(final Entity entity) { diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java index 0dcd5eab..9a1ca4c0 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.network.message; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.handler.DownloadHandler; import com.github.lunatrius.schematica.nbt.NBTHelper; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index e063ec48..568f9b18 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -6,7 +6,7 @@ import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; @@ -40,7 +40,7 @@ public IMessage onMessage(final MessageDownloadEnd message, final MessageContext final boolean success = SchematicFormat.writeToFile(directory, message.name, DownloadHandler.INSTANCE.schematic); if (success) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(Names.Command.Download.Message.DOWNLOAD_SUCCEEDED, message.name)); + Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_SUCCEEDED, message.name)); } DownloadHandler.INSTANCE.schematic = null; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 859572f1..7ca05e1a 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.core.util.vector.Vector3d; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.client.printer.SchematicPrinter; @@ -20,8 +20,9 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.MathHelper; + +import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Property; @@ -52,7 +53,7 @@ public class ClientProxy extends CommonProxy { public static EnumFacing axisFlip = EnumFacing.UP; public static EnumFacing axisRotation = EnumFacing.UP; - public static MovingObjectPosition movingObjectPosition = null; + public static RayTraceResult objectMouseOver = null; private static final Minecraft MINECRAFT = Minecraft.getMinecraft(); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 35106788..b2925f83 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.proxy; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.command.CommandSchematicaList; import com.github.lunatrius.schematica.command.CommandSchematicaRemove; @@ -21,8 +21,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -148,7 +148,7 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, final int minZ1 = localMinZ | (chunkZ << 4); final int maxX1 = localMaxX | (chunkX << 4); final int maxZ1 = localMaxZ | (chunkZ << 4); - final AxisAlignedBB bb = AxisAlignedBB.fromBounds(minX1, minY, minZ1, maxX1 + 1, maxY + 1, maxZ1 + 1); + final AxisAlignedBB bb = new AxisAlignedBB(minX1, minY, minZ1, maxX1 + 1, maxY + 1, maxZ1 + 1); final List entities = world.getEntitiesWithinAABB(Entity.class, bb); for (final Entity entity : entities) { try { diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index a2b6af7c..0bac2741 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -12,9 +12,12 @@ import java.io.File; import java.io.IOException; +import java.lang.ref.WeakReference; import java.util.UUID; public class ServerProxy extends CommonProxy { + private WeakReference serverWeakReference = null; + @Override public void init(final FMLInitializationEvent event) { super.init(event); @@ -26,11 +29,13 @@ public void init(final FMLInitializationEvent event) { public void serverStarting(final FMLServerStartingEvent event) { super.serverStarting(event); event.registerServerCommand(new CommandSchematicaDownload()); + this.serverWeakReference = new WeakReference(event.getServer()); } @Override public File getDataDirectory() { - final File file = MinecraftServer.getServer().getFile("."); + final MinecraftServer server = this.serverWeakReference.get(); + final File file = server != null ? server.getFile(".") : new File("."); try { return file.getCanonicalFile(); } catch (final IOException e) { diff --git a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java index 3e3afbd1..c93609df 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java +++ b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java @@ -23,8 +23,8 @@ protected IChunkProvider createChunkProvider() { } @Override - protected int getRenderDistanceChunks() { - return 0; + protected boolean isChunkLoaded(final int x, final int z, final boolean allowEmpty) { + return false; } public static WorldDummy instance() { diff --git a/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java index d3f14536..9a1a89f7 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/WorldProviderSchematic.java @@ -1,15 +1,12 @@ package com.github.lunatrius.schematica.world; +import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; public class WorldProviderSchematic extends WorldProvider { @Override - public String getDimensionName() { - return "Schematic"; - } - - @Override - public String getInternalNameSuffix() { - return "_schematic"; + public DimensionType getDimensionType() { + // TODO: this shouldn't be null... + return null; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index fa460f31..3ba53b72 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -1,6 +1,6 @@ package com.github.lunatrius.schematica.world.schematic; -import com.github.lunatrius.core.util.MBlockPos; +import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.api.event.PreSchematicSaveEvent; import com.github.lunatrius.schematica.nbt.NBTHelper; @@ -15,8 +15,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index ed4756bd..4ddab946 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -6,7 +6,7 @@ import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.common.MinecraftForge; import java.io.DataOutputStream; @@ -78,7 +78,7 @@ public static boolean writeToFile(final File directory, final String filename, f public static void writeToFileAndNotify(final File file, final ISchematic schematic, final EntityPlayer player) { final boolean success = writeToFile(file, schematic); final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; - player.addChatMessage(new ChatComponentTranslation(message, file.getName())); + player.addChatMessage(new TextComponentTranslation(message, file.getName())); } static { diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java index 0a102157..f2c1a6cf 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java @@ -4,6 +4,7 @@ import net.minecraft.world.MinecraftException; import net.minecraft.world.WorldProvider; import net.minecraft.world.chunk.storage.IChunkLoader; +import net.minecraft.world.gen.structure.template.TemplateManager; import net.minecraft.world.storage.IPlayerFileData; import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; @@ -49,7 +50,7 @@ public File getMapFileFromName(final String name) { } @Override - public String getWorldDirectoryName() { + public TemplateManager getStructureTemplateManager() { return null; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index cab80cf9..cf03ffa2 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -8,7 +8,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; import net.minecraftforge.fml.common.registry.GameData; diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index 16a95992..b243cdda 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -1,12 +1,12 @@ # Schematica public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher field_178524_h # queueChunkUploads -public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178506_a(Lnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/client/renderer/vertex/VertexBuffer;)V # uploadVertexBuffer -public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178510_a(Lnet/minecraft/client/renderer/WorldRenderer;ILnet/minecraft/client/renderer/chunk/RenderChunk;)V # uploadDisplayList +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178506_a(Lnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/client/renderer/vertex/VertexBuffer;)V # uploadVertexBuffer +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178510_a(Lnet/minecraft/client/renderer/VertexBuffer;ILnet/minecraft/client/renderer/chunk/RenderChunk;)V # uploadDisplayList public net.minecraft.client.renderer.chunk.RenderChunk field_178588_d # world -public net.minecraft.client.renderer.chunk.RenderChunk func_178573_a(Lnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/util/BlockPos;)V # preRenderBlocks -public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecraft/util/EnumWorldBlockLayer;FFFLnet/minecraft/client/renderer/WorldRenderer;Lnet/minecraft/client/renderer/chunk/CompiledChunk;)V # postRenderBlocks +public net.minecraft.client.renderer.chunk.RenderChunk func_178573_a(Lnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/util/math/BlockPos;)V # preRenderBlocks +public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecraft/util/BlockRenderLayer;FFFLnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/client/renderer/chunk/CompiledChunk;)V # postRenderBlocks -public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk +public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag From db0b1ea7c138d33a3e33e62a9e16be33dfa40da4 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 14 Apr 2016 18:34:26 +0200 Subject: [PATCH 272/314] Update Forge version and mappings. --- gradle.properties | 8 ++-- .../client/gui/load/GuiSchematicLoad.java | 6 +-- .../client/printer/SchematicPrinter.java | 5 ++- .../client/printer/nbtsync/SyncRegistry.java | 6 +-- .../printer/registry/PlacementRegistry.java | 42 +++++++++---------- .../client/renderer/RenderSchematic.java | 8 ++-- .../client/renderer/SchematicRenderCache.java | 2 +- .../schematica/client/util/BlockList.java | 2 +- .../client/world/SchematicWorld.java | 4 +- .../handler/ConfigurationHandler.java | 2 +- .../schematica/proxy/CommonProxy.java | 2 +- .../world/schematic/SchematicAlpha.java | 2 +- .../world/schematic/SchematicUtil.java | 2 +- .../schematica/world/storage/Schematic.java | 4 +- 14 files changed, 48 insertions(+), 47 deletions(-) diff --git a/gradle.properties b/gradle.properties index e2206dea..1b87ba4f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,10 @@ version_major=1 version_minor=7 version_micro=7 version_minecraft=1.9 -version_forge=12.16.0.1811-1.9 -version_minforge=12.16.0.1766 -version_mappings=snapshot_20160326 -version_lunatriuscore=1.1.2.33 +version_forge=12.16.0.1864-1.9 +version_minforge=12.16.0.1850 +version_mappings=snapshot_20160414 +version_lunatriuscore=1.1.2.34 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java index fedcc35f..547c6761 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java @@ -128,7 +128,7 @@ protected void reloadSchematics() { try { if (!this.currentDirectory.getCanonicalPath().equals(ConfigurationHandler.schematicDirectory.getCanonicalPath())) { - this.schematicFiles.add(new GuiSchematicEntry("..", Items.lava_bucket, 0, true)); + this.schematicFiles.add(new GuiSchematicEntry("..", Items.LAVA_BUCKET, 0, true)); } } catch (final IOException e) { Reference.logger.error("Failed to add GuiSchematicEntry!", e); @@ -146,7 +146,7 @@ protected void reloadSchematics() { name = file.getName(); final File[] files = file.listFiles(); - item = (files == null || files.length == 0) ? Items.bucket : Items.water_bucket; + item = (files == null || files.length == 0) ? Items.BUCKET : Items.WATER_BUCKET; this.schematicFiles.add(new GuiSchematicEntry(name, item, 0, file.isDirectory())); } @@ -154,7 +154,7 @@ protected void reloadSchematics() { final File[] filesSchematics = this.currentDirectory.listFiles(FILE_FILTER_SCHEMATIC); if (filesSchematics == null || filesSchematics.length == 0) { - this.schematicFiles.add(new GuiSchematicEntry(this.strNoSchematic, Blocks.dirt, 0, false)); + this.schematicFiles.add(new GuiSchematicEntry(this.strNoSchematic, Blocks.DIRT, 0, false)); } else { for (final File file : filesSchematics) { name = file.getName(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 19ce9afe..6a14396b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -30,8 +30,6 @@ import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import net.minecraftforge.event.ForgeEventFactory; -import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.fluids.BlockFluidBase; import java.util.ArrayList; @@ -344,9 +342,12 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, } private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack, final BlockPos pos, final EnumFacing side, final Vec3d hitVec, final EnumHand hand) { + // FIXME: where did this event go? + /* if (ForgeEventFactory.onPlayerInteract(player, Action.RIGHT_CLICK_BLOCK, world, pos, side, hitVec).isCanceled()) { return false; } + */ final EnumActionResult result = this.minecraft.playerController.processRightClickBlock(player, world, itemStack, pos, side, hitVec, hand); if ((result != EnumActionResult.SUCCESS)) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java index 371abf86..85568397 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/SyncRegistry.java @@ -23,8 +23,8 @@ public NBTSync getHandler(final Block block) { } static { - INSTANCE.register(Blocks.command_block, new NBTSyncCommandBlock()); - INSTANCE.register(Blocks.standing_sign, new NBTSyncSign()); - INSTANCE.register(Blocks.wall_sign, new NBTSyncSign()); + INSTANCE.register(Blocks.COMMAND_BLOCK, new NBTSyncCommandBlock()); + INSTANCE.register(Blocks.STANDING_SIGN, new NBTSyncSign()); + INSTANCE.register(Blocks.WALL_SIGN, new NBTSyncSign()); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index 44717fda..d4830986 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -288,27 +288,27 @@ public int getExtraClicks(final IBlockState blockState) { addPlacementMapping(BlockTorch.class, new PlacementData(blockFacingOpposite)); addPlacementMapping(BlockTrapDoor.class, new PlacementData(blockFacingOpposite).setOffsetY(offsetTrapDoor)); - addPlacementMapping(Blocks.anvil, new PlacementData(playerFacingRotateY)); - addPlacementMapping(Blocks.cocoa, new PlacementData(blockFacingSame)); - addPlacementMapping(Blocks.end_portal_frame, new PlacementData(playerFacingEntityOpposite)); - addPlacementMapping(Blocks.ladder, new PlacementData(blockFacingOpposite)); - addPlacementMapping(Blocks.lever, new PlacementData(playerFacingLever, blockFacingLever)); - addPlacementMapping(Blocks.quartz_block, new PlacementData(blockFacingQuartz)); - addPlacementMapping(Blocks.standing_sign, new PlacementData(playerFacingStandingSign)); - addPlacementMapping(Blocks.tripwire_hook, new PlacementData(blockFacingOpposite)); - addPlacementMapping(Blocks.wall_sign, new PlacementData(blockFacingOpposite)); - - addPlacementMapping(Items.comparator, new PlacementData(playerFacingEntityOpposite)); - addPlacementMapping(Items.repeater, new PlacementData(playerFacingEntityOpposite)); - - addPlacementMapping(Blocks.bed, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.end_portal, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.piston_extension, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.piston_head, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.portal, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.skull, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.standing_banner, new PlacementData(playerFacingIgnore)); - addPlacementMapping(Blocks.wall_banner, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.ANVIL, new PlacementData(playerFacingRotateY)); + addPlacementMapping(Blocks.COCOA, new PlacementData(blockFacingSame)); + addPlacementMapping(Blocks.END_PORTAL_FRAME, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(Blocks.LADDER, new PlacementData(blockFacingOpposite)); + addPlacementMapping(Blocks.LEVER, new PlacementData(playerFacingLever, blockFacingLever)); + addPlacementMapping(Blocks.QUARTZ_BLOCK, new PlacementData(blockFacingQuartz)); + addPlacementMapping(Blocks.STANDING_SIGN, new PlacementData(playerFacingStandingSign)); + addPlacementMapping(Blocks.TRIPWIRE_HOOK, new PlacementData(blockFacingOpposite)); + addPlacementMapping(Blocks.WALL_SIGN, new PlacementData(blockFacingOpposite)); + + addPlacementMapping(Items.COMPARATOR, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(Items.REPEATER, new PlacementData(playerFacingEntityOpposite)); + + addPlacementMapping(Blocks.BED, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.END_PORTAL, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.PISTON_EXTENSION, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.PISTON_HEAD, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.PORTAL, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.SKULL, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.STANDING_BANNER, new PlacementData(playerFacingIgnore)); + addPlacementMapping(Blocks.WALL_BANNER, new PlacementData(playerFacingIgnore)); } private PlacementData addPlacementMapping(final Class clazz, final PlacementData data) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 7d66b170..f2592215 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -329,7 +329,7 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.shadeModel(GL11.GL_SMOOTH); this.profiler.endStartSection("prepareterrain"); - this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); this.profiler.endStartSection("terrain_setup"); @@ -345,9 +345,9 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); renderBlockLayer(BlockRenderLayer.SOLID, partialTicks, PASS, entity); renderBlockLayer(BlockRenderLayer.CUTOUT_MIPPED, partialTicks, PASS, entity); - this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); renderBlockLayer(BlockRenderLayer.CUTOUT, partialTicks, PASS, entity); - this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); GlStateManager.disableBlend(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f); @@ -368,7 +368,7 @@ private void renderWorld(final float partialTicks, final long finishTimeNano) { GlStateManager.enableCull(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1f); - this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.depthMask(false); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java index ac6e23fb..874144fb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -22,7 +22,7 @@ public IBlockState getBlockState(final BlockPos pos) { final World world = this.minecraft.theWorld; if (!world.isAirBlock(realPos) && !ConfigurationHandler.isExtraAirBlock(world.getBlockState(realPos).getBlock())) { - return Blocks.air.getDefaultState(); + return Blocks.AIR.getDefaultState(); } return super.getBlockState(pos); diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 31a55303..02efe21b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -36,7 +36,7 @@ public List getList(final EntityPlayer player, final Schematic final IBlockState blockState = world.getBlockState(pos); final Block block = blockState.getBlock(); - if (block == Blocks.air || world.isAirBlock(pos)) { + if (block == Blocks.AIR || world.isAirBlock(pos)) { continue; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 8d727acc..73bd1a1a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -56,7 +56,7 @@ public SchematicWorld(final ISchematic schematic) { @Override public IBlockState getBlockState(final BlockPos pos) { if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { - return Blocks.air.getDefaultState(); + return Blocks.AIR.getDefaultState(); } return this.schematic.getBlockState(pos); @@ -120,7 +120,7 @@ public boolean isAirBlock(final BlockPos pos) { @Override public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { - return Biomes.jungle; + return Biomes.JUNGLE; } public int getWidth() { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 2a1f2389..50a3dfd5 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -238,7 +238,7 @@ private static void loadConfigurationGeneral() { extraAirBlockList.clear(); for (final String name : extraAirBlocks) { final Block block = BLOCK_REGISTRY.getObject(new ResourceLocation(name)); - if (block != Blocks.air) { + if (block != Blocks.AIR) { extraAirBlockList.add(block); } } diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index b2925f83..0e404866 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -133,7 +133,7 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, schematic.setTileEntity(localPos, reloadedTileEntity); } catch (final NBTConversionException nce) { Reference.logger.error("Error while trying to save tile entity '{}'!", tileEntity, nce); - schematic.setBlockState(localPos, Blocks.bedrock.getDefaultState()); + schematic.setBlockState(localPos, Blocks.BEDROCK.getDefaultState()); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 3ba53b72..46ad331f 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -163,7 +163,7 @@ public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic sch final Block block = blockState.getBlock(); Reference.logger.error("Block {}[{}] with TileEntity {} failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName(), e); } - localBlocks[index] = (byte) BLOCK_REGISTRY.getId(Blocks.bedrock); + localBlocks[index] = (byte) BLOCK_REGISTRY.getId(Blocks.BEDROCK); localMetadata[index] = 0; extraBlocks[index] = 0; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index 15d35287..4dd8b23a 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -17,7 +17,7 @@ import java.io.IOException; public final class SchematicUtil { - public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); + public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.GRASS); public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); public static final FMLControlledNamespacedRegistry ITEM_REGISTRY = GameData.getItemRegistry(); diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index cf03ffa2..a86c4117 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -17,7 +17,7 @@ import java.util.List; public class Schematic implements ISchematic { - private static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.grass); + private static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.GRASS); private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private ItemStack icon; @@ -42,7 +42,7 @@ public Schematic(final ItemStack icon, final int width, final int height, final @Override public IBlockState getBlockState(final BlockPos pos) { if (!isValid(pos)) { - return Blocks.air.getDefaultState(); + return Blocks.AIR.getDefaultState(); } final int x = pos.getX(); From 3dc91b4da329f5927e3489bbaa173800988fe901 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 7 May 2016 14:58:33 +0200 Subject: [PATCH 273/314] Override the default chunk render count to prevent excessive memory use. Closes #129 --- gradle.properties | 4 ++-- .../schematica/client/renderer/RenderSchematic.java | 4 ++-- .../client/renderer/chunk/OverlayRenderDispatcher.java | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1b87ba4f..61420146 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ version_major=1 version_minor=7 version_micro=7 version_minecraft=1.9 -version_forge=12.16.0.1864-1.9 -version_minforge=12.16.0.1850 +version_forge=12.16.1.1887 +version_minforge=12.16.0.1886 version_mappings=snapshot_20160414 version_lunatriuscore=1.1.2.34 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index f2592215..c8245a9f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -403,11 +403,11 @@ public void refresh() { public void loadRenderers() { if (this.world != null) { if (this.renderDispatcher == null) { - this.renderDispatcher = new ChunkRenderDispatcher(); + this.renderDispatcher = new ChunkRenderDispatcher(5); } if (this.renderDispatcherOverlay == null) { - this.renderDispatcherOverlay = new OverlayRenderDispatcher(); + this.renderDispatcherOverlay = new OverlayRenderDispatcher(5); } this.displayListEntitiesDirty = true; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java index 4217ebe1..aca49c0d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java @@ -12,6 +12,14 @@ import net.minecraft.util.BlockRenderLayer; public class OverlayRenderDispatcher extends ChunkRenderDispatcher { + public OverlayRenderDispatcher() { + super(); + } + + public OverlayRenderDispatcher(int countRenderBuilders) { + super(countRenderBuilders); + } + @Override public ListenableFuture uploadChunk(final BlockRenderLayer layer, final VertexBuffer buffer, final RenderChunk renderChunk, final CompiledChunk compiledChunk, final double distanceSq) { if (!Minecraft.getMinecraft().isCallingFromMinecraftThread() || OpenGlHelper.useVbo()) { From c04fabbeda9847dca824bc5995126c5504235091 Mon Sep 17 00:00:00 2001 From: Kamesuta Date: Wed, 30 Mar 2016 04:08:09 +0900 Subject: [PATCH 274/314] Add stack formatting and required amount to the material UI. --- .../control/GuiSchematicMaterialsSlot.java | 9 +- .../schematica/client/util/BlockList.java | 32 +++- .../lunatrius/schematica/reference/Names.java | 2 + .../assets/schematica/lang/en_US.lang | 2 + .../assets/schematica/lang/ja_JP.lang | 158 ++++++++++++++++++ 5 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/assets/schematica/lang/ja_JP.lang diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java index 1569ae4d..c84702eb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java @@ -2,10 +2,12 @@ import com.github.lunatrius.core.client.gui.GuiHelper; import com.github.lunatrius.schematica.client.util.BlockList; +import com.github.lunatrius.schematica.reference.Names; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; class GuiSchematicMaterialsSlot extends GuiSlot { @@ -13,6 +15,9 @@ class GuiSchematicMaterialsSlot extends GuiSlot { private final GuiSchematicMaterials guiSchematicMaterials; + private final String strMaterialAvailable = I18n.format(Names.Gui.Control.MATERIAL_AVAILABLE); + private final String strMaterialMissing = I18n.format(Names.Gui.Control.MATERIAL_MISSING); + protected int selectedIndex = -1; public GuiSchematicMaterialsSlot(final GuiSchematicMaterials par1) { @@ -56,11 +61,13 @@ protected void drawSlot(final int index, final int x, final int y, final int par final String itemName = wrappedItemStack.getItemStackDisplayName(); final String amount = wrappedItemStack.getFormattedAmount(); + final String amountMissing = wrappedItemStack.getFormattedAmountMissing(strMaterialAvailable, strMaterialMissing); GuiHelper.drawItemStackWithSlot(this.minecraft.renderEngine, itemStack, x, y); this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, itemName, x + 24, y + 6, 0xFFFFFF); - this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amount, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amount), y + 6, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amount, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amount), y + 1, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amountMissing, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amountMissing), y + 11, 0xFFFFFF); if (mouseX > x && mouseY > y && mouseX <= x + 18 && mouseY <= y + 18) { this.guiSchematicMaterials.renderToolTip(itemStack, mouseX, mouseY); diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 02efe21b..2a26c5ee 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.client.util; +import com.github.lunatrius.core.entity.EntityHelper; import com.github.lunatrius.core.util.math.BlockPosHelper; import com.github.lunatrius.core.util.math.MBlockPos; import com.github.lunatrius.schematica.block.state.BlockStateHelper; @@ -65,6 +66,14 @@ public List getList(final EntityPlayer player, final Schematic wrappedItemStack.total++; } + for (WrappedItemStack wrappedItemStack : blockList) { + if (player.capabilities.isCreativeMode) { + wrappedItemStack.inventory = -1; + } else { + wrappedItemStack.inventory = EntityHelper.getItemCountInInventory(player.inventory, wrappedItemStack.itemStack.getItem(), wrappedItemStack.itemStack.getItemDamage()); + } + } + return blockList; } @@ -84,6 +93,7 @@ public static class WrappedItemStack { public ItemStack itemStack; public int placed; public int total; + public int inventory; public WrappedItemStack(final ItemStack itemStack) { this(itemStack, 0, 0); @@ -101,7 +111,27 @@ public String getItemStackDisplayName() { public String getFormattedAmount() { final char color = this.placed < this.total ? 'c' : 'a'; - return String.format("\u00a7%c%d\u00a7r/%d", color, this.placed, this.total); + return String.format("\u00a7%c%s\u00a7r/%s", color, getFormattedStackAmount(itemStack, this.placed), getFormattedStackAmount(itemStack, this.total)); + } + + public String getFormattedAmountMissing(final String strAvailable, final String strMissing) { + final int need = this.total - (this.inventory + this.placed); + if (this.inventory != -1 && need > 0) { + return String.format("\u00a7c%s: %s", strMissing, getFormattedStackAmount(itemStack, need)); + } else { + return String.format("\u00a7a%s", strAvailable); + } + } + + private static String getFormattedStackAmount(final ItemStack itemStack, final int amount) { + final int stackSize = itemStack.getMaxStackSize(); + if (true /* amount < stackSize */) { + return String.format("%d", amount); + } else { + final int amountStack = amount / stackSize; + final int amountRemainder = amount % stackSize; + return String.format("%d(%d:%d)", amount, amountStack, amountRemainder); + } } } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 7a18064a..743e4a8b 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -173,6 +173,8 @@ public static final class Control { public static final String MATERIAL_NAME = "schematica.gui.materialname"; public static final String MATERIAL_AMOUNT = "schematica.gui.materialamount"; + public static final String MATERIAL_AVAILABLE = "schematica.gui.materialavailable"; + public static final String MATERIAL_MISSING = "schematica.gui.materialmissing"; public static final String SORT_PREFIX = "schematica.gui.material"; public static final String DUMP = "schematica.gui.materialdump"; diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index b0080352..a97760a9 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -39,6 +39,8 @@ schematica.gui.flip=Flip schematica.gui.rotate=Rotate schematica.gui.materialname=Material schematica.gui.materialamount=Amount +schematica.gui.materialavailable=Available +schematica.gui.materialmissing=Missing schematica.gui.materialdump=Save to file # gui - config - categories diff --git a/src/main/resources/assets/schematica/lang/ja_JP.lang b/src/main/resources/assets/schematica/lang/ja_JP.lang new file mode 100644 index 00000000..0e3a1b18 --- /dev/null +++ b/src/main/resources/assets/schematica/lang/ja_JP.lang @@ -0,0 +1,158 @@ +# gui - general +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: +schematica.gui.on=有効 +schematica.gui.off=無効 +schematica.gui.done=完了 + +# gui - general - load +schematica.gui.title=schematicを選択 +schematica.gui.folderInfo=(schematicファイルをここに配置) +schematica.gui.openFolder=フォルダを開く +schematica.gui.noschematic=-- schematicがありません -- + +# gui - general - save +schematica.gui.point.red=赤座標 +schematica.gui.point.blue=青座標 +schematica.gui.save=保存 +schematica.gui.saveselection=選択範囲の保存 + +# gui - general - control +schematica.gui.moveschematic=位置指定 +schematica.gui.materials=建材 +schematica.gui.printer=プリントモード +schematica.gui.operations=操作 +schematica.gui.unload=アンロード +schematica.gui.all=全表示 +schematica.gui.layers=レイヤー +schematica.gui.hide=非表示 +schematica.gui.show=表示 +schematica.gui.movehere=ここに移動 +schematica.gui.flip=反転 +schematica.gui.rotate=回転 +schematica.gui.materialname=建材 +schematica.gui.materialamount=量 +schematica.gui.materialavailable=準備完了 +schematica.gui.materialmissing=必要数 +schematica.gui.materialdump=ファイルに書き出し + +# gui - config - categories +schematica.config.category.debug=デバッグ用設定 +schematica.config.category.debug.tooltip=デバッグ/開発用の設定です\nよくわからない方は触らないでください +schematica.config.category.render=描画設定 +schematica.config.category.render.tooltip=描画関連の設定です +schematica.config.category.printer=プリントモード設定 +schematica.config.category.printer.tooltip=自動設置機能の設定です +schematica.config.category.printer.swapslots=ホットバースロット +schematica.config.category.printer.swapslots.tooltip=自動設置に使用してよいスロットを指定します +schematica.config.category.general=一般設定 +schematica.config.category.general.tooltip=一般的な設定です +schematica.config.category.server=サーバー用設定 +schematica.config.category.server.tooltip=サーバーサイドの設定です + +# gui - config - debug +schematica.config.showDebugInfo=デバッグ情報の表示 +schematica.config.showDebugInfo.tooltip=デバッグ画面(F3)で情報を表示します + +# gui - config - render +schematica.config.alphaEnabled=透明 +schematica.config.alphaEnabled.tooltip=半透明テクスチャを有効にします +schematica.config.alpha=透明度 +schematica.config.alpha.tooltip=描画の際の透明度を指定します (1.0 = 不透明, 0.5 = 半透明, 0.0 = 透明) +schematica.config.highlight=ブロックのハイライト +schematica.config.highlight.tooltip=別のブロックであるべきブロックを強調表示します +schematica.config.highlightAir=空気のハイライト +schematica.config.highlightAir.tooltip=空気であるべきブロックを強調表示します +schematica.config.blockDelta=ブロック拡大率 +schematica.config.blockDelta.tooltip=ハイライトの際のブロックの拡張率を指定します (ハイライトにちらつきを感じた場合に増やしてください). + +# gui - config - printer +schematica.config.placeDelay=設置遅延 +schematica.config.placeDelay.tooltip=設置と設置の間に何tick遅延するかを指定します +schematica.config.timeout=タイムアウト +schematica.config.timeout.tooltip=何回設置に失敗したらあきらめるかを指定します +schematica.config.placeInstantly=同時設置 +schematica.config.placeInstantly.tooltip=1tickで置くことのできるすべてのブロックを設置します +schematica.config.destroyBlocks=ブロック破壊 +schematica.config.destroyBlocks.tooltip=クリエイティブモードにおいて、ブロックの破壊をします +schematica.config.destroyInstantly=同時破壊 +schematica.config.destroyInstantly.tooltip=1tickで壊すのできるすべてのブロックを破壊します +schematica.config.placeAdjacent=隣接設置 +schematica.config.placeAdjacent.tooltip=隣にブロックがある場合のみ設置します + +# gui - config - printer - swap slots +schematica.config.swapSlot0=第1スロットの使用 +schematica.config.swapSlot0.tooltip=プリントモードでホットバー1番目のスロットの使用を許可します +schematica.config.swapSlot1=第2スロットの使用 +schematica.config.swapSlot1.tooltip=プリントモードでホットバー2番目のスロットの使用を許可します +schematica.config.swapSlot2=第3スロットの使用 +schematica.config.swapSlot2.tooltip=プリントモードでホットバー3番目のスロットの使用を許可します +schematica.config.swapSlot3=第4スロットの使用 +schematica.config.swapSlot3.tooltip=プリントモードでホットバー4番目のスロットの使用を許可します +schematica.config.swapSlot4=第5スロットの使用 +schematica.config.swapSlot4.tooltip=プリントモードでホットバー5番目のスロットの使用を許可します +schematica.config.swapSlot5=第6スロットの使用 +schematica.config.swapSlot5.tooltip=プリントモードでホットバー6番目のスロットの使用を許可します +schematica.config.swapSlot6=第7スロットの使用 +schematica.config.swapSlot6.tooltip=プリントモードでホットバー7番目のスロットの使用を許可します +schematica.config.swapSlot7=第8スロットの使用 +schematica.config.swapSlot7.tooltip=プリントモードでホットバー8番目のスロットの使用を許可します +schematica.config.swapSlot8=第9スロットの使用 +schematica.config.swapSlot8.tooltip=プリントモードでホットバー9番目のスロットの使用を許可します + +# gui - config - general +schematica.config.schematicDirectory=Schematicフォルダ +schematica.config.schematicDirectory.tooltip=Schematicの保存場所を指定します +schematica.config.extraAirBlocks=特殊な空気ブロック +schematica.config.extraAirBlocks.tooltip=空気ブロックとして扱うブロックを指定します + +# gui - config - server +schematica.config.printerEnabled=プリントモードの可否 +schematica.config.printerEnabled.tooltip=プレイヤーがプリントモードを使うことを許可します +schematica.config.saveEnabled=保存の可否 +schematica.config.saveEnabled.tooltip=プレイヤーがschematicを保存することを許可します +schematica.config.loadEnabled=読み込みの可否 +schematica.config.loadEnabled.tooltip=プレイヤーがschematicを読み込むことを許可します + +# keys +schematica.key.category=Schematica +schematica.key.load=読み込み画面 +schematica.key.save=保存画面 +schematica.key.control=操作画面 +schematica.key.layerInc=次のレイヤーへ +schematica.key.layerDec=前のレイヤーへ + +# commands - save +schematica.command.save.usage=/schematicaSave <名前> +schematica.command.save.playersOnly=このコマンドはプレイヤーだけが使えます +schematica.command.save.started=「%2$s」へ%1$dチャンクのデータを保存中... +schematica.command.save.saveSucceeded=「%s」の保存が完了しました +schematica.command.save.saveFailed=「%s」の保存中に問題が発生しました +schematica.command.save.quotaExceeded=サーバーに保存できる容量を超えてしまったので /schematicaList と /schematicaRemove を使っていくつかのschematicを消去してください +schematica.command.save.playerSchematicDirUnavailable=サーバー側で問題が発生してしまい、保存することができませんでした。サーバー管理者に連絡してください。 + +# commands - list +schematica.command.list.usage=/schematicaList [ページ] +schematica.command.list.notAvailable=schematicリストの受信中に問題が発生しました +schematica.command.list.remove=削除 +schematica.command.list.download=ダウンロード +schematica.command.list.header=--- %2$dページ中%1$dページ --- +schematica.command.list.noSuchPage=指定のページは存在しません +schematica.command.list.noSchematics=ご利用可能なschematicファイルがありません + +# commands - remove +schematica.command.remove.usage=/schematicaRemove <名前> +schematica.command.remove.schematicRemoved=Schematic「%s」は消去されました +schematica.command.remove.schematicNotFound=Schematic「"%s"」は見つかりませんでした +schematica.command.remove.areYouSure=本当に消去してよろしいですか? + +# commands - download +schematica.command.download.usage=/schematicaDownload <名前> +schematica.command.download.started=「%s」をダウンロード中... +schematica.command.download.downloadSucceeded=「%s」のダウンロードが完了しました +schematica.command.download.downloadFail=ダウンロード失敗 + +# commands - replace + +# messages From d3cc5600dce478ce6c0a52871c0b3ae18e9f4f30 Mon Sep 17 00:00:00 2001 From: RedNesto Date: Mon, 30 May 2016 17:57:30 +0200 Subject: [PATCH 275/314] Update French translation --- .../assets/schematica/lang/fr_FR.lang | 124 +++++++++++++++++- 1 file changed, 121 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_FR.lang index d044c470..5474bacb 100644 --- a/src/main/resources/assets/schematica/lang/fr_FR.lang +++ b/src/main/resources/assets/schematica/lang/fr_FR.lang @@ -1,8 +1,16 @@ # gui - general -schematica.gui.x=X : -schematica.gui.y=Y : -schematica.gui.z=Z : +schematica.gui.x=X: +schematica.gui.y=Y: +schematica.gui.z=Z: +schematica.gui.on=ON +schematica.gui.off=OFF schematica.gui.done=Terminé +schematica.gui.down=Bas +schematica.gui.up=Haut +schematica.gui.north=Nord +schematica.gui.south=Sud +schematica.gui.west=Ouest +schematica.gui.east=Est # gui - general - load schematica.gui.title=Sélectionner un schematic @@ -21,6 +29,7 @@ schematica.gui.moveschematic=Déplacer le schematic schematica.gui.materials=Matériaux schematica.gui.printer=Mode imprimante schematica.gui.operations=Opérations +schematica.gui.unload=Décharger schematica.gui.all=TOUTES schematica.gui.layers=Couches schematica.gui.hide=Cacher @@ -30,34 +39,143 @@ schematica.gui.flip=Retourner schematica.gui.rotate=Pivoter schematica.gui.materialname=Matériau schematica.gui.materialamount=Quantité +schematica.gui.materialavailable=Disponible +schematica.gui.materialmissing=Manquant +schematica.gui.materialdump=Enregistrer dans un fichier # gui - config - categories +schematica.config.category.debug=Debug +schematica.config.category.debug.tooltip=Debug/paramètres développeur.\nN'y touchez pas si vous ne savez pas ce que vous faites. +schematica.config.category.render=Rendu +schematica.config.category.render.tooltip=Paramètres de rendu. +schematica.config.category.printer=Mode imprimante +schematica.config.category.printer.tooltip=Paramètres du mode imprimante. +schematica.config.category.printer.swapslots=Slots de la Hotbar +schematica.config.category.printer.swapslots.tooltip=Autorise le mode imprimante à utiliser des slots de la Hotbar non vides. +schematica.config.category.general=Général +schematica.config.category.general.tooltip=Paramètres généraux. +schematica.config.category.server=Serveur +schematica.config.category.server.tooltip=Paramètres côté serveur. # gui - config - debug +schematica.config.dumpBlockList=Vider la liste des Blocks +schematica.config.dumpBlockList.tooltip=Vide tous les états de blocks au démarrage. +schematica.config.showDebugInfo=Afficher les informations de debug +schematica.config.showDebugInfo.tooltip=Affiche des informations supplémentaires sur l'écran de debug (F3). # gui - config - render +schematica.config.alphaEnabled=Alpha activée +schematica.config.alphaEnabled.tooltip=Active les textures transparentes. +schematica.config.alpha=Alpha +schematica.config.alpha.tooltip=Valeur Alpha lors du rendu du schematic (1.0 = opaque, 0.5 = moitié transparent, 0.0 = transparent). +schematica.config.highlight=Surligner les Blocks +schematica.config.highlight.tooltip=Surligne les blocks placé s invalides et les blocks à placer. +schematica.config.highlightAir=Surligner l'Air +schematica.config.highlightAir.tooltip=Surligne les blocks qui doivent être de l'air. +schematica.config.blockDelta=Block Delta +schematica.config.blockDelta.tooltip=Valeur Delta utilisée pour le surlignage (à augmenter si vous rencontrez un z-fighting). +schematica.config.renderDistance=Distance de Rendu +schematica.config.renderDistance.tooltip=Distance de rendu du schematic. # gui - config - printer +schematica.config.placeDelay=Délai de Placement +schematica.config.placeDelay.tooltip=Délai entre chaque placement (en ticks). +schematica.config.timeout=Timeout +schematica.config.timeout.tooltip=Temps avant de réessayer les bocks ratés. +schematica.config.placeDistance=Distance de Placement +schematica.config.placeDistance.tooltip=Distance maximale de placement. +schematica.config.placeInstantly=Placement Instantané +schematica.config.placeInstantly.tooltip=Place tous les blocks pouvant être placés en un tick. +schematica.config.destroyBlocks=Desctruction de Blocks +schematica.config.destroyBlocks.tooltip=Le mode imprimante pourra détruire les blocks (mode créatif seulement). +schematica.config.destroyInstantly=Destruction instantanée +schematica.config.destroyInstantly.tooltip=Détruit tous les blocks pouvant être détruits en un tick. +schematica.config.placeAdjacent=Placer Seulement les Adjacents +schematica.config.placeAdjacent.tooltip=Place les blocks seulement s'il y a un block adjacent à côté d'eux. # gui - config - printer - swap slots +schematica.config.swapSlot0=Autoriser le Slot 1 +schematica.config.swapSlot0.tooltip=Autorise le mode imprimante à utiliser le slot 1 de la hotbar. +schematica.config.swapSlot1=Autoriser le Slot 2 +schematica.config.swapSlot1.tooltip=Autorise le mode imprimante à utiliser le slot 2 de la hotbar. +schematica.config.swapSlot2=Autoriser le Slot 3 +schematica.config.swapSlot2.tooltip=Autorise le mode imprimante à utiliser le slot 3 de la hotbar. +schematica.config.swapSlot3=Autoriser le Slot 4 +schematica.config.swapSlot3.tooltip=Autorise le mode imprimante à utiliser le slot 4 de la hotbar. +schematica.config.swapSlot4=Autoriser le Slot 5 +schematica.config.swapSlot4.tooltip=Autorise le mode imprimante à utiliser le slot 5 de la hotbar. +schematica.config.swapSlot5=Autoriser le Slot 6 +schematica.config.swapSlot5.tooltip=Autorise le mode imprimante à utiliser le slot 6 de la hotbar. +schematica.config.swapSlot6=Autoriser le Slot 7 +schematica.config.swapSlot6.tooltip=Autorise le mode imprimante à utiliser le slot 7 de la hotbar. +schematica.config.swapSlot7=Autoriser le Slot 8 +schematica.config.swapSlot7.tooltip=Autorise le mode imprimante à utiliser le slot 8 de la hotbar. +schematica.config.swapSlot8=Autoriser le Slot 9 +schematica.config.swapSlot8.tooltip=Autorise le mode imprimante à utiliser le slot 9 de la hotbar. # gui - config - general +schematica.config.schematicDirectory=Dossier des Schematics +schematica.config.schematicDirectory.tooltip=Le dossier des schematics. +schematica.config.extraAirBlocks=Blocks d'Air supplémentaires +schematica.config.extraAirBlocks.tooltip=Blocks supplémentaires à considérer comme de l'air pour le rendu du schematic. # gui - config - server +schematica.config.printerEnabled=Autoriser le Mode imprimante +schematica.config.printerEnabled.tooltip=Autorise les joueurs à utiliser le mode imprimante. +schematica.config.saveEnabled=Autoriser la Sauvegarde +schematica.config.saveEnabled.tooltip=Autorise les joueurs à sauvegarder des schematics. +schematica.config.loadEnabled=Autoriser le Chargement +schematica.config.loadEnabled.tooltip=Autorise les joueurs à charger des schematics. # keys +schematica.key.category=Schematica schematica.key.load=Charger un schematic schematica.key.save=Enregistrer le schematic schematica.key.control=Manipuler le schematic +schematica.key.layerInc=Couche suivante +schematica.key.layerDec=Couche précédente +schematica.key.layerToggle=Activer le Mode Tout/Couche +schematica.key.renderToggle=Activer le Rendu +schematica.key.printerToggle=Activer le Mode imprimante +schematica.key.moveHere=Bouger ici # commands - save +schematica.command.save.usage=/schematicaSave +schematica.command.save.playersOnly=Cette commande ne peut être utilisée que par les joueurs. +schematica.command.save.started=Début de la sauvegarde de %d chunks dans %s. +schematica.command.save.saveSucceeded=%s sauvegardé avec succès. +schematica.command.save.saveFailed=Un problème est survenu lors de la sauvegarde du schematic %s. +schematica.command.save.quotaExceeded=Vous avez dépassé votre quota sur ce serveur. Veuillez utiliser /schematicaList et /schematicaRemove pour supprimer d'anciens schematics. +schematica.command.save.playerSchematicDirUnavailable=Il y a eu un problème sur le serveur et le schematic n'a pas été sauvegardé. Veuillez contacter l'administrateur du serveur. # commands - list +schematica.command.list.usage=/schematicaList [page] +schematica.command.list.notAvailable=Il y a eu un problème lors de la récupération de la liste des schematics. +schematica.command.list.remove=Supprimer +schematica.command.list.download=Télécharger +schematica.command.list.header=--- Affichage des Schematics page %d sur %d --- +schematica.command.list.noSuchPage=Aucune page +schematica.command.list.noSchematics=Vous n'avez aucun schematic de disponible. # commands - remove +schematica.command.remove.usage=/schematicaRemove +schematica.command.remove.schematicRemoved=Schematic "%s" supprimé. +schematica.command.remove.schematicNotFound=Schematic "%s" n'a pas été trouvé. +schematica.command.remove.areYouSure=Êtes vous sûr? # commands - download +schematica.command.download.usage=/schematicaDownload +schematica.command.download.started=Début du téléchargement de %s... +schematica.command.download.downloadSucceeded=%s téléchargé avec succès. +schematica.command.download.downloadFail=Téléchargement échoué. # commands - replace +schematica.command.replace.usage=/schematicaReplace +schematica.command.replace.noSchematic=Vous n'avez pas de schematic chargé. +schematica.command.replace.success=%s blocks remplacés. # messages +schematica.message.togglePrinter=Mode imprimante: %s +schematica.message.invalidBlock="%s" n'existe pas. +schematica.message.invalidProperty="%s" n'est pas une propriété valide. +schematica.message.invalidPropertyForBlock="%s" n'est pas une propriété valide pour "%s". From dd8261ff56bb1dca47b26dd9060a8e1b638da1b6 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 5 Jun 2016 14:53:22 +0200 Subject: [PATCH 276/314] Update to 1.9.4. Fix the overlay not rendering properly. --- build.gradle | 2 +- gradle.properties | 10 ++++---- .../client/printer/SchematicPrinter.java | 2 +- .../client/printer/nbtsync/NBTSync.java | 6 ++--- .../client/renderer/RenderSchematic.java | 18 +++++++------- .../client/renderer/SchematicRenderCache.java | 4 ++-- .../client/renderer/ViewFrustumOverlay.java | 5 ++-- .../overlay/ISchematicRenderChunkFactory.java | 3 +-- .../renderer/chunk/overlay/RenderOverlay.java | 24 +++++++++---------- .../chunk/overlay/RenderOverlayList.java | 2 +- .../chunk/proxy/SchematicRenderChunkList.java | 6 ++--- .../chunk/proxy/SchematicRenderChunkVbo.java | 8 +++---- .../client/world/SchematicWorld.java | 4 ++-- .../world/chunk/ChunkProviderSchematic.java | 4 ++-- .../schematica/handler/QueueTickHandler.java | 2 +- .../lunatrius/schematica/nbt/NBTHelper.java | 3 +-- 16 files changed, 50 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index 9577b50c..654c8c85 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT' } } diff --git a/gradle.properties b/gradle.properties index 61420146..c72425f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=7 -version_minecraft=1.9 -version_forge=12.16.1.1887 -version_minforge=12.16.0.1886 -version_mappings=snapshot_20160414 -version_lunatriuscore=1.1.2.34 +version_minecraft=1.9.4 +version_forge=12.17.0.1937 +version_minforge=12.17.0.1908 +version_mappings=snapshot_20160601 +version_lunatriuscore=1.1.2.35 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 6a14396b..278dec7f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -360,7 +360,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, private void syncSneaking(final EntityPlayerSP player, final boolean isSneaking) { player.setSneaking(isSneaking); - player.sendQueue.addToSendQueue(new CPacketEntityAction(player, isSneaking ? CPacketEntityAction.Action.START_SNEAKING : CPacketEntityAction.Action.STOP_SNEAKING)); + player.connection.sendPacket(new CPacketEntityAction(player, isSneaking ? CPacketEntityAction.Action.START_SNEAKING : CPacketEntityAction.Action.STOP_SNEAKING)); } private boolean swapToItem(final InventoryPlayer inventory, final ItemStack itemStack) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java index 22a334eb..ae0b8d90 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/nbtsync/NBTSync.java @@ -14,12 +14,12 @@ public abstract class NBTSync { public abstract boolean execute(final EntityPlayer player, final World schematic, final BlockPos pos, final World mcWorld, final BlockPos mcPos); public final boolean sendPacket(final Packet packet) { - final NetHandlerPlayClient netHandler = this.minecraft.getNetHandler(); - if (netHandler == null) { + final NetHandlerPlayClient connection = this.minecraft.getConnection(); + if (connection == null) { return false; } - netHandler.addToSendQueue(packet); + connection.sendPacket(packet); return true; } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index c8245a9f..33fb0785 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -136,13 +136,13 @@ private void initVbo() { this.renderContainer = new SchematicChunkRenderContainerVbo(); this.renderChunkFactory = new ISchematicRenderChunkFactory() { @Override - public RenderChunk makeRenderChunk(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - return new SchematicRenderChunkVbo(world, renderGlobal, pos, index); + public RenderChunk create(final World world, final RenderGlobal renderGlobal, final int index) { + return new SchematicRenderChunkVbo(world, renderGlobal, index); } @Override - public RenderOverlay makeRenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - return new RenderOverlay(world, renderGlobal, pos, index); + public RenderOverlay makeRenderOverlay(final World world, final RenderGlobal renderGlobal, final int index) { + return new RenderOverlay(world, renderGlobal, index); } }; } @@ -151,13 +151,13 @@ private void initList() { this.renderContainer = new SchematicChunkRenderContainerList(); this.renderChunkFactory = new ISchematicRenderChunkFactory() { @Override - public RenderChunk makeRenderChunk(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - return new SchematicRenderChunkList(world, renderGlobal, pos, index); + public RenderChunk create(final World world, final RenderGlobal renderGlobal, final int index) { + return new SchematicRenderChunkList(world, renderGlobal, null, index); } @Override - public RenderOverlay makeRenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - return new RenderOverlayList(world, renderGlobal, pos, index); + public RenderOverlay makeRenderOverlay(final World world, final RenderGlobal renderGlobal, final int index) { + return new RenderOverlayList(world, renderGlobal, null, index); } }; } @@ -916,7 +916,7 @@ public void deleteAllDisplayLists() {} public void broadcastSound(final int soundID, final BlockPos pos, final int data) {} @Override - public void playAuxSFX(final EntityPlayer player, final int sfxType, final BlockPos pos, final int data) {} + public void playEvent(final EntityPlayer player, final int type, final BlockPos pos, final int data) {} @Override public void sendBlockBreakProgress(final int breakerId, final BlockPos pos, final int progress) {} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java index 874144fb..5b3d93a5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -4,12 +4,12 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.World; -public class SchematicRenderCache extends RegionRenderCache { +public class SchematicRenderCache extends ChunkCache { private final Minecraft minecraft = Minecraft.getMinecraft(); public SchematicRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java index 149947f6..b1d001a4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java @@ -28,8 +28,7 @@ protected void createRenderOverlays(final ISchematicRenderChunkFactory renderChu for (int y = 0; y < this.countChunksY; y++) { for (int z = 0; z < this.countChunksZ; z++) { final int index = (z * this.countChunksY + y) * this.countChunksX + x; - final BlockPos pos = new BlockPos(x * 16, y * 16, z * 16); - this.renderOverlays[index] = renderChunkFactory.makeRenderOverlay(this.world, this.renderGlobal, pos, count++); + this.renderOverlays[index] = renderChunkFactory.makeRenderOverlay(this.world, this.renderGlobal, count++); } } } @@ -64,7 +63,7 @@ public void updateChunkPositions(final double viewEntityX, final double viewEnti final BlockPos blockpos = new BlockPos(x, y, z); if (!blockpos.equals(renderOverlay.getPosition())) { - renderOverlay.setPosition(blockpos); + renderOverlay.setOrigin(x, y, z); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java index 041920ed..c2e99f4f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/ISchematicRenderChunkFactory.java @@ -2,9 +2,8 @@ import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.IRenderChunkFactory; -import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ISchematicRenderChunkFactory extends IRenderChunkFactory { - RenderOverlay makeRenderOverlay(World world, RenderGlobal renderGlobal, BlockPos pos, int index); + RenderOverlay makeRenderOverlay(World world, RenderGlobal renderGlobal, int index); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 070ddbfb..a67a6c17 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -9,7 +9,6 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; @@ -20,14 +19,15 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; public class RenderOverlay extends RenderChunk { private final VertexBuffer vertexBuffer; - public RenderOverlay(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - super(world, renderGlobal, pos, index); + public RenderOverlay(final World world, final RenderGlobal renderGlobal, final int index) { + super(world, renderGlobal, index); this.vertexBuffer = OpenGlHelper.useVbo() ? new VertexBuffer(DefaultVertexFormats.POSITION_COLOR) : null; } @@ -42,7 +42,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final BlockPos from = getPosition(); final BlockPos to = from.add(15, 15, 15); generator.getLock().lock(); - RegionRenderCache regionRenderCache; + ChunkCache chunkCache; final SchematicWorld schematic = (SchematicWorld) this.world; try { @@ -55,7 +55,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun return; } - regionRenderCache = new RegionRenderCache(this.world, from.add(-1, -1, -1), to.add(1, 1, 1), 1); + chunkCache = new ChunkCache(this.world, from.add(-1, -1, -1), to.add(1, 1, 1), 1); generator.setCompiledChunk(compiledOverlay); } finally { generator.getLock().unlock(); @@ -63,7 +63,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final VisGraph visgraph = new VisGraph(); - if (!regionRenderCache.extendedLevelsInChunkCache()) { + if (!chunkCache.extendedLevelsInChunkCache()) { ++renderChunksUpdated; final World mcWorld = Minecraft.getMinecraft().theWorld; @@ -146,27 +146,27 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } private int getSides(final IBlockState blockState, final Block block, final World world, final BlockPos pos, int sides) { - if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.DOWN), EnumFacing.DOWN)) { + if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.DOWN)) { sides |= GeometryMasks.Quad.DOWN; } - if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.UP), EnumFacing.UP)) { + if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.UP)) { sides |= GeometryMasks.Quad.UP; } - if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.NORTH), EnumFacing.NORTH)) { + if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.NORTH)) { sides |= GeometryMasks.Quad.NORTH; } - if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.SOUTH), EnumFacing.SOUTH)) { + if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.SOUTH)) { sides |= GeometryMasks.Quad.SOUTH; } - if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.WEST), EnumFacing.WEST)) { + if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.WEST)) { sides |= GeometryMasks.Quad.WEST; } - if (block.shouldSideBeRendered(blockState, world, pos.offset(EnumFacing.EAST), EnumFacing.EAST)) { + if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.EAST)) { sides |= GeometryMasks.Quad.EAST; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java index c7ffc4f2..bbdca18c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlayList.java @@ -11,7 +11,7 @@ public class RenderOverlayList extends RenderOverlay { private final int displayList = GLAllocation.generateDisplayLists(1); public RenderOverlayList(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - super(world, renderGlobal, pos, index); + super(world, renderGlobal, index); } public int getDisplayList(final BlockRenderLayer layer, final CompiledChunk compiledChunk) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java index 87434ecb..4a2c0812 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -2,13 +2,13 @@ import com.github.lunatrius.schematica.client.renderer.SchematicRenderCache; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.ListedRenderChunk; import net.minecraft.client.renderer.chunk.SetVisibility; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -16,7 +16,7 @@ @SideOnly(Side.CLIENT) public class SchematicRenderChunkList extends ListedRenderChunk { public SchematicRenderChunkList(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - super(world, renderGlobal, pos, index); + super(world, renderGlobal, index); } @Override @@ -47,7 +47,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } @Override - protected RegionRenderCache createRegionRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { + protected ChunkCache createRegionRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { return new SchematicRenderCache(world, from, to, subtract); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java index 0129be80..e8782962 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -2,21 +2,21 @@ import com.github.lunatrius.schematica.client.renderer.SchematicRenderCache; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.client.renderer.chunk.SetVisibility; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ChunkCache; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class SchematicRenderChunkVbo extends RenderChunk { - public SchematicRenderChunkVbo(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { - super(world, renderGlobal, pos, index); + public SchematicRenderChunkVbo(final World world, final RenderGlobal renderGlobal, final int index) { + super(world, renderGlobal, index); } @Override @@ -47,7 +47,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun } @Override - protected RegionRenderCache createRegionRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { + protected ChunkCache createRegionRenderCache(final World world, final BlockPos from, final BlockPos to, final int subtract) { return new SchematicRenderCache(world, from, to, subtract); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 73bd1a1a..371a1b9b 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -22,7 +22,7 @@ import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -119,7 +119,7 @@ public boolean isAirBlock(final BlockPos pos) { } @Override - public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { + public Biome getBiome(final BlockPos pos) { return Biomes.JUNGLE; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index 77473de3..631bae03 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -1,7 +1,7 @@ package com.github.lunatrius.schematica.client.world.chunk; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.EmptyChunk; import net.minecraft.world.chunk.IChunkProvider; @@ -34,7 +34,7 @@ public Chunk getLoadedChunk(final int x, final int z) { return this.emptyChunk; } - final long key = ChunkCoordIntPair.chunkXZ2Int(x, z); + final long key = ChunkPos.chunkXZ2Int(x, z); ChunkSchematic chunk = this.chunks.get(key); if (chunk == null) { diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 89aa95dd..73a94472 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -29,7 +29,7 @@ public void onClientTick(final TickEvent.ClientTickEvent event) { // TODO: find a better way... maybe? try { final EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - if (player != null && player.sendQueue != null && !player.sendQueue.getNetworkManager().isLocalChannel()) { + if (player != null && player.connection != null && !player.connection.getNetworkManager().isLocalChannel()) { processQueue(); } } catch (final Exception e) { diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index 77565952..cd6e533a 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -143,8 +143,7 @@ public static NBTTagCompound writeTileEntityToCompound(final TileEntity tileEnti } public static TileEntity readTileEntityFromCompound(final NBTTagCompound tileEntityCompound) { - // FIXME: the server is currently not used, but might be in the future... - return TileEntity.createTileEntity(null, tileEntityCompound); + return TileEntity.create(tileEntityCompound); } public static NBTTagCompound writeEntityToCompound(final Entity entity) { From 9a8907bda1364ce1cb009d45c2757831a1528c05 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 5 Jun 2016 18:40:08 +0200 Subject: [PATCH 277/314] Add a separate pick block key binding. --- .../handler/client/InputHandler.java | 63 +++++++------------ .../lunatrius/schematica/reference/Names.java | 1 + 2 files changed, 23 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 92a48488..20c04de5 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -8,7 +8,6 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; -import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.resources.I18n; @@ -16,6 +15,8 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.text.TextComponentTranslation; +import net.minecraftforge.client.settings.KeyConflictContext; +import net.minecraftforge.client.settings.KeyModifier; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent; @@ -33,6 +34,7 @@ public class InputHandler { private static final KeyBinding KEY_BINDING_RENDER_TOGGLE = new KeyBinding(Names.Keys.RENDER_TOGGLE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_PRINTER_TOGGLE = new KeyBinding(Names.Keys.PRINTER_TOGGLE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); private static final KeyBinding KEY_BINDING_MOVE_HERE = new KeyBinding(Names.Keys.MOVE_HERE, Keyboard.KEY_NONE, Names.Keys.CATEGORY); + private static final KeyBinding KEY_BINDING_PICK_BLOCK = new KeyBinding(Names.Keys.PICK_BLOCK, KeyConflictContext.IN_GAME, KeyModifier.SHIFT, -98, Names.Keys.CATEGORY); public static final KeyBinding[] KEY_BINDINGS = new KeyBinding[] { KEY_BINDING_LOAD, @@ -43,7 +45,8 @@ public class InputHandler { KEY_BINDING_LAYER_TOGGLE, KEY_BINDING_RENDER_TOGGLE, KEY_BINDING_PRINTER_TOGGLE, - KEY_BINDING_MOVE_HERE + KEY_BINDING_MOVE_HERE, + KEY_BINDING_PICK_BLOCK }; private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -112,58 +115,36 @@ public void onKeyInput(final InputEvent event) { } } - handlePickBlock(); - } - } - - private void handlePickBlock() { - final KeyBinding keyPickBlock = this.minecraft.gameSettings.keyBindPickBlock; - if (keyPickBlock.isPressed()) { - try { + if (KEY_BINDING_PICK_BLOCK.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - boolean revert = true; - if (schematic != null && schematic.isRendering) { - revert = pickBlock(schematic, ClientProxy.objectMouseOver); + pickBlock(schematic, ClientProxy.objectMouseOver); } - - if (revert) { - KeyBinding.onTick(keyPickBlock.getKeyCode()); - } - } catch (final Exception e) { - Reference.logger.error("Could not pick block!", e); } } } private boolean pickBlock(final SchematicWorld schematic, final RayTraceResult objectMouseOver) { - boolean revert = false; - // Minecraft.func_147112_ai - if (objectMouseOver != null) { - final EntityPlayerSP player = this.minecraft.thePlayer; - - if (objectMouseOver.typeOfHit == RayTraceResult.Type.MISS) { - revert = true; - } + if (objectMouseOver == null) { + return false; + } - final RayTraceResult mcObjectMouseOver = this.minecraft.objectMouseOver; - if (mcObjectMouseOver != null && mcObjectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) { - if (mcObjectMouseOver.getBlockPos().subtract(schematic.position).equals(objectMouseOver.getBlockPos())) { - return true; - } - } + if (objectMouseOver.typeOfHit == RayTraceResult.Type.MISS) { + return false; + } - if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { - return revert; - } + final EntityPlayerSP player = this.minecraft.thePlayer; + if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { + return true; + } - if (player.capabilities.isCreativeMode) { - final int slot = player.inventoryContainer.inventorySlots.size() - 9 + player.inventory.currentItem; - this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); - } + if (player.capabilities.isCreativeMode) { + final int slot = player.inventoryContainer.inventorySlots.size() - 10 + player.inventory.currentItem; + this.minecraft.playerController.sendSlotPacket(player.inventory.getStackInSlot(player.inventory.currentItem), slot); + return true; } - return revert; + return false; } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 743e4a8b..d6bf3930 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -203,6 +203,7 @@ public static final class Keys { public static final String RENDER_TOGGLE = "schematica.key.renderToggle"; public static final String PRINTER_TOGGLE = "schematica.key.printerToggle"; public static final String MOVE_HERE = "schematica.key.moveHere"; + public static final String PICK_BLOCK = "key.pickItem"; } public static final class NBT { From 2f07b41850b37a3534eb26daa0cc9343fc29a123 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 5 Jun 2016 18:40:51 +0200 Subject: [PATCH 278/314] Bump the version number. --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c72425f1..b3405b5f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version_major=1 version_minor=7 -version_micro=7 +version_micro=8 version_minecraft=1.9.4 version_forge=12.17.0.1937 version_minforge=12.17.0.1908 From 7cd5020faaa15ad81c23d08a90e80bbd5e4ccb10 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 2 Jul 2016 15:40:12 +0200 Subject: [PATCH 279/314] Fix a key binding conflict with vanilla. Fixes gh-158 --- .../java/com/github/lunatrius/schematica/reference/Names.java | 2 +- src/main/resources/assets/schematica/lang/en_US.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index d6bf3930..41846b5f 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -203,7 +203,7 @@ public static final class Keys { public static final String RENDER_TOGGLE = "schematica.key.renderToggle"; public static final String PRINTER_TOGGLE = "schematica.key.printerToggle"; public static final String MOVE_HERE = "schematica.key.moveHere"; - public static final String PICK_BLOCK = "key.pickItem"; + public static final String PICK_BLOCK = "schematica.key.pickBlock"; } public static final class NBT { diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_US.lang index a97760a9..dd748f5d 100644 --- a/src/main/resources/assets/schematica/lang/en_US.lang +++ b/src/main/resources/assets/schematica/lang/en_US.lang @@ -138,6 +138,7 @@ schematica.key.layerToggle=Toggle All/Layer Mode schematica.key.renderToggle=Toggle Rendering schematica.key.printerToggle=Toggle Printer schematica.key.moveHere=Move here +schematica.key.pickBlock=Pick Block # commands - save schematica.command.save.usage=/schematicaSave From 2fe4b062b43d691766e1c8d16d379bded3f6a6d7 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 3 Jul 2016 17:45:30 +0200 Subject: [PATCH 280/314] Update to 1.10.2. --- gradle.properties | 10 +++++----- .../schematica/client/renderer/RenderSchematic.java | 2 +- .../schematica/client/renderer/ViewFrustumOverlay.java | 2 +- .../schematica/client/world/SchematicWorld.java | 9 ++------- .../com/github/lunatrius/schematica/nbt/NBTHelper.java | 3 ++- .../github/lunatrius/schematica/world/WorldDummy.java | 3 ++- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index b3405b5f..5702760a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=8 -version_minecraft=1.9.4 -version_forge=12.17.0.1937 -version_minforge=12.17.0.1908 -version_mappings=snapshot_20160601 -version_lunatriuscore=1.1.2.35 +version_minecraft=1.10.2 +version_forge=12.18.0.2006-1.10.0 +version_minforge=12.18.0.2001 +version_mappings=snapshot_20160701 +version_lunatriuscore=1.1.2.36 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 33fb0785..a3be55dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -450,7 +450,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, final int entityPass = 0; this.profiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, renderViewEntity, partialTicks); + TileEntityRendererDispatcher.instance.func_190056_a(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, renderViewEntity, this.mc.objectMouseOver, partialTicks); this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRendererObj, renderViewEntity, this.mc.pointedEntity, this.mc.gameSettings, partialTicks); this.countEntitiesTotal = 0; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java index b1d001a4..f97290e5 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java @@ -63,7 +63,7 @@ public void updateChunkPositions(final double viewEntityX, final double viewEnti final BlockPos blockpos = new BlockPos(x, y, z); if (!blockpos.equals(renderOverlay.getPosition())) { - renderOverlay.setOrigin(x, y, z); + renderOverlay.setPosition(x, y, z); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 371a1b9b..02f6f284 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -20,6 +20,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.GameType; import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldType; import net.minecraft.world.biome.Biome; @@ -31,7 +32,7 @@ import java.util.Map; public class SchematicWorld extends WorldClient { - private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); + private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, GameType.CREATIVE, false, false, WorldType.FLAT); private ISchematic schematic; @@ -136,12 +137,6 @@ public int getHeight() { return this.schematic.getHeight(); } - @SideOnly(Side.CLIENT) - @Override - public boolean extendedLevelsInChunkCache() { - return false; - } - @Override protected IChunkProvider createChunkProvider() { this.chunkProvider = new ChunkProviderSchematic(this); diff --git a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java index cd6e533a..181ebd64 100644 --- a/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/nbt/NBTHelper.java @@ -143,7 +143,8 @@ public static NBTTagCompound writeTileEntityToCompound(final TileEntity tileEnti } public static TileEntity readTileEntityFromCompound(final NBTTagCompound tileEntityCompound) { - return TileEntity.create(tileEntityCompound); + // TODO: world should NOT be null... + return TileEntity.create(null, tileEntityCompound); } public static NBTTagCompound writeEntityToCompound(final Entity entity) { diff --git a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java index c93609df..9e69915b 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java +++ b/src/main/java/com/github/lunatrius/schematica/world/WorldDummy.java @@ -2,6 +2,7 @@ import com.github.lunatrius.schematica.world.storage.SaveHandlerSchematic; import net.minecraft.profiler.Profiler; +import net.minecraft.world.GameType; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldSettings; @@ -29,7 +30,7 @@ protected boolean isChunkLoaded(final int x, final int z, final boolean allowEmp public static WorldDummy instance() { if (instance == null) { - final WorldSettings worldSettings = new WorldSettings(0, WorldSettings.GameType.CREATIVE, false, false, WorldType.FLAT); + final WorldSettings worldSettings = new WorldSettings(0, GameType.CREATIVE, false, false, WorldType.FLAT); final WorldInfo worldInfo = new WorldInfo(worldSettings, "FakeWorld"); instance = new WorldDummy(new SaveHandlerSchematic(), worldInfo, new WorldProviderSchematic(), new Profiler(), false); } From 7a4d8fbb0fa4d5cc75b0fbab40ea9954be61bfb9 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Fri, 8 Jul 2016 15:58:51 +0200 Subject: [PATCH 281/314] Fix a NPE introduced in 1.9.x. Fixes gh-162 --- .../com/github/lunatrius/schematica/proxy/ServerProxy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java index 0bac2741..d28b7703 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ServerProxy.java @@ -34,12 +34,12 @@ public void serverStarting(final FMLServerStartingEvent event) { @Override public File getDataDirectory() { - final MinecraftServer server = this.serverWeakReference.get(); + final MinecraftServer server = this.serverWeakReference != null ? this.serverWeakReference.get() : null; final File file = server != null ? server.getFile(".") : new File("."); try { return file.getCanonicalFile(); } catch (final IOException e) { - Reference.logger.info("Could not canonize path!", e); + Reference.logger.warn("Could not canonize path!", e); } return file; } From 9e23fd52c17426262ea9e3aa86d09b0a2399e88b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 30 Jul 2016 21:10:41 +0200 Subject: [PATCH 282/314] The schematic chunk provider must extend the client chunk provider because of the client specific WorldClient.func_72863_F (getChunkProvider) override. Fixes gh-168 --- .../world/chunk/ChunkProviderSchematic.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index 631bae03..a4eb1f2c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -1,6 +1,8 @@ package com.github.lunatrius.schematica.client.world.chunk; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.google.common.base.Objects; +import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.EmptyChunk; @@ -9,12 +11,14 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -public class ChunkProviderSchematic implements IChunkProvider { +// FIXME: `extends ChunkProviderClient` is required for the `WorldClient.getChunkProvider` method to work properly +public class ChunkProviderSchematic extends ChunkProviderClient implements IChunkProvider { private final SchematicWorld world; private final Chunk emptyChunk; private final Map chunks = new ConcurrentHashMap(); public ChunkProviderSchematic(final SchematicWorld world) { + super(world); this.world = world; this.emptyChunk = new EmptyChunk(world, 0, 0) { @Override @@ -59,4 +63,16 @@ public boolean unloadQueuedChunks() { public String makeString() { return "SchematicChunkCache"; } + + // ChunkProviderClient + @Override + public Chunk loadChunk(int x, int z) { + return Objects.firstNonNull(getLoadedChunk(x, z), this.emptyChunk); + } + + // ChunkProviderClient + @Override + public void unloadChunk(int x, int z) { + // NOOP: schematic chunks are part of the schematic world and are never unloaded separately + } } From 6ee69c49762412801d7e88fb67008f5ae3722cc8 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 1 Oct 2016 19:17:34 +0200 Subject: [PATCH 283/314] Fix block placement when adjacent blocks are not required. Fixes gh-170 --- .../lunatrius/schematica/client/printer/SchematicPrinter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 278dec7f..f085eed9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -349,7 +349,9 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, } */ - final EnumActionResult result = this.minecraft.playerController.processRightClickBlock(player, world, itemStack, pos, side, hitVec, hand); + // FIXME: when an adjacent block is not required the blocks should be placed 1 block away from the actual position (because air is replaceable) + final BlockPos actualPos = ConfigurationHandler.placeAdjacent ? pos : pos.offset(side); + final EnumActionResult result = this.minecraft.playerController.processRightClickBlock(player, world, itemStack, actualPos, side, hitVec, hand); if ((result != EnumActionResult.SUCCESS)) { return false; } From 096d8c41a263b26e872530c57247c66eb185e230 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 6 Nov 2016 00:29:55 +0100 Subject: [PATCH 284/314] Add a special case for double slabs to the block list counter. Closes gh-179 --- .../schematica/client/util/BlockList.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 2a26c5ee..379f2b00 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -7,6 +7,7 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; +import net.minecraft.block.BlockSlab; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -59,11 +60,20 @@ public List getList(final EntityPlayer player, final Schematic continue; } + int count = 1; + + // TODO: this has to be generalized for all blocks; just a temporary "fix" + if (block instanceof BlockSlab) { + if (((BlockSlab) block).isDouble()) { + count = 2; + } + } + final WrappedItemStack wrappedItemStack = findOrCreateWrappedItemStackFor(blockList, stack); if (isPlaced) { - wrappedItemStack.placed++; + wrappedItemStack.placed += count; } - wrappedItemStack.total++; + wrappedItemStack.total += count; } for (WrappedItemStack wrappedItemStack : blockList) { From 7e8e3a0a60890e885adae7714270615f06a0a1e0 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 3 Dec 2016 22:17:28 +0100 Subject: [PATCH 285/314] Update to 1.11. --- gradle.properties | 10 ++++----- .../block/state/BlockStateHelper.java | 2 +- .../state/pattern/BlockStateReplacer.java | 2 +- .../gui/control/GuiSchematicMaterials.java | 2 +- .../client/gui/save/GuiSchematicSave.java | 4 ++-- .../client/printer/SchematicPrinter.java | 14 ++++++------ .../printer/registry/PlacementRegistry.java | 4 ++-- .../client/renderer/RenderSchematic.java | 22 +++++++++---------- .../client/renderer/SchematicRenderCache.java | 2 +- .../client/renderer/ViewFrustumOverlay.java | 22 +++++++++---------- .../renderer/chunk/overlay/RenderOverlay.java | 2 +- .../client/world/SchematicWorld.java | 2 +- .../world/chunk/ChunkProviderSchematic.java | 7 ++---- .../command/CommandSchematicaDownload.java | 10 ++++----- .../command/CommandSchematicaList.java | 12 +++++----- .../command/CommandSchematicaRemove.java | 10 ++++----- .../command/CommandSchematicaSave.java | 10 ++++----- .../client/CommandSchematicaReplace.java | 8 +++---- .../schematica/handler/QueueTickHandler.java | 4 ++-- .../handler/client/InputHandler.java | 8 +++---- .../handler/client/TickHandler.java | 4 ++-- .../schematica/network/PacketHandler.java | 2 +- .../network/message/MessageDownloadEnd.java | 2 +- .../schematica/proxy/ClientProxy.java | 4 ++-- .../lunatrius/schematica/reference/Names.java | 2 +- .../schematica/reference/Reference.java | 5 +---- .../world/schematic/SchematicFormat.java | 2 +- .../world/schematic/SchematicUtil.java | 2 +- .../lang/{ca_ES.lang => ca_es.lang} | 0 .../lang/{cs_CZ.lang => cs_cz.lang} | 0 .../lang/{da_DK.lang => da_dk.lang} | 0 .../lang/{de_DE.lang => de_de.lang} | 0 .../lang/{en_GB.lang => en_gb.lang} | 0 .../lang/{en_PT.lang => en_pt.lang} | 0 .../lang/{en_US.lang => en_us.lang} | 0 .../lang/{es_ES.lang => es_es.lang} | 0 .../lang/{es_MX.lang => es_mx.lang} | 0 .../lang/{fi_FI.lang => fi_fi.lang} | 0 .../lang/{fr_FR.lang => fr_fr.lang} | 0 .../lang/{hu_HU.lang => hu_hu.lang} | 0 .../lang/{it_IT.lang => it_it.lang} | 0 .../lang/{ja_JP.lang => ja_jp.lang} | 0 .../lang/{ko_KR.lang => ko_kr.lang} | 0 .../lang/{la_LA.lang => la_la.lang} | 0 .../lang/{lt_LT.lang => lt_lt.lang} | 0 .../lang/{nl_NL.lang => nl_nl.lang} | 0 .../lang/{no_NO.lang => no_no.lang} | 0 .../lang/{pl_PL.lang => pl_pl.lang} | 0 .../lang/{pt_PT.lang => pt_pt.lang} | 0 .../lang/{ru_RU.lang => ru_ru.lang} | 0 .../lang/{sk_SK.lang => sk_sk.lang} | 0 .../lang/{sl_SI.lang => sl_si.lang} | 0 .../lang/{th_TH.lang => th_th.lang} | 0 .../lang/{tr_TR.lang => tr_tr.lang} | 0 .../lang/{uk_UA.lang => uk_ua.lang} | 0 .../lang/{zh_CN.lang => zh_cn.lang} | 0 src/main/resources/mcmod.info | 2 +- src/main/resources/pack.mcmeta | 2 +- 58 files changed, 89 insertions(+), 95 deletions(-) rename src/main/resources/assets/schematica/lang/{ca_ES.lang => ca_es.lang} (100%) rename src/main/resources/assets/schematica/lang/{cs_CZ.lang => cs_cz.lang} (100%) rename src/main/resources/assets/schematica/lang/{da_DK.lang => da_dk.lang} (100%) rename src/main/resources/assets/schematica/lang/{de_DE.lang => de_de.lang} (100%) rename src/main/resources/assets/schematica/lang/{en_GB.lang => en_gb.lang} (100%) rename src/main/resources/assets/schematica/lang/{en_PT.lang => en_pt.lang} (100%) rename src/main/resources/assets/schematica/lang/{en_US.lang => en_us.lang} (100%) rename src/main/resources/assets/schematica/lang/{es_ES.lang => es_es.lang} (100%) rename src/main/resources/assets/schematica/lang/{es_MX.lang => es_mx.lang} (100%) rename src/main/resources/assets/schematica/lang/{fi_FI.lang => fi_fi.lang} (100%) rename src/main/resources/assets/schematica/lang/{fr_FR.lang => fr_fr.lang} (100%) rename src/main/resources/assets/schematica/lang/{hu_HU.lang => hu_hu.lang} (100%) rename src/main/resources/assets/schematica/lang/{it_IT.lang => it_it.lang} (100%) rename src/main/resources/assets/schematica/lang/{ja_JP.lang => ja_jp.lang} (100%) rename src/main/resources/assets/schematica/lang/{ko_KR.lang => ko_kr.lang} (100%) rename src/main/resources/assets/schematica/lang/{la_LA.lang => la_la.lang} (100%) rename src/main/resources/assets/schematica/lang/{lt_LT.lang => lt_lt.lang} (100%) rename src/main/resources/assets/schematica/lang/{nl_NL.lang => nl_nl.lang} (100%) rename src/main/resources/assets/schematica/lang/{no_NO.lang => no_no.lang} (100%) rename src/main/resources/assets/schematica/lang/{pl_PL.lang => pl_pl.lang} (100%) rename src/main/resources/assets/schematica/lang/{pt_PT.lang => pt_pt.lang} (100%) rename src/main/resources/assets/schematica/lang/{ru_RU.lang => ru_ru.lang} (100%) rename src/main/resources/assets/schematica/lang/{sk_SK.lang => sk_sk.lang} (100%) rename src/main/resources/assets/schematica/lang/{sl_SI.lang => sl_si.lang} (100%) rename src/main/resources/assets/schematica/lang/{th_TH.lang => th_th.lang} (100%) rename src/main/resources/assets/schematica/lang/{tr_TR.lang => tr_tr.lang} (100%) rename src/main/resources/assets/schematica/lang/{uk_UA.lang => uk_ua.lang} (100%) rename src/main/resources/assets/schematica/lang/{zh_CN.lang => zh_cn.lang} (100%) diff --git a/gradle.properties b/gradle.properties index 5702760a..1c8ae35a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=8 -version_minecraft=1.10.2 -version_forge=12.18.0.2006-1.10.0 -version_minforge=12.18.0.2001 -version_mappings=snapshot_20160701 -version_lunatriuscore=1.1.2.36 +version_minecraft=1.11 +version_forge=13.19.0.2177 +version_minforge=13.19.0.2172 +version_mappings=snapshot_20161203 +version_lunatriuscore=1.1.2.39 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java index 6711bcf0..c1ee4f4e 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/BlockStateHelper.java @@ -12,7 +12,7 @@ public class BlockStateHelper { @SuppressWarnings({ "rawtypes", "unchecked" }) public static > IProperty getProperty(final IBlockState blockState, final String name) { - for (final IProperty prop : blockState.getPropertyNames()) { + for (final IProperty prop : blockState.getPropertyKeys()) { if (prop.getName().equals(name)) { return prop; } diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java index 48c6cb9b..cdc4ca22 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java @@ -111,7 +111,7 @@ public static Map parsePropertyData(final IBlockState blo @SuppressWarnings({ "rawtypes", "unchecked" }) private static boolean putMatchingProperty(final Map map, final IBlockState blockState, final String name, final String value, final boolean strict) throws LocalizedException { - for (final IProperty property : blockState.getPropertyNames()) { + for (final IProperty property : blockState.getPropertyKeys()) { if (property.getName().equalsIgnoreCase(name)) { final Collection allowedValues = property.getAllowedValues(); for (final Comparable allowedValue : allowedValues) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index 6ed5fcca..c68cba7a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -41,7 +41,7 @@ public GuiSchematicMaterials(final GuiScreen guiScreen) { super(guiScreen); final Minecraft minecraft = Minecraft.getMinecraft(); final SchematicWorld schematic = ClientProxy.schematic; - this.blockList = new BlockList().getList(minecraft.thePlayer, schematic, minecraft.theWorld); + this.blockList = new BlockList().getList(minecraft.player, schematic, minecraft.world); this.sortType.sort(this.blockList); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index 4bc1b13f..c743f594 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -154,12 +154,12 @@ protected void actionPerformed(final GuiButton guiButton) { } else if (guiButton.id == this.btnSave.id) { final String path = this.tfFilename.getText() + ".schematic"; if (ClientProxy.isRenderingGuide) { - if (Schematica.proxy.saveSchematic(this.mc.thePlayer, ConfigurationHandler.schematicDirectory, path, this.mc.theWorld, ClientProxy.pointMin, ClientProxy.pointMax)) { + if (Schematica.proxy.saveSchematic(this.mc.player, ConfigurationHandler.schematicDirectory, path, this.mc.world, ClientProxy.pointMin, ClientProxy.pointMax)) { this.filename = ""; this.tfFilename.setText(this.filename); } } else { - SchematicFormat.writeToFileAndNotify(new File(ConfigurationHandler.schematicDirectory, path), ClientProxy.schematic.getSchematic(), this.mc.thePlayer); + SchematicFormat.writeToFileAndNotify(new File(ConfigurationHandler.schematicDirectory, path), ClientProxy.schematic.getSchematic(), this.mc.player); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index f085eed9..04b19f11 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -321,7 +321,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack = player.getHeldItem(hand); boolean success = false; - if (!this.minecraft.playerController.isInCreativeMode() && itemStack != null && itemStack.stackSize <= extraClicks) { + if (!this.minecraft.playerController.isInCreativeMode() && itemStack != null && itemStack.getCount() <= extraClicks) { return false; } @@ -334,8 +334,8 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, success = placeBlock(world, player, itemStack, offset, side, hitVec, hand); } - if (itemStack != null && itemStack.stackSize == 0 && success) { - player.inventory.mainInventory[player.inventory.currentItem] = null; + if (itemStack != null && itemStack.getCount() == 0 && success) { + player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY); } return success; @@ -351,7 +351,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, // FIXME: when an adjacent block is not required the blocks should be placed 1 block away from the actual position (because air is replaceable) final BlockPos actualPos = ConfigurationHandler.placeAdjacent ? pos : pos.offset(side); - final EnumActionResult result = this.minecraft.playerController.processRightClickBlock(player, world, itemStack, actualPos, side, hitVec, hand); + final EnumActionResult result = this.minecraft.playerController.processRightClickBlock(player, world, actualPos, side, hitVec, hand); if ((result != EnumActionResult.SUCCESS)) { return false; } @@ -392,8 +392,8 @@ private boolean swapToItem(final InventoryPlayer inventory, final ItemStack item } private int getInventorySlotWithItem(final InventoryPlayer inventory, final ItemStack itemStack) { - for (int i = 0; i < inventory.mainInventory.length; i++) { - if (inventory.mainInventory[i] != null && inventory.mainInventory[i].isItemEqual(itemStack)) { + for (int i = 0; i < inventory.mainInventory.size(); i++) { + if (inventory.mainInventory.get(i).isItemEqual(itemStack)) { return i; } } @@ -418,6 +418,6 @@ private int getNextSlot() { } private boolean swapSlots(final int from, final int to) { - return this.minecraft.playerController.windowClick(this.minecraft.thePlayer.inventoryContainer.windowId, from, to, ClickType.SWAP, this.minecraft.thePlayer) == null; + return this.minecraft.playerController.windowClick(this.minecraft.player.inventoryContainer.windowId, from, to, ClickType.SWAP, this.minecraft.player) == ItemStack.EMPTY; } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index d4830986..f258fc86 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -69,7 +69,7 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == BlockPistonBase.getFacingFromEntity(pos, player); + return facing == EnumFacing.getDirectionFromEntityLiving(pos, player); } }; final IValidPlayerFacing playerFacingRotateY = new IValidPlayerFacing() { @@ -90,7 +90,7 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { final int value = blockState.getValue(BlockStandingSign.ROTATION); - final int facing = MathHelper.floor_double((player.rotationYaw + 180.0) * 16.0 / 360.0 + 0.5) & 15; + final int facing = MathHelper.floor((player.rotationYaw + 180.0) * 16.0 / 360.0 + 0.5) & 15; return value == facing; } }; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index a3be55dd..48d5602c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -196,7 +196,7 @@ public void setWorldAndLoadRenderers(final SchematicWorld world) { this.frustumUpdatePosChunkX = Integer.MIN_VALUE; this.frustumUpdatePosChunkY = Integer.MIN_VALUE; this.frustumUpdatePosChunkZ = Integer.MIN_VALUE; - this.renderManager.set(world); + this.renderManager.setWorld(world); this.world = world; if (world != null) { @@ -229,7 +229,7 @@ public void setWorldAndLoadRenderers(final SchematicWorld world) { @SubscribeEvent public void onRenderWorldLast(final RenderWorldLastEvent event) { - final EntityPlayerSP player = this.mc.thePlayer; + final EntityPlayerSP player = this.mc.player; if (player != null) { this.profiler.startSection("schematica"); ClientProxy.setPlayerData(player, event.getPartialTicks()); @@ -450,7 +450,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, final int entityPass = 0; this.profiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.func_190056_a(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, renderViewEntity, this.mc.objectMouseOver, partialTicks); + TileEntityRendererDispatcher.instance.prepare(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, renderViewEntity, this.mc.objectMouseOver, partialTicks); this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRendererObj, renderViewEntity, this.mc.pointedEntity, this.mc.gameSettings, partialTicks); this.countEntitiesTotal = 0; @@ -487,7 +487,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, continue; } - if (!this.mc.theWorld.isAirBlock(tileEntity.getPos().add(this.world.position))) { + if (!this.mc.world.isAirBlock(tileEntity.getPos().add(this.world.position))) { continue; } @@ -547,9 +547,9 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final double deltaY = posY - this.frustumUpdatePosY; final double deltaZ = posZ - this.frustumUpdatePosZ; - final int chunkCoordX = MathHelper.floor_double(posX) >> 4; - final int chunkCoordY = MathHelper.floor_double(posY) >> 4; - final int chunkCoordZ = MathHelper.floor_double(posZ) >> 4; + final int chunkCoordX = MathHelper.floor(posX) >> 4; + final int chunkCoordY = MathHelper.floor(posY) >> 4; + final int chunkCoordZ = MathHelper.floor(posZ) >> 4; if (this.frustumUpdatePosChunkX != chunkCoordX || this.frustumUpdatePosChunkY != chunkCoordY || this.frustumUpdatePosChunkZ != chunkCoordZ || deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 16.0) { this.frustumUpdatePosX = posX; @@ -693,7 +693,7 @@ private Set getVisibleSides(final BlockPos pos) { private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final RenderChunk renderChunkBase, final EnumFacing side) { final BlockPos offset = renderChunkBase.getBlockPosOffset16(side); - if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { + if (MathHelper.abs(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { return null; } @@ -701,7 +701,7 @@ private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final RenderCh return null; } - if (MathHelper.abs_int(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) { + if (MathHelper.abs(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) { return null; } @@ -710,7 +710,7 @@ private RenderChunk getNeighborRenderChunk(final BlockPos posEye, final RenderCh private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final RenderChunk renderChunkBase, final EnumFacing side) { final BlockPos offset = renderChunkBase.getBlockPosOffset16(side); - if (MathHelper.abs_int(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { + if (MathHelper.abs(posEye.getX() - offset.getX()) > this.renderDistanceChunks * 16) { return null; } @@ -718,7 +718,7 @@ private RenderOverlay getNeighborRenderOverlay(final BlockPos posEye, final Rend return null; } - if (MathHelper.abs_int(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) { + if (MathHelper.abs(posEye.getZ() - offset.getZ()) > this.renderDistanceChunks * 16) { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java index 5b3d93a5..2426c186 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -19,7 +19,7 @@ public SchematicRenderCache(final World world, final BlockPos from, final BlockP @Override public IBlockState getBlockState(final BlockPos pos) { final BlockPos realPos = pos.add(ClientProxy.schematic.position); - final World world = this.minecraft.theWorld; + final World world = this.minecraft.world; if (!world.isAirBlock(realPos) && !ConfigurationHandler.isExtraAirBlock(world.getBlockState(realPos).getBlock())) { return Blocks.AIR.getDefaultState(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java index f97290e5..ce89bd44 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/ViewFrustumOverlay.java @@ -47,8 +47,8 @@ public void deleteGlResources() { public void updateChunkPositions(final double viewEntityX, final double viewEntityZ) { super.updateChunkPositions(viewEntityX, viewEntityZ); - final int xx = MathHelper.floor_double(viewEntityX) - 8; - final int zz = MathHelper.floor_double(viewEntityZ) - 8; + final int xx = MathHelper.floor(viewEntityX) - 8; + final int zz = MathHelper.floor(viewEntityZ) - 8; final int yy = this.countChunksX * 16; for (int chunkX = 0; chunkX < this.countChunksX; chunkX++) { @@ -85,12 +85,12 @@ private int getPosition(final int xz, final int y, final int chunk) { public void markBlocksForUpdate(final int fromX, final int fromY, final int fromZ, final int toX, final int toY, final int toZ, final boolean needsUpdate) { super.markBlocksForUpdate(fromX, fromY, fromZ, toX, toY, toZ, needsUpdate); - final int x0 = MathHelper.bucketInt(fromX, 16); - final int y0 = MathHelper.bucketInt(fromY, 16); - final int z0 = MathHelper.bucketInt(fromZ, 16); - final int x1 = MathHelper.bucketInt(toX, 16); - final int y1 = MathHelper.bucketInt(toY, 16); - final int z1 = MathHelper.bucketInt(toZ, 16); + final int x0 = MathHelper.intFloorDiv(fromX, 16); + final int y0 = MathHelper.intFloorDiv(fromY, 16); + final int z0 = MathHelper.intFloorDiv(fromZ, 16); + final int x1 = MathHelper.intFloorDiv(toX, 16); + final int y1 = MathHelper.intFloorDiv(toY, 16); + final int z1 = MathHelper.intFloorDiv(toZ, 16); for (int xi = x0; xi <= x1; ++xi) { int x = xi % this.countChunksX; @@ -122,9 +122,9 @@ public void markBlocksForUpdate(final int fromX, final int fromY, final int from } public RenderOverlay getRenderOverlay(final BlockPos pos) { - int x = MathHelper.bucketInt(pos.getX(), 16); - final int y = MathHelper.bucketInt(pos.getY(), 16); - int z = MathHelper.bucketInt(pos.getZ(), 16); + int x = MathHelper.intFloorDiv(pos.getX(), 16); + final int y = MathHelper.intFloorDiv(pos.getY(), 16); + int z = MathHelper.intFloorDiv(pos.getZ(), 16); if (y >= 0 && y < this.countChunksY) { x %= this.countChunksX; diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index a67a6c17..0b4be95d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -66,7 +66,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun if (!chunkCache.extendedLevelsInChunkCache()) { ++renderChunksUpdated; - final World mcWorld = Minecraft.getMinecraft().theWorld; + final World mcWorld = Minecraft.getMinecraft().world; final BlockRenderLayer layer = BlockRenderLayer.TRANSLUCENT; final net.minecraft.client.renderer.VertexBuffer buffer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 02f6f284..9c2b0294 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -167,7 +167,7 @@ public ISchematic getSchematic() { } public void initializeTileEntity(final TileEntity tileEntity) { - tileEntity.setWorldObj(this); + tileEntity.setWorld(this); tileEntity.getBlockType(); try { tileEntity.invalidate(); diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index a4eb1f2c..0bcf1d66 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -38,7 +38,7 @@ public Chunk getLoadedChunk(final int x, final int z) { return this.emptyChunk; } - final long key = ChunkPos.chunkXZ2Int(x, z); + final long key = ChunkPos.asLong(x, z); ChunkSchematic chunk = this.chunks.get(key); if (chunk == null) { @@ -54,10 +54,7 @@ public Chunk provideChunk(final int x, final int z) { return getLoadedChunk(x, z); } - @Override - public boolean unloadQueuedChunks() { - return false; - } + @Override public String makeString() { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 78e8252d..31077f1c 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -27,17 +27,17 @@ public class CommandSchematicaDownload extends CommandSchematicaBase { private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); @Override - public String getCommandName() { + public String getName() { return Names.Command.Download.NAME; } @Override - public String getCommandUsage(final ICommandSender sender) { + public String getUsage(final ICommandSender sender) { return Names.Command.Download.Message.USAGE; } @Override - public List getTabCompletionOptions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { + public List getTabCompletions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { if (!(sender instanceof EntityPlayer)) { return null; } @@ -61,7 +61,7 @@ public List getTabCompletionOptions(final MinecraftServer server, final @Override public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { if (args.length < 1) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } if (!(sender instanceof EntityPlayerMP)) { @@ -80,7 +80,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f if (schematic != null) { DownloadHandler.INSTANCE.transferMap.put(player, new SchematicTransfer(schematic, filename)); - sender.addChatMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_STARTED, filename)); + sender.sendMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_STARTED, filename)); } else { throw new CommandException(Names.Command.Download.Message.DOWNLOAD_FAILED); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 4e3bef57..5dc1b90c 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -23,12 +23,12 @@ public class CommandSchematicaList extends CommandSchematicaBase { private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); @Override - public String getCommandName() { + public String getName() { return Names.Command.List.NAME; } @Override - public String getCommandUsage(final ICommandSender sender) { + public String getUsage(final ICommandSender sender) { return Names.Command.List.Message.USAGE; } @@ -47,7 +47,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f } } } catch (final NumberFormatException e) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } final EntityPlayer player = (EntityPlayer) sender; @@ -94,7 +94,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f } if (currentFile == 0) { - sender.addChatMessage(new TextComponentTranslation(Names.Command.List.Message.NO_SCHEMATICS)); + sender.sendMessage(new TextComponentTranslation(Names.Command.List.Message.NO_SCHEMATICS)); return; } @@ -103,9 +103,9 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f throw new CommandException(Names.Command.List.Message.NO_SUCH_PAGE); } - sender.addChatMessage(withStyle(new TextComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1), TextFormatting.DARK_GREEN, null)); + sender.sendMessage(withStyle(new TextComponentTranslation(Names.Command.List.Message.PAGE_HEADER, page + 1, totalPages + 1), TextFormatting.DARK_GREEN, null)); for (final ITextComponent chatComponent : componentsToSend) { - sender.addChatMessage(chatComponent); + sender.sendMessage(chatComponent); } } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 401010d7..41aa40fb 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -22,19 +22,19 @@ public class CommandSchematicaRemove extends CommandSchematicaBase { @Override - public String getCommandName() { + public String getName() { return Names.Command.Remove.NAME; } @Override - public String getCommandUsage(final ICommandSender sender) { + public String getUsage(final ICommandSender sender) { return Names.Command.Remove.Message.USAGE; } @Override public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { if (args.length < 1) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } if (!(sender instanceof EntityPlayer)) { @@ -74,7 +74,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f if (file.exists()) { if (delete) { if (file.delete()) { - sender.addChatMessage(new TextComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_REMOVED, name)); + sender.sendMessage(new TextComponentTranslation(Names.Command.Remove.Message.SCHEMATIC_REMOVED, name)); } else { throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } @@ -86,7 +86,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f chatComponent.appendSibling(withStyle(new TextComponentTranslation(Names.Command.Remove.Message.YES), TextFormatting.RED, confirmCommand)); chatComponent.appendSibling(new TextComponentString("]")); - sender.addChatMessage(chatComponent); + sender.sendMessage(chatComponent); } } else { throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 41b621aa..4b148421 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -17,19 +17,19 @@ public class CommandSchematicaSave extends CommandSchematicaBase { @Override - public String getCommandName() { + public String getName() { return Names.Command.Save.NAME; } @Override - public String getCommandUsage(final ICommandSender sender) { + public String getUsage(final ICommandSender sender) { return Names.Command.Save.Message.USAGE; } @Override public void execute(final MinecraftServer server, final ICommandSender sender, final String[] args) throws CommandException { if (args.length < 7) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } if (!(sender instanceof EntityPlayer)) { @@ -54,7 +54,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f name = args[6]; filename = String.format("%s.schematic", name); } catch (final NumberFormatException exception) { - throw new WrongUsageException(getCommandUsage(sender)); + throw new WrongUsageException(getUsage(sender)); } Reference.logger.debug("Saving schematic from {} to {} to {}", from, to, filename); @@ -74,7 +74,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f try { Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), from, to); - sender.addChatMessage(new TextComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); + sender.sendMessage(new TextComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); } catch (final Exception e) { throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java index 056a6798..b752e3a9 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java +++ b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java @@ -22,17 +22,17 @@ public class CommandSchematicaReplace extends CommandSchematicaBase { private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); @Override - public String getCommandName() { + public String getName() { return Names.Command.Replace.NAME; } @Override - public String getCommandUsage(final ICommandSender sender) { + public String getUsage(final ICommandSender sender) { return Names.Command.Replace.Message.USAGE; } @Override - public List getTabCompletionOptions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { + public List getTabCompletions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { if (args.length < 3) { return getListOfStringsMatchingLastWord(args, BLOCK_REGISTRY.getKeys()); } @@ -60,7 +60,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f final int count = schematic.replaceBlock(matcher, replacer, replacementInfo.stateData); - sender.addChatMessage(new TextComponentTranslation(Names.Command.Replace.Message.SUCCESS, count)); + sender.sendMessage(new TextComponentTranslation(Names.Command.Replace.Message.SUCCESS, count)); } catch (final Exception e) { Reference.logger.error("Something went wrong!", e); throw new CommandException(e.getMessage()); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 73a94472..8243d79f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -28,7 +28,7 @@ public void onClientTick(final TickEvent.ClientTickEvent event) { // TODO: find a better way... maybe? try { - final EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + final EntityPlayerSP player = Minecraft.getMinecraft().player; if (player != null && player.connection != null && !player.connection.getNetworkManager().isLocalChannel()) { processQueue(); } @@ -59,7 +59,7 @@ private void processQueue() { if (container.hasNext()) { if (container.isFirst()) { final TextComponentTranslation component = new TextComponentTranslation(Names.Command.Save.Message.SAVE_STARTED, container.chunkCount, container.file.getName()); - container.player.addChatMessage(component); + container.player.sendMessage(component); } container.next(); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index 20c04de5..c4e0e305 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -71,7 +71,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_INC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null && schematic.isRenderingLayer) { - schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); + schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } } @@ -79,7 +79,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_DEC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null && schematic.isRenderingLayer) { - schematic.renderingLayer = MathHelper.clamp_int(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); + schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } } @@ -103,7 +103,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_PRINTER_TOGGLE.isPressed()) { if (ClientProxy.schematic != null) { final boolean printing = SchematicPrinter.INSTANCE.togglePrinting(); - this.minecraft.thePlayer.addChatComponentMessage(new TextComponentTranslation(Names.Messages.TOGGLE_PRINTER, I18n.format(printing ? Names.Gui.ON : Names.Gui.OFF))); + this.minecraft.player.sendMessage(new TextComponentTranslation(Names.Messages.TOGGLE_PRINTER, I18n.format(printing ? Names.Gui.ON : Names.Gui.OFF))); } } @@ -134,7 +134,7 @@ private boolean pickBlock(final SchematicWorld schematic, final RayTraceResult o return false; } - final EntityPlayerSP player = this.minecraft.thePlayer; + final EntityPlayerSP player = this.minecraft.player; if (!ForgeHooks.onPickBlock(objectMouseOver, player, schematic)) { return true; } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java index 8bb89add..35dcd9f0 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/TickHandler.java @@ -43,8 +43,8 @@ public void onClientTick(final TickEvent.ClientTickEvent event) { } this.minecraft.mcProfiler.startSection("schematica"); - final WorldClient world = this.minecraft.theWorld; - final EntityPlayerSP player = this.minecraft.thePlayer; + final WorldClient world = this.minecraft.world; + final EntityPlayerSP player = this.minecraft.player; final SchematicWorld schematic = ClientProxy.schematic; if (world != null && player != null && schematic != null && schematic.isRendering) { this.minecraft.mcProfiler.startSection("printer"); diff --git a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java index bda8feca..191f2b99 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/network/PacketHandler.java @@ -12,7 +12,7 @@ import net.minecraftforge.fml.relauncher.Side; public class PacketHandler { - public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID_LOWER); + public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID); public static void init() { INSTANCE.registerMessage(MessageCapabilities.class, MessageCapabilities.class, 0, Side.CLIENT); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index 568f9b18..00677126 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -40,7 +40,7 @@ public IMessage onMessage(final MessageDownloadEnd message, final MessageContext final boolean success = SchematicFormat.writeToFile(directory, message.name, DownloadHandler.INSTANCE.schematic); if (success) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_SUCCEEDED, message.name)); + Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_SUCCEEDED, message.name)); } DownloadHandler.INSTANCE.schematic = null; diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 7ca05e1a..1737bc45 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -64,7 +64,7 @@ public static void setPlayerData(final EntityPlayer player, final float partialT orientation = getOrientation(player); - rotationRender = MathHelper.floor_double(player.rotationYaw / 90) & 3; + rotationRender = MathHelper.floor(player.rotationYaw / 90) & 3; } private static EnumFacing getOrientation(final EntityPlayer player) { @@ -73,7 +73,7 @@ private static EnumFacing getOrientation(final EntityPlayer player) { } else if (player.rotationPitch < -45) { return EnumFacing.UP; } else { - switch (MathHelper.floor_double(player.rotationYaw / 90.0 + 0.5) & 3) { + switch (MathHelper.floor(player.rotationYaw / 90.0 + 0.5) & 3) { case 0: return EnumFacing.SOUTH; case 1: diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 41846b5f..dfc2a3c6 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -64,7 +64,7 @@ public static final class Category { public static final String PLAYER_QUOTA_KILOBYTES = "playerQuotaKilobytes"; public static final String PLAYER_QUOTA_KILOBYTES_DESC = "Amount of storage provided per-player for schematics on the server."; - public static final String LANG_PREFIX = Reference.MODID_LOWER + ".config"; + public static final String LANG_PREFIX = Reference.MODID + ".config"; } public static final class Command { diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java index b67085bd..a6053352 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Reference.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Reference.java @@ -3,11 +3,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.Locale; - public class Reference { - public static final String MODID = "Schematica"; - public static final String MODID_LOWER = MODID.toLowerCase(Locale.ENGLISH); + public static final String MODID = "schematica"; public static final String NAME = "Schematica"; public static final String VERSION = "${version}"; public static final String FORGE = "${forgeversion}"; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 4ddab946..ca28e86d 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -78,7 +78,7 @@ public static boolean writeToFile(final File directory, final String filename, f public static void writeToFileAndNotify(final File file, final ISchematic schematic, final EntityPlayer player) { final boolean success = writeToFile(file, schematic); final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; - player.addChatMessage(new TextComponentTranslation(message, file.getName())); + player.sendMessage(new TextComponentTranslation(message, file.getName())); } static { diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index 4dd8b23a..69569ac6 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -66,7 +66,7 @@ public static ItemStack getIconFromNBT(final NBTTagCompound tagCompound) { ItemStack icon = DEFAULT_ICON.copy(); if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { - icon.readFromNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); + icon.deserializeNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); if (icon.getItem() == null) { icon = DEFAULT_ICON.copy(); diff --git a/src/main/resources/assets/schematica/lang/ca_ES.lang b/src/main/resources/assets/schematica/lang/ca_es.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/ca_ES.lang rename to src/main/resources/assets/schematica/lang/ca_es.lang diff --git a/src/main/resources/assets/schematica/lang/cs_CZ.lang b/src/main/resources/assets/schematica/lang/cs_cz.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/cs_CZ.lang rename to src/main/resources/assets/schematica/lang/cs_cz.lang diff --git a/src/main/resources/assets/schematica/lang/da_DK.lang b/src/main/resources/assets/schematica/lang/da_dk.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/da_DK.lang rename to src/main/resources/assets/schematica/lang/da_dk.lang diff --git a/src/main/resources/assets/schematica/lang/de_DE.lang b/src/main/resources/assets/schematica/lang/de_de.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/de_DE.lang rename to src/main/resources/assets/schematica/lang/de_de.lang diff --git a/src/main/resources/assets/schematica/lang/en_GB.lang b/src/main/resources/assets/schematica/lang/en_gb.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/en_GB.lang rename to src/main/resources/assets/schematica/lang/en_gb.lang diff --git a/src/main/resources/assets/schematica/lang/en_PT.lang b/src/main/resources/assets/schematica/lang/en_pt.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/en_PT.lang rename to src/main/resources/assets/schematica/lang/en_pt.lang diff --git a/src/main/resources/assets/schematica/lang/en_US.lang b/src/main/resources/assets/schematica/lang/en_us.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/en_US.lang rename to src/main/resources/assets/schematica/lang/en_us.lang diff --git a/src/main/resources/assets/schematica/lang/es_ES.lang b/src/main/resources/assets/schematica/lang/es_es.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/es_ES.lang rename to src/main/resources/assets/schematica/lang/es_es.lang diff --git a/src/main/resources/assets/schematica/lang/es_MX.lang b/src/main/resources/assets/schematica/lang/es_mx.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/es_MX.lang rename to src/main/resources/assets/schematica/lang/es_mx.lang diff --git a/src/main/resources/assets/schematica/lang/fi_FI.lang b/src/main/resources/assets/schematica/lang/fi_fi.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/fi_FI.lang rename to src/main/resources/assets/schematica/lang/fi_fi.lang diff --git a/src/main/resources/assets/schematica/lang/fr_FR.lang b/src/main/resources/assets/schematica/lang/fr_fr.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/fr_FR.lang rename to src/main/resources/assets/schematica/lang/fr_fr.lang diff --git a/src/main/resources/assets/schematica/lang/hu_HU.lang b/src/main/resources/assets/schematica/lang/hu_hu.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/hu_HU.lang rename to src/main/resources/assets/schematica/lang/hu_hu.lang diff --git a/src/main/resources/assets/schematica/lang/it_IT.lang b/src/main/resources/assets/schematica/lang/it_it.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/it_IT.lang rename to src/main/resources/assets/schematica/lang/it_it.lang diff --git a/src/main/resources/assets/schematica/lang/ja_JP.lang b/src/main/resources/assets/schematica/lang/ja_jp.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/ja_JP.lang rename to src/main/resources/assets/schematica/lang/ja_jp.lang diff --git a/src/main/resources/assets/schematica/lang/ko_KR.lang b/src/main/resources/assets/schematica/lang/ko_kr.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/ko_KR.lang rename to src/main/resources/assets/schematica/lang/ko_kr.lang diff --git a/src/main/resources/assets/schematica/lang/la_LA.lang b/src/main/resources/assets/schematica/lang/la_la.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/la_LA.lang rename to src/main/resources/assets/schematica/lang/la_la.lang diff --git a/src/main/resources/assets/schematica/lang/lt_LT.lang b/src/main/resources/assets/schematica/lang/lt_lt.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/lt_LT.lang rename to src/main/resources/assets/schematica/lang/lt_lt.lang diff --git a/src/main/resources/assets/schematica/lang/nl_NL.lang b/src/main/resources/assets/schematica/lang/nl_nl.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/nl_NL.lang rename to src/main/resources/assets/schematica/lang/nl_nl.lang diff --git a/src/main/resources/assets/schematica/lang/no_NO.lang b/src/main/resources/assets/schematica/lang/no_no.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/no_NO.lang rename to src/main/resources/assets/schematica/lang/no_no.lang diff --git a/src/main/resources/assets/schematica/lang/pl_PL.lang b/src/main/resources/assets/schematica/lang/pl_pl.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/pl_PL.lang rename to src/main/resources/assets/schematica/lang/pl_pl.lang diff --git a/src/main/resources/assets/schematica/lang/pt_PT.lang b/src/main/resources/assets/schematica/lang/pt_pt.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/pt_PT.lang rename to src/main/resources/assets/schematica/lang/pt_pt.lang diff --git a/src/main/resources/assets/schematica/lang/ru_RU.lang b/src/main/resources/assets/schematica/lang/ru_ru.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/ru_RU.lang rename to src/main/resources/assets/schematica/lang/ru_ru.lang diff --git a/src/main/resources/assets/schematica/lang/sk_SK.lang b/src/main/resources/assets/schematica/lang/sk_sk.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/sk_SK.lang rename to src/main/resources/assets/schematica/lang/sk_sk.lang diff --git a/src/main/resources/assets/schematica/lang/sl_SI.lang b/src/main/resources/assets/schematica/lang/sl_si.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/sl_SI.lang rename to src/main/resources/assets/schematica/lang/sl_si.lang diff --git a/src/main/resources/assets/schematica/lang/th_TH.lang b/src/main/resources/assets/schematica/lang/th_th.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/th_TH.lang rename to src/main/resources/assets/schematica/lang/th_th.lang diff --git a/src/main/resources/assets/schematica/lang/tr_TR.lang b/src/main/resources/assets/schematica/lang/tr_tr.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/tr_TR.lang rename to src/main/resources/assets/schematica/lang/tr_tr.lang diff --git a/src/main/resources/assets/schematica/lang/uk_UA.lang b/src/main/resources/assets/schematica/lang/uk_ua.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/uk_UA.lang rename to src/main/resources/assets/schematica/lang/uk_ua.lang diff --git a/src/main/resources/assets/schematica/lang/zh_CN.lang b/src/main/resources/assets/schematica/lang/zh_cn.lang similarity index 100% rename from src/main/resources/assets/schematica/lang/zh_CN.lang rename to src/main/resources/assets/schematica/lang/zh_cn.lang diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 70ec8eb9..1fe9bc9a 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,7 +2,7 @@ "modListVersion": 2, "modList": [ { - "modid": "Schematica", + "modid": "schematica", "name": "Schematica", "description": "Import and export Minecraft schematic files in Minecraft!", "mcversion": "${mcversion}", diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 9063a8bc..7c78afe0 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "pack_format": 1, + "pack_format": 3, "description": "Schematica contents" } } From 44fc3b4c576d1c0d61b61dbad47be9afc7fa6e0d Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 3 Dec 2016 22:53:14 +0100 Subject: [PATCH 286/314] Fix dependency modids. --- src/main/resources/mcmod.info | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 1fe9bc9a..b5485b7f 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -12,9 +12,9 @@ ], "credits": "AbrarSyed, AtomicBlom, UltraMoogleMan", "dependants": [ ], - "dependencies": [ "Forge@[${minforgeversion},)", "LunatriusCore@[${coreversion},)" ], + "dependencies": [ "forge@[${minforgeversion},)", "lunatriuscore@[${coreversion},)" ], "parent": "", - "requiredMods": [ "Forge@[${minforgeversion},)", "LunatriusCore@[${coreversion},)" ], + "requiredMods": [ "forge@[${minforgeversion},)", "lunatriuscore@[${coreversion},)" ], "logoFile": "/assets/schematica/logo.png", "screenshots": [ ], "updateUrl": "http://mc.lunatri.us/", From 732917c45d3f2cb2867126e42ef2668e5b545465 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 18 Dec 2016 12:53:12 +0100 Subject: [PATCH 287/314] Fix the path merging check to use startsWith instead of contains. --- .../handler/ConfigurationHandler.java | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 50a3dfd5..b9365104 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -214,27 +214,42 @@ private static void loadConfigurationGeneral() { propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); schematicDirectory = new File(propSchematicDirectory.getString()); + propExtraAirBlocks = configuration.get(Names.Config.Category.GENERAL, Names.Config.EXTRA_AIR_BLOCKS, EXTRA_AIR_BLOCKS_DEFAULT, Names.Config.EXTRA_AIR_BLOCKS_DESC); + propExtraAirBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTRA_AIR_BLOCKS); + extraAirBlocks = propExtraAirBlocks.getStringList(); + + propSortType = configuration.get(Names.Config.Category.GENERAL, Names.Config.SORT_TYPE, SORT_TYPE_DEFAULT, Names.Config.SORT_TYPE_DESC); + propSortType.setShowInGui(false); + sortType = propSortType.getString(); + + normalizeSchematicPath(); + populateExtraAirBlocks(); + } + + private static void normalizeSchematicPath() { try { schematicDirectory = schematicDirectory.getCanonicalFile(); final String schematicPath = schematicDirectory.getAbsolutePath(); final String dataPath = Schematica.proxy.getDataDirectory().getAbsolutePath(); - if (schematicPath.contains(dataPath)) { - propSchematicDirectory.set(schematicPath.substring(dataPath.length()).replace("\\", "/").replaceAll("^/+", "")); - } else { - propSchematicDirectory.set(schematicPath.replace("\\", "/")); - } + final String newSchematicPath = mergePaths(schematicPath, dataPath); + propSchematicDirectory.set(newSchematicPath); + Reference.logger.debug("Schematic path: {}", schematicPath); + Reference.logger.debug("Data path: {}", dataPath); + Reference.logger.debug("New schematic path: {}", newSchematicPath); } catch (final IOException e) { Reference.logger.warn("Could not canonize path!", e); } + } - propExtraAirBlocks = configuration.get(Names.Config.Category.GENERAL, Names.Config.EXTRA_AIR_BLOCKS, EXTRA_AIR_BLOCKS_DEFAULT, Names.Config.EXTRA_AIR_BLOCKS_DESC); - propExtraAirBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTRA_AIR_BLOCKS); - extraAirBlocks = propExtraAirBlocks.getStringList(); + private static String mergePaths(final String schematicPath, final String dataPath) { + if (schematicPath.startsWith(dataPath)) { + return schematicPath.substring(dataPath.length()).replace("\\", "/").replaceAll("^/+", ""); + } - propSortType = configuration.get(Names.Config.Category.GENERAL, Names.Config.SORT_TYPE, SORT_TYPE_DEFAULT, Names.Config.SORT_TYPE_DESC); - propSortType.setShowInGui(false); - sortType = propSortType.getString(); + return schematicPath.replace("\\", "/"); + } + private static void populateExtraAirBlocks() { extraAirBlockList.clear(); for (final String name : extraAirBlocks) { final Block block = BLOCK_REGISTRY.getObject(new ResourceLocation(name)); From 50fba046ce333faf3053c30a12d2452bebeb5191 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 18 Dec 2016 13:18:52 +0100 Subject: [PATCH 288/314] Fix air blocks/items appearing in the material list. --- .../github/lunatrius/schematica/client/util/BlockList.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 379f2b00..85696478 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -52,11 +52,11 @@ public List getList(final EntityPlayer player, final Schematic try { stack = block.getPickBlock(blockState, rtr, world, pos, player); } catch (final Exception e) { - Reference.logger.debug("Could not get the pick block for: {}", blockState, e); + Reference.logger.warn("Could not get the pick block for: {}", blockState, e); } - if (stack == null || stack.getItem() == null) { - Reference.logger.debug("Could not find the item for: {}", blockState); + if (stack == null || stack.getItem() == ItemStack.EMPTY.getItem()) { + Reference.logger.warn("Could not find the item for: {}", blockState); continue; } From 0956921ef4293c21bb64687179257e15b1eda7f1 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 18 Dec 2016 13:19:37 +0100 Subject: [PATCH 289/314] Add a special case for fluids. Closes gh-186 --- .../schematica/client/util/BlockList.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 85696478..bc4fce2e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -7,14 +7,20 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockSlab; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidActionResult; +import net.minecraftforge.fluids.FluidUtil; +import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fluids.capability.IFluidHandler; import java.util.ArrayList; import java.util.List; @@ -55,6 +61,17 @@ public List getList(final EntityPlayer player, final Schematic Reference.logger.warn("Could not get the pick block for: {}", blockState, e); } + if (block instanceof IFluidBlock || block instanceof BlockLiquid) { + final IFluidHandler fluidHandler = FluidUtil.getFluidHandler(world, pos, null); + final FluidActionResult fluidActionResult = FluidUtil.tryFillContainer(new ItemStack(Items.BUCKET), fluidHandler, 1000, null, false); + if (fluidActionResult.isSuccess()) { + final ItemStack result = fluidActionResult.getResult(); + if (!result.isEmpty()) { + stack = result; + } + } + } + if (stack == null || stack.getItem() == ItemStack.EMPTY.getItem()) { Reference.logger.warn("Could not find the item for: {}", blockState); continue; From 45294cc7495761f7bedb9dec1477d855b350bc5f Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 20 Dec 2016 00:10:00 +0100 Subject: [PATCH 290/314] Replace null checks with .isEmpty() checks. --- .../schematica/client/printer/SchematicPrinter.java | 6 +++--- .../github/lunatrius/schematica/client/util/BlockList.java | 4 ++-- .../schematica/client/util/BlockStateToItemStack.java | 6 ++++-- .../lunatrius/schematica/world/schematic/SchematicUtil.java | 6 +++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 04b19f11..605fbea8 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -211,7 +211,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, } final ItemStack itemStack = BlockStateToItemStack.getItemStack(blockState, new RayTraceResult(player), this.schematic, pos, player); - if (itemStack == null || itemStack.getItem() == null) { + if (itemStack.isEmpty()) { Reference.logger.debug("{} is missing a mapping!", blockState); return false; } @@ -321,7 +321,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, final ItemStack itemStack = player.getHeldItem(hand); boolean success = false; - if (!this.minecraft.playerController.isInCreativeMode() && itemStack != null && itemStack.getCount() <= extraClicks) { + if (!this.minecraft.playerController.isInCreativeMode() && !itemStack.isEmpty() && itemStack.getCount() <= extraClicks) { return false; } @@ -334,7 +334,7 @@ private boolean placeBlock(final WorldClient world, final EntityPlayerSP player, success = placeBlock(world, player, itemStack, offset, side, hitVec, hand); } - if (itemStack != null && itemStack.getCount() == 0 && success) { + if (itemStack.getCount() == 0 && success) { player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index bc4fce2e..bc4a2734 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -53,7 +53,7 @@ public List getList(final EntityPlayer player, final Schematic final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); final boolean isPlaced = BlockStateHelper.areBlockStatesEqual(blockState, mcBlockState); - ItemStack stack = null; + ItemStack stack = ItemStack.EMPTY; try { stack = block.getPickBlock(blockState, rtr, world, pos, player); @@ -72,7 +72,7 @@ public List getList(final EntityPlayer player, final Schematic } } - if (stack == null || stack.getItem() == ItemStack.EMPTY.getItem()) { + if (stack.isEmpty()) { Reference.logger.warn("Could not find the item for: {}", blockState); continue; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java index 4fc171c0..54b6e94e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockStateToItemStack.java @@ -2,6 +2,7 @@ import com.github.lunatrius.schematica.client.world.SchematicWorld; import com.github.lunatrius.schematica.reference.Reference; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -9,19 +10,20 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +@MethodsReturnNonnullByDefault public class BlockStateToItemStack { public static ItemStack getItemStack(final IBlockState blockState, final RayTraceResult rayTraceResult, final SchematicWorld world, final BlockPos pos, final EntityPlayer player) { final Block block = blockState.getBlock(); try { final ItemStack itemStack = block.getPickBlock(blockState, rayTraceResult, world, pos, player); - if (itemStack != null) { + if (!itemStack.isEmpty()) { return itemStack; } } catch (final Exception e) { Reference.logger.debug("Could not get the pick block for: {}", blockState, e); } - return null; + return ItemStack.EMPTY; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index 69569ac6..d1dc8bec 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -50,12 +50,12 @@ public static ItemStack getIconFromName(final String iconName) { } final ItemStack block = new ItemStack(BLOCK_REGISTRY.getObject(rl), 1, damage); - if (block.getItem() != null) { + if (!block.isEmpty()) { return block; } final ItemStack item = new ItemStack(ITEM_REGISTRY.getObject(rl), 1, damage); - if (item.getItem() != null) { + if (!item.isEmpty()) { return item; } @@ -68,7 +68,7 @@ public static ItemStack getIconFromNBT(final NBTTagCompound tagCompound) { if (tagCompound != null && tagCompound.hasKey(Names.NBT.ICON)) { icon.deserializeNBT(tagCompound.getCompoundTag(Names.NBT.ICON)); - if (icon.getItem() == null) { + if (icon.isEmpty()) { icon = DEFAULT_ICON.copy(); } } From 2c2f5b8895be8618d5352049f077d5478a10cc96 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 29 Dec 2016 16:06:20 +0100 Subject: [PATCH 291/314] When the schematic directory is a relative path, use the internal data directory as the root. --- .../handler/ConfigurationHandler.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index b9365104..53ff31eb 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -47,7 +47,7 @@ public class ConfigurationHandler { public static final boolean[] SWAP_SLOTS_DEFAULT = new boolean[] { false, false, false, false, false, true, true, true, true }; - public static final String SCHEMATIC_DIRECTORY_STR = "schematics"; + public static final String SCHEMATIC_DIRECTORY_STR = "./schematics"; public static final File SCHEMATIC_DIRECTORY_DEFAULT = new File(Schematica.proxy.getDataDirectory(), SCHEMATIC_DIRECTORY_STR); public static final String[] EXTRA_AIR_BLOCKS_DEFAULT = {}; public static final String SORT_TYPE_DEFAULT = ""; @@ -212,7 +212,7 @@ private static void loadConfigurationSwapSlots() { private static void loadConfigurationGeneral() { propSchematicDirectory = configuration.get(Names.Config.Category.GENERAL, Names.Config.SCHEMATIC_DIRECTORY, SCHEMATIC_DIRECTORY_STR, Names.Config.SCHEMATIC_DIRECTORY_DESC); propSchematicDirectory.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.SCHEMATIC_DIRECTORY); - schematicDirectory = new File(propSchematicDirectory.getString()); + schematicDirectory = getSchematicDirectoryFile(propSchematicDirectory.getString()); propExtraAirBlocks = configuration.get(Names.Config.Category.GENERAL, Names.Config.EXTRA_AIR_BLOCKS, EXTRA_AIR_BLOCKS_DEFAULT, Names.Config.EXTRA_AIR_BLOCKS_DESC); propExtraAirBlocks.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.EXTRA_AIR_BLOCKS); @@ -226,6 +226,14 @@ private static void loadConfigurationGeneral() { populateExtraAirBlocks(); } + private static File getSchematicDirectoryFile(String path) { + if (path.startsWith(".")) { + return Schematica.proxy.getDirectory(path); + } + + return new File(path); + } + private static void normalizeSchematicPath() { try { schematicDirectory = schematicDirectory.getCanonicalFile(); @@ -242,11 +250,14 @@ private static void normalizeSchematicPath() { } private static String mergePaths(final String schematicPath, final String dataPath) { + final String newPath; if (schematicPath.startsWith(dataPath)) { - return schematicPath.substring(dataPath.length()).replace("\\", "/").replaceAll("^/+", ""); + newPath = "." + schematicPath.substring(dataPath.length()); + } else { + newPath = schematicPath; } - return schematicPath.replace("\\", "/"); + return newPath.replace("\\", "/"); } private static void populateExtraAirBlocks() { From 86f9ba52067e6cdebf6850d9716078e521889183 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 16 Feb 2017 17:00:04 +0100 Subject: [PATCH 292/314] Add a missing particle override. Fixes gh-200 --- .../lunatrius/schematica/client/renderer/RenderSchematic.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index 48d5602c..a7702244 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -903,6 +903,9 @@ public void playSoundToAllNearExcept(final EntityPlayer player, final SoundEvent @Override public void spawnParticle(final int particleID, final boolean ignoreRange, final double x, final double y, final double z, final double xOffset, final double yOffset, final double zOffset, final int... parameters) {} + @Override + public void spawnParticle(final int particleID, final boolean ignoreRange, final boolean minParticles, final double x, final double y, final double z, final double xOffset, final double yOffset, final double zOffset, final int... parameters) {} + @Override public void onEntityAdded(final Entity entity) {} From f995376d1c4a5729fa0a1eaf8c88d350ad41da07 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 23 Feb 2017 09:17:25 +0100 Subject: [PATCH 293/314] Disable guide rendering on a setting reset. Fixes gh-199 --- .../schematica/client/gui/save/GuiSchematicSave.java | 4 ++-- .../com/github/lunatrius/schematica/proxy/ClientProxy.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index c743f594..8b3098c4 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -83,14 +83,14 @@ public void initGui() { this.numericBZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY + 20); this.buttonList.add(this.numericBZ); - this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, ClientProxy.isRenderingGuide ? this.strOn : this.strOff); + this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled ? this.strOn : this.strOff); this.buttonList.add(this.btnEnable); this.tfFilename = new GuiTextField(id++, this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); this.textFields.add(this.tfFilename); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format(Names.Gui.Save.SAVE)); - this.btnSave.enabled = ClientProxy.isRenderingGuide || ClientProxy.schematic != null; + this.btnSave.enabled = ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled || ClientProxy.schematic != null; this.buttonList.add(this.btnSave); this.tfFilename.setMaxStringLength(1024); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java index 1737bc45..17d9088e 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/ClientProxy.java @@ -21,7 +21,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; - import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; @@ -213,6 +212,8 @@ public void resetSettings() { SchematicPrinter.INSTANCE.setEnabled(true); unloadSchematic(); + isRenderingGuide = false; + playerPosition.set(0, 0, 0); orientation = null; rotationRender = 0; From 4d46b34583b85a579354e0b5080a4660d66a2548 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 2 Apr 2017 20:41:18 +0200 Subject: [PATCH 294/314] Add placement mappings for end rods, observers and command blocks. Closes gh-209 --- .../client/printer/registry/PlacementRegistry.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index f258fc86..bdb76d21 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -6,12 +6,14 @@ import net.minecraft.block.BlockChest; import net.minecraft.block.BlockDispenser; import net.minecraft.block.BlockDoor; +import net.minecraft.block.BlockEndRod; import net.minecraft.block.BlockEnderChest; import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockFurnace; import net.minecraft.block.BlockHopper; import net.minecraft.block.BlockLever; import net.minecraft.block.BlockLog; +import net.minecraft.block.BlockObserver; import net.minecraft.block.BlockPistonBase; import net.minecraft.block.BlockPumpkin; import net.minecraft.block.BlockQuartz; @@ -72,6 +74,13 @@ public boolean isValid(final IBlockState blockState, final EntityPlayer player, return facing == EnumFacing.getDirectionFromEntityLiving(pos, player); } }; + final IValidPlayerFacing playerFacingObserver = new IValidPlayerFacing() { + @Override + public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == EnumFacing.getDirectionFromEntityLiving(pos, player).getOpposite(); + } + }; final IValidPlayerFacing playerFacingRotateY = new IValidPlayerFacing() { @Override public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { @@ -277,9 +286,11 @@ public int getExtraClicks(final IBlockState blockState) { addPlacementMapping(BlockDispenser.class, new PlacementData(playerFacingPiston)); addPlacementMapping(BlockDoor.class, new PlacementData(playerFacingEntity)); addPlacementMapping(BlockEnderChest.class, new PlacementData(playerFacingEntityOpposite)); + addPlacementMapping(BlockEndRod.class, new PlacementData(blockFacingOpposite)); addPlacementMapping(BlockFenceGate.class, new PlacementData(playerFacingEntity)); addPlacementMapping(BlockFurnace.class, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(BlockHopper.class, new PlacementData(blockFacingHopper)); + addPlacementMapping(BlockObserver.class, new PlacementData(playerFacingObserver)); addPlacementMapping(BlockPistonBase.class, new PlacementData(playerFacingPiston)); addPlacementMapping(BlockPumpkin.class, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(BlockRotatedPillar.class, new PlacementData(blockFacingPillar)); @@ -289,11 +300,13 @@ public int getExtraClicks(final IBlockState blockState) { addPlacementMapping(BlockTrapDoor.class, new PlacementData(blockFacingOpposite).setOffsetY(offsetTrapDoor)); addPlacementMapping(Blocks.ANVIL, new PlacementData(playerFacingRotateY)); + addPlacementMapping(Blocks.CHAIN_COMMAND_BLOCK, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(Blocks.COCOA, new PlacementData(blockFacingSame)); addPlacementMapping(Blocks.END_PORTAL_FRAME, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(Blocks.LADDER, new PlacementData(blockFacingOpposite)); addPlacementMapping(Blocks.LEVER, new PlacementData(playerFacingLever, blockFacingLever)); addPlacementMapping(Blocks.QUARTZ_BLOCK, new PlacementData(blockFacingQuartz)); + addPlacementMapping(Blocks.REPEATING_COMMAND_BLOCK, new PlacementData(playerFacingEntityOpposite)); addPlacementMapping(Blocks.STANDING_SIGN, new PlacementData(playerFacingStandingSign)); addPlacementMapping(Blocks.TRIPWIRE_HOOK, new PlacementData(blockFacingOpposite)); addPlacementMapping(Blocks.WALL_SIGN, new PlacementData(blockFacingOpposite)); From 272d9f51763b047dd53a0b861bfdcdc58c6a5465 Mon Sep 17 00:00:00 2001 From: Timofey Date: Sun, 18 Jun 2017 22:15:41 +0300 Subject: [PATCH 295/314] ru_ru: update --- .../assets/schematica/lang/ru_ru.lang | 134 ++++++++++++++++-- 1 file changed, 126 insertions(+), 8 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ru_ru.lang b/src/main/resources/assets/schematica/lang/ru_ru.lang index f6c03425..667934f0 100644 --- a/src/main/resources/assets/schematica/lang/ru_ru.lang +++ b/src/main/resources/assets/schematica/lang/ru_ru.lang @@ -2,63 +2,181 @@ schematica.gui.x=X: schematica.gui.y=Y: schematica.gui.z=Z: +schematica.gui.on=Вкл +schematica.gui.off=Выкл schematica.gui.done=Готово +schematica.gui.down=Низ +schematica.gui.up=Верх +schematica.gui.north=Север +schematica.gui.south=Юг +schematica.gui.west=Запад +schematica.gui.east=Восток # gui - general - load -schematica.gui.title=Выберите файл схемы -schematica.gui.folderInfo=(Место хранения схем) -schematica.gui.openFolder=Открыть папку со схемами +schematica.gui.title=Выбор схемы +schematica.gui.folderInfo=(Поместите сюда схемы) +schematica.gui.openFolder=Папка со схемами schematica.gui.noschematic=-- Нет схем -- # gui - general - save schematica.gui.point.red=Красная точка schematica.gui.point.blue=Синяя точка schematica.gui.save=Сохранить -schematica.gui.saveselection=Сохранить схему выделенной области +schematica.gui.saveselection=Сохранение схемы # gui - general - control schematica.gui.moveschematic=Передвинуть схему schematica.gui.materials=Материалы schematica.gui.printer=Принтер schematica.gui.operations=Операции -schematica.gui.all=ВСЕ -schematica.gui.layers=Слои -schematica.gui.hide=Спрятать +schematica.gui.unload=Выгрузить +schematica.gui.all=Все слои +schematica.gui.layers=Один слой +schematica.gui.hide=Скрыть schematica.gui.show=Показать schematica.gui.movehere=Передвинуть сюда schematica.gui.flip=Отразить schematica.gui.rotate=Повернуть schematica.gui.materialname=Материал schematica.gui.materialamount=Количество +schematica.gui.materialavailable=Доступен +schematica.gui.materialmissing=Отсутствует +schematica.gui.materialdump=Сохранить в файл # gui - config - categories +schematica.config.category.debug=Отладка +schematica.config.category.debug.tooltip=Настройки разработчика.\nНе трогайте, если не знаете, что делать. +schematica.config.category.render=Отображение +schematica.config.category.render.tooltip=Настройки отображения. +schematica.config.category.printer=Принтер +schematica.config.category.printer.tooltip=Настройки принтера. +schematica.config.category.printer.swapslots=Слоты быстрого доступа +schematica.config.category.printer.swapslots.tooltip=Использование принтером занятых слотов. +schematica.config.category.general=Общие +schematica.config.category.general.tooltip=Общие настройки. +schematica.config.category.server=Сервер +schematica.config.category.server.tooltip=Настройки сервера. # gui - config - debug +#schematica.config.dumpBlockList=Dump Block List +#schematica.config.dumpBlockList.tooltip=Dump all block states on startup. +schematica.config.showDebugInfo=Информация отладки +schematica.config.showDebugInfo.tooltip=Отображает дополнительную информацию на экране отладки (F3). # gui - config - render +schematica.config.alphaEnabled=Прозрачность +schematica.config.alphaEnabled.tooltip=Делает текстуры прозрачными. +schematica.config.alpha=Прозрачность +schematica.config.alpha.tooltip=Значение, используемое при отображении схемы (1.0 = непрозрачная, 0.5 = полупрозрачная, 0.0 = прозрачная). +schematica.config.highlight=Выделение блоков +schematica.config.highlight.tooltip=Выделение неверно поставленных и необходимых для постройки блоков. +schematica.config.highlightAir=Выделение воздуха +schematica.config.highlightAir.tooltip=Выделение блоков, которые должны быть воздухом. +#schematica.config.blockDelta=Block Delta +#schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). +schematica.config.renderDistance=Дальность прорисовки +schematica.config.renderDistance.tooltip=Дальность прорисовки схемы. # gui - config - printer +schematica.config.placeDelay=Задержка размещения +schematica.config.placeDelay.tooltip=Задержка между попытками размещения блока (в тактах). +#schematica.config.timeout=Timeout +#schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. +schematica.config.placeDistance=Дальность размещения +schematica.config.placeDistance.tooltip=Максимальная дальность размещения блоков. +schematica.config.placeInstantly=Мгновенное размещение +schematica.config.placeInstantly.tooltip=Размещение всех блоков, которые возможно поставить. +schematica.config.destroyBlocks=Разрушение блоков +schematica.config.destroyBlocks.tooltip=Принтер может разрушать блоки (только для творческого режима). +schematica.config.destroyInstantly=Мгновенное разрушение +schematica.config.destroyInstantly.tooltip=Разрушение всех блоков, которые возможно разрушить. +schematica.config.placeAdjacent=Соседнее размещение +schematica.config.placeAdjacent.tooltip=Блоки размещаются только при наличии других блоков около них. # gui - config - printer - swap slots +schematica.config.swapSlot0=Слот 1 +schematica.config.swapSlot0.tooltip=Позволяет принтеру использовать слот 1. +schematica.config.swapSlot1=Слот 2 +schematica.config.swapSlot1.tooltip=Позволяет принтеру использовать слот 2. +schematica.config.swapSlot2=Слот 3 +schematica.config.swapSlot2.tooltip=Позволяет принтеру использовать слот 3. +schematica.config.swapSlot3=Слот 4 +schematica.config.swapSlot3.tooltip=Позволяет принтеру использовать слот 4. +schematica.config.swapSlot4=Слот 5 +schematica.config.swapSlot4.tooltip=Позволяет принтеру использовать слот 5. +schematica.config.swapSlot5=Слот 6 +schematica.config.swapSlot5.tooltip=Позволяет принтеру использовать слот 6. +schematica.config.swapSlot6=Слот 7 +schematica.config.swapSlot6.tooltip=Позволяет принтеру использовать слот 7. +schematica.config.swapSlot7=Слот 8 +schematica.config.swapSlot7.tooltip=Позволяет принтеру использовать слот 8. +schematica.config.swapSlot8=Слот 9 +schematica.config.swapSlot8.tooltip=Позволяет принтеру использовать слот 9. # gui - config - general +schematica.config.schematicDirectory=Папка схем +schematica.config.schematicDirectory.tooltip=Папка, в которой хранятся схемы. +schematica.config.extraAirBlocks=Блоки воздуха +schematica.config.extraAirBlocks.tooltip=Данные блоки отображаются в схемах как воздух. # gui - config - server +schematica.config.printerEnabled=Принтер +schematica.config.printerEnabled.tooltip=Позволяет игрокам использовать принтер. +schematica.config.saveEnabled=Сохранение +schematica.config.saveEnabled.tooltip=Позволяет игрокам сохранять схемы. +schematica.config.loadEnabled=Загрузка +schematica.config.loadEnabled.tooltip=Позволяет игрокам загружать схемы. # keys schematica.key.category=Schematica schematica.key.load=Загрузить схему schematica.key.save=Сохранить схему -schematica.key.control=Манипулирование схемой +schematica.key.control=Управление схемой +schematica.key.layerInc=Следующий слой +schematica.key.layerDec=Предыдущий слой +schematica.key.layerToggle=Все/один слой +schematica.key.renderToggle=Отображение +schematica.key.printerToggle=Принтер +schematica.key.moveHere=Передвинуть сюда +schematica.key.pickBlock=Выбор блока в схеме # commands - save +schematica.command.save.usage=/schematicaSave <началоX> <началоY> <началоZ> <конецX> <конецY> <конецZ> <название> +schematica.command.save.playersOnly=Только игроки могут использовать данную команду. +schematica.command.save.started=Сохранение %d чанка(-ов) в файл %s... +schematica.command.save.saveSucceeded=Схема %s сохранена. +schematica.command.save.saveFailed=Произошла ошибка при сохранении файла %s. +schematica.command.save.quotaExceeded=Превышена квота сервера. Используйте /schematicaList и /schematicaRemove, чтобы удалить старые схемы. +schematica.command.save.playerSchematicDirUnavailable=Произошла ошибка на сервере, из-за которой неудалось сохранить схему. Свяжитесь с администратором сервера. # commands - list +schematica.command.list.usage=/schematicaList [страница] +schematica.command.list.notAvailable=Произошла ошибка при получении списка схем. +schematica.command.list.remove=Удалить +schematica.command.list.download=Загрузить +schematica.command.list.header=--- Схемы, страница %d из %d --- +schematica.command.list.noSuchPage=Данной страницы не существует. +schematica.command.list.noSchematics=Нет доступных схем. # commands - remove +schematica.command.remove.usage=/schematicaRemove <название> +schematica.command.remove.schematicRemoved=Схема «%s» удалена. +schematica.command.remove.schematicNotFound=Схема «%s» не найдена. +schematica.command.remove.areYouSure=Уверены? # commands - download +schematica.command.download.usage=/schematicaDownload <название> +schematica.command.download.started=Загрузка файла «%s»... +schematica.command.download.downloadSucceeded=Схема «%s» успешно загружена. +schematica.command.download.downloadFail=Произошла ошибка во время загрузки. # commands - replace +schematica.command.replace.usage=/schematicaReplace <оригинал> <замена> +schematica.command.replace.noSchematic=Нет загруженных схем. +schematica.command.replace.success=%s блоков заменено. # messages +schematica.message.togglePrinter=Принтер: %s +schematica.message.invalidBlock=Блок «%s» не существует. +schematica.message.invalidProperty=Свойтво «%s» не существует. +schematica.message.invalidPropertyForBlock=Свойтво «%s» не существует у блока «%s». From 898851e81a62b1a5449b86d5e14b9a7408a032ee Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Thu, 20 Jul 2017 23:04:42 +0200 Subject: [PATCH 296/314] Add eclipse launch files to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8b1a36e7..ef1b8e41 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /.classpath /.project /bin +*.launch ## intellij /out From f212e5b3944a59aced877668dc69b9deca991cdc Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 11 Jul 2017 11:49:43 -0700 Subject: [PATCH 297/314] Clean up unnamed method parameters These have names in MCP; they just weren't present here. I didn't touch the GuiSlot-related names becasue I'm not 100% confident on the current MCP names for those; it's something that I plan to investigate in the future, but for now leaving them unnamed is fine. --- .../schematica/client/gui/control/GuiSchematicControl.java | 4 ++-- .../client/gui/control/GuiSchematicMaterialsSlot.java | 6 +++--- .../schematica/client/gui/save/GuiSchematicSave.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index 2e7b8637..73eceac9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -235,7 +235,7 @@ public void handleKeyboardInput() throws IOException { } @Override - public void drawScreen(final int par1, final int par2, final float par3) { + public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) { // drawDefaultBackground(); drawCenteredString(this.fontRendererObj, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); @@ -248,6 +248,6 @@ public void drawScreen(final int par1, final int par2, final float par3) { drawString(this.fontRendererObj, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); drawString(this.fontRendererObj, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); - super.drawScreen(par1, par2, par3); + super.drawScreen(mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java index c84702eb..d5fce7b6 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java @@ -20,9 +20,9 @@ class GuiSchematicMaterialsSlot extends GuiSlot { protected int selectedIndex = -1; - public GuiSchematicMaterialsSlot(final GuiSchematicMaterials par1) { - super(Minecraft.getMinecraft(), par1.width, par1.height, 16, par1.height - 34, 24); - this.guiSchematicMaterials = par1; + public GuiSchematicMaterialsSlot(final GuiSchematicMaterials parent) { + super(Minecraft.getMinecraft(), parent.width, parent.height, 16, parent.height - 34, 24); + this.guiSchematicMaterials = parent; this.selectedIndex = -1; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index 8b3098c4..cfda5294 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -172,7 +172,7 @@ protected void keyTyped(final char character, final int code) throws IOException } @Override - public void drawScreen(final int par1, final int par2, final float par3) { + public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) { // drawDefaultBackground(); drawString(this.fontRendererObj, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); @@ -195,6 +195,6 @@ public void drawScreen(final int par1, final int par2, final float par3) { drawString(this.fontRendererObj, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); - super.drawScreen(par1, par2, par3); + super.drawScreen(mouseX, mouseY, partialTicks); } } From 39e18df723a4d21ea72ee2bce1a57a613a888f49 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 11 Jul 2017 11:13:54 -0700 Subject: [PATCH 298/314] Remove bare section signs Bare section signs can cause encoding issues, and in any case these messages are better off has constants. --- .../schematica/handler/client/OverlayHandler.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index a51f5883..bd7949f2 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -10,6 +10,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; @@ -21,6 +22,9 @@ public class OverlayHandler { private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private final Minecraft minecraft = Minecraft.getMinecraft(); + private static final String SCHEMATICA_PREFIX = "[" + TextFormatting.GOLD + "Schematica" + TextFormatting.RESET + "] "; + private static final String SCHEMATICA_SUFFIX = " [" + TextFormatting.GOLD + "S" + TextFormatting.RESET + "]"; + @SubscribeEvent public void onText(final RenderGameOverlayEvent.Text event) { if (this.minecraft.gameSettings.showDebugInfo && ConfigurationHandler.showDebugInfo) { @@ -30,10 +34,9 @@ public void onText(final RenderGameOverlayEvent.Text event) { final ArrayList right = event.getRight(); left.add(""); - left.add("[§6Schematica§r] " + schematic.getDebugDimensions()); - // event.left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoEntities()); - left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); - left.add("[§6Schematica§r] " + RenderSchematic.INSTANCE.getDebugInfoRenders()); + left.add(SCHEMATICA_PREFIX + schematic.getDebugDimensions()); + left.add(SCHEMATICA_PREFIX + RenderSchematic.INSTANCE.getDebugInfoTileEntities()); + left.add(SCHEMATICA_PREFIX + RenderSchematic.INSTANCE.getDebugInfoRenders()); final RayTraceResult rtr = ClientProxy.objectMouseOver; if (rtr != null && rtr.typeOfHit == RayTraceResult.Type.BLOCK) { @@ -41,10 +44,10 @@ public void onText(final RenderGameOverlayEvent.Text event) { final IBlockState blockState = schematic.getBlockState(pos); right.add(""); - right.add(String.valueOf(BLOCK_REGISTRY.getNameForObject(blockState.getBlock())) + " [§6S§r]"); + right.add(String.valueOf(BLOCK_REGISTRY.getNameForObject(blockState.getBlock())) + SCHEMATICA_SUFFIX); for (final String formattedProperty : BlockStateHelper.getFormattedProperties(blockState)) { - right.add(formattedProperty + " [§6S§r]"); + right.add(formattedProperty + SCHEMATICA_SUFFIX); } } } From 8aed5428ba6c95d657ea8468a704dc1b92dc863c Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Tue, 11 Jul 2017 11:42:23 -0700 Subject: [PATCH 299/314] Indicate the position in the schematic that is being looked at Also, note whether the location in the schematic is the same as in the normal world. This is useful e.g. to check if there's a hole below. --- .../schematica/handler/client/OverlayHandler.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index bd7949f2..5d873856 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -49,6 +49,17 @@ public void onText(final RenderGameOverlayEvent.Text event) { for (final String formattedProperty : BlockStateHelper.getFormattedProperties(blockState)) { right.add(formattedProperty + SCHEMATICA_SUFFIX); } + + final BlockPos offsetPos = pos.add(schematic.position); + String lookMessage = String.format("Looking at: %d %d %d (%d %d %d)", pos.getX(), pos.getY(), pos.getZ(), offsetPos.getX(), offsetPos.getY(), offsetPos.getZ()); + if (this.minecraft.objectMouseOver != null && this.minecraft.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) { + final BlockPos origPos = this.minecraft.objectMouseOver.getBlockPos(); + if (offsetPos.equals(origPos)) { + lookMessage += " (matches)"; + } + } + + left.add(SCHEMATICA_PREFIX + lookMessage); } } } From 4dbcf156673f0337907fcebb5c658fbf62531798 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 25 Jul 2017 13:17:15 +0200 Subject: [PATCH 300/314] Update to 1.12. --- build.gradle | 18 +++++++-- gradle.properties | 10 ++--- .../state/pattern/BlockStateReplacer.java | 9 ++--- .../client/gui/config/GuiFactory.java | 10 ++--- .../gui/control/GuiSchematicControl.java | 24 +++++------ .../gui/control/GuiSchematicMaterials.java | 4 +- .../control/GuiSchematicMaterialsSlot.java | 8 ++-- .../client/gui/load/GuiSchematicLoad.java | 4 +- .../client/gui/load/GuiSchematicLoadSlot.java | 4 +- .../client/gui/save/GuiSchematicSave.java | 40 +++++++++---------- .../client/renderer/RenderSchematic.java | 16 ++++---- .../chunk/OverlayRenderDispatcher.java | 9 ++++- .../renderer/chunk/overlay/RenderOverlay.java | 7 ++-- .../chunk/proxy/SchematicRenderChunkList.java | 5 +++ .../chunk/proxy/SchematicRenderChunkVbo.java | 5 +++ .../schematica/client/util/FlipHelper.java | 8 +--- .../client/util/RotationHelper.java | 9 ++--- .../world/chunk/ChunkProviderSchematic.java | 8 ++-- .../client/world/chunk/ChunkSchematic.java | 2 +- .../client/CommandSchematicaReplace.java | 16 ++++---- .../handler/ConfigurationHandler.java | 5 +-- .../handler/client/OverlayHandler.java | 5 +-- .../handler/client/RenderTickHandler.java | 2 +- .../message/MessageDownloadBeginAck.java | 2 +- .../network/message/MessageDownloadChunk.java | 8 +--- .../message/MessageDownloadChunkAck.java | 2 +- .../world/schematic/SchematicAlpha.java | 18 ++++----- .../world/schematic/SchematicUtil.java | 8 +--- .../schematica/world/storage/Schematic.java | 7 +--- src/main/resources/META-INF/schematica_at.cfg | 8 ++-- .../assets/schematica/lang/ru_ru.lang | 6 --- 31 files changed, 140 insertions(+), 147 deletions(-) diff --git a/build.gradle b/build.gradle index 654c8c85..624c970f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,10 @@ buildscript { repositories { mavenCentral() jcenter() + maven { + name = 'gradle plugins' + url "https://plugins.gradle.org/m2/" + } maven { name = 'forge' url = 'http://files.minecraftforge.net/maven' @@ -12,8 +16,8 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' - classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.0.9' } } @@ -26,7 +30,15 @@ ext.modversion = "${project.version_major}.${project.version_minor}.${project.ve group = 'com.github.lunatrius' version = "${project.version_minecraft}-${modversion}" -compileJava.options.encoding = 'UTF-8' +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +compileJava { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' + + options.encoding = 'UTF-8' +} minecraft { version = "${project.version_minecraft}-${project.version_forge}" diff --git a/gradle.properties b/gradle.properties index 1c8ae35a..77da16c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=7 version_micro=8 -version_minecraft=1.11 -version_forge=13.19.0.2177 -version_minforge=13.19.0.2172 -version_mappings=snapshot_20161203 -version_lunatriuscore=1.1.2.39 +version_minecraft=1.12 +version_forge=14.21.1.2415 +version_minforge=14.21.1.2387 +version_mappings=snapshot_20170720 +version_lunatriuscore=1.2.0.40 extra_modsio_id=1008 extra_curseforge_id=225603 diff --git a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java index cdc4ca22..a72c34dc 100644 --- a/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java +++ b/src/main/java/com/github/lunatrius/schematica/block/state/pattern/BlockStateReplacer.java @@ -8,15 +8,12 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.Collection; import java.util.HashMap; import java.util.Map; public class BlockStateReplacer { - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private final IBlockState defaultReplacement; private BlockStateReplacer(final IBlockState defaultReplacement) { @@ -80,11 +77,11 @@ public static BlockStateInfo fromString(final String input) throws LocalizedExce } final ResourceLocation location = new ResourceLocation(blockName); - if (!BLOCK_REGISTRY.containsKey(location)) { + if (!Block.REGISTRY.containsKey(location)) { throw new LocalizedException(Names.Messages.INVALID_BLOCK, blockName); } - final Block block = BLOCK_REGISTRY.getObject(location); + final Block block = Block.REGISTRY.getObject(location); final Map propertyData = parsePropertyData(block.getDefaultState(), stateData, true); return new BlockStateInfo(block, propertyData); } @@ -124,7 +121,7 @@ private static boolean putMatchingProperty(final Map map, } if (strict) { - throw new LocalizedException(Names.Messages.INVALID_PROPERTY_FOR_BLOCK, name + "=" + value, BLOCK_REGISTRY.getNameForObject(blockState.getBlock())); + throw new LocalizedException(Names.Messages.INVALID_PROPERTY_FOR_BLOCK, name + "=" + value, Block.REGISTRY.getNameForObject(blockState.getBlock())); } return false; diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java b/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java index 2956a007..1aa53328 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/config/GuiFactory.java @@ -16,17 +16,17 @@ public void initialize(final Minecraft minecraftInstance) { } @Override - public Class mainConfigGuiClass() { - return GuiModConfig.class; + public boolean hasConfigGui() { + return true; } @Override - public Set runtimeGuiCategories() { - return null; + public GuiScreen createConfigGui(GuiScreen parentScreen) { + return new GuiModConfig(parentScreen); } @Override - public RuntimeOptionGuiHandler getHandlerFor(final RuntimeOptionCategoryElement element) { + public Set runtimeGuiCategories() { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index 73eceac9..6369b358 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -75,13 +75,13 @@ public void initGui() { int id = 0; - this.numericX = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY - 30, 100, 20); + this.numericX = new GuiNumericField(this.fontRenderer, id++, this.centerX - 50, this.centerY - 30, 100, 20); this.buttonList.add(this.numericX); - this.numericY = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY - 5, 100, 20); + this.numericY = new GuiNumericField(this.fontRenderer, id++, this.centerX - 50, this.centerY - 5, 100, 20); this.buttonList.add(this.numericY); - this.numericZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 50, this.centerY + 20, 100, 20); + this.numericZ = new GuiNumericField(this.fontRenderer, id++, this.centerX - 50, this.centerY + 20, 100, 20); this.buttonList.add(this.numericZ); this.btnUnload = new GuiButton(id++, this.width - 90, this.height - 200, 80, 20, this.strUnload); @@ -90,7 +90,7 @@ public void initGui() { this.btnLayerMode = new GuiButton(id++, this.width - 90, this.height - 150 - 25, 80, 20, this.schematic != null && this.schematic.isRenderingLayer ? this.strLayers : this.strAll); this.buttonList.add(this.btnLayerMode); - this.nfLayer = new GuiNumericField(this.fontRendererObj, id++, this.width - 90, this.height - 150, 80, 20); + this.nfLayer = new GuiNumericField(this.fontRenderer, id++, this.width - 90, this.height - 150, 80, 20); this.buttonList.add(this.nfLayer); this.btnHide = new GuiButton(id++, this.width - 90, this.height - 105, 80, 20, this.schematic != null && this.schematic.isRendering ? this.strHide : this.strShow); @@ -238,15 +238,15 @@ public void handleKeyboardInput() throws IOException { public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) { // drawDefaultBackground(); - drawCenteredString(this.fontRendererObj, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strMaterials, 50, this.height - 85, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strPrinter, 50, this.height - 45, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); + drawCenteredString(this.fontRenderer, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); + drawCenteredString(this.fontRenderer, this.strMaterials, 50, this.height - 85, 0xFFFFFF); + drawCenteredString(this.fontRenderer, this.strPrinter, 50, this.height - 45, 0xFFFFFF); + drawCenteredString(this.fontRenderer, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); + drawCenteredString(this.fontRenderer, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); - drawString(this.fontRendererObj, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRenderer, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRenderer, this.strY, this.centerX - 65, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRenderer, this.strZ, this.centerX - 65, this.centerY + 26, 0xFFFFFF); super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index c68cba7a..ae7642ed 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -97,8 +97,8 @@ public void renderToolTip(final ItemStack stack, final int x, final int y) { public void drawScreen(final int x, final int y, final float partialTicks) { this.guiSchematicMaterialsSlot.drawScreen(x, y, partialTicks); - drawString(this.fontRendererObj, this.strMaterialName, this.width / 2 - 108, 4, 0x00FFFFFF); - drawString(this.fontRendererObj, this.strMaterialAmount, this.width / 2 + 108 - this.fontRendererObj.getStringWidth(this.strMaterialAmount), 4, 0x00FFFFFF); + drawString(this.fontRenderer, this.strMaterialName, this.width / 2 - 108, 4, 0x00FFFFFF); + drawString(this.fontRenderer, this.strMaterialAmount, this.width / 2 + 108 - this.fontRenderer.getStringWidth(this.strMaterialAmount), 4, 0x00FFFFFF); super.drawScreen(x, y, partialTicks); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java index d5fce7b6..4952261c 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterialsSlot.java @@ -55,7 +55,7 @@ protected int getScrollBarX() { } @Override - protected void drawSlot(final int index, final int x, final int y, final int par4, final int mouseX, final int mouseY) { + protected void drawSlot(final int index, final int x, final int y, final int par4, final int mouseX, final int mouseY, final float partialTicks) { final BlockList.WrappedItemStack wrappedItemStack = this.guiSchematicMaterials.blockList.get(index); final ItemStack itemStack = wrappedItemStack.itemStack; @@ -65,9 +65,9 @@ protected void drawSlot(final int index, final int x, final int y, final int par GuiHelper.drawItemStackWithSlot(this.minecraft.renderEngine, itemStack, x, y); - this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, itemName, x + 24, y + 6, 0xFFFFFF); - this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amount, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amount), y + 1, 0xFFFFFF); - this.guiSchematicMaterials.drawString(this.minecraft.fontRendererObj, amountMissing, x + 215 - this.minecraft.fontRendererObj.getStringWidth(amountMissing), y + 11, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, itemName, x + 24, y + 6, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amount, x + 215 - this.minecraft.fontRenderer.getStringWidth(amount), y + 1, 0xFFFFFF); + this.guiSchematicMaterials.drawString(this.minecraft.fontRenderer, amountMissing, x + 215 - this.minecraft.fontRenderer.getStringWidth(amountMissing), y + 11, 0xFFFFFF); if (mouseX > x && mouseY > y && mouseX <= x + 18 && mouseY <= y + 18) { this.guiSchematicMaterials.renderToolTip(itemStack, mouseX, mouseY); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java index 547c6761..cb7377d8 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java @@ -97,8 +97,8 @@ protected void actionPerformed(final GuiButton guiButton) { public void drawScreen(final int x, final int y, final float partialTicks) { this.guiSchematicLoadSlot.drawScreen(x, y, partialTicks); - drawCenteredString(this.fontRendererObj, this.strTitle, this.width / 2, 4, 0x00FFFFFF); - drawCenteredString(this.fontRendererObj, this.strFolderInfo, this.width / 2 - 78, this.height - 12, 0x00808080); + drawCenteredString(this.fontRenderer, this.strTitle, this.width / 2, 4, 0x00FFFFFF); + drawCenteredString(this.fontRenderer, this.strFolderInfo, this.width / 2 - 78, this.height - 12, 0x00808080); super.drawScreen(x, y, partialTicks); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java index 239562f4..70af8206 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java @@ -55,7 +55,7 @@ protected void drawContainerBackground(final Tessellator tessellator) { } @Override - protected void drawSlot(final int index, final int x, final int y, final int par4, final int mouseX, final int mouseY) { + protected void drawSlot(final int index, final int x, final int y, final int par4, final int mouseX, final int mouseY, final float partialTicks) { if (index < 0 || index >= this.guiSchematicLoad.schematicFiles.size()) { return; } @@ -71,6 +71,6 @@ protected void drawSlot(final int index, final int x, final int y, final int par GuiHelper.drawItemStackWithSlot(this.minecraft.renderEngine, schematic.getItemStack(), x, y); - this.guiSchematicLoad.drawString(this.minecraft.fontRendererObj, schematicName, x + 24, y + 6, 0x00FFFFFF); + this.guiSchematicLoad.drawString(this.minecraft.fontRenderer, schematicName, x + 24, y + 6, 0x00FFFFFF); } } diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index cfda5294..b9a1b07f 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -62,31 +62,31 @@ public void initGui() { this.btnPointA = new GuiButton(id++, this.centerX - 130, this.centerY - 55, 100, 20, I18n.format(Names.Gui.Save.POINT_RED)); this.buttonList.add(this.btnPointA); - this.numericAX = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY - 30); + this.numericAX = new GuiNumericField(this.fontRenderer, id++, this.centerX - 130, this.centerY - 30); this.buttonList.add(this.numericAX); - this.numericAY = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY - 5); + this.numericAY = new GuiNumericField(this.fontRenderer, id++, this.centerX - 130, this.centerY - 5); this.buttonList.add(this.numericAY); - this.numericAZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX - 130, this.centerY + 20); + this.numericAZ = new GuiNumericField(this.fontRenderer, id++, this.centerX - 130, this.centerY + 20); this.buttonList.add(this.numericAZ); this.btnPointB = new GuiButton(id++, this.centerX + 30, this.centerY - 55, 100, 20, I18n.format(Names.Gui.Save.POINT_BLUE)); this.buttonList.add(this.btnPointB); - this.numericBX = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY - 30); + this.numericBX = new GuiNumericField(this.fontRenderer, id++, this.centerX + 30, this.centerY - 30); this.buttonList.add(this.numericBX); - this.numericBY = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY - 5); + this.numericBY = new GuiNumericField(this.fontRenderer, id++, this.centerX + 30, this.centerY - 5); this.buttonList.add(this.numericBY); - this.numericBZ = new GuiNumericField(this.fontRendererObj, id++, this.centerX + 30, this.centerY + 20); + this.numericBZ = new GuiNumericField(this.fontRenderer, id++, this.centerX + 30, this.centerY + 20); this.buttonList.add(this.numericBZ); this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled ? this.strOn : this.strOff); this.buttonList.add(this.btnEnable); - this.tfFilename = new GuiTextField(id++, this.fontRendererObj, this.width - 155, this.height - 29, 100, 18); + this.tfFilename = new GuiTextField(id++, this.fontRenderer, this.width - 155, this.height - 29, 100, 18); this.textFields.add(this.tfFilename); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format(Names.Gui.Save.SAVE)); @@ -175,25 +175,25 @@ protected void keyTyped(final char character, final int code) throws IOException public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) { // drawDefaultBackground(); - drawString(this.fontRendererObj, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); + drawString(this.fontRenderer, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); - drawString(this.fontRendererObj, this.strX, this.centerX - 145, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRenderer, this.strX, this.centerX - 145, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRenderer, Integer.toString(ClientProxy.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, this.strY, this.centerX - 145, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.y), this.centerX - 25, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRenderer, this.strY, this.centerX - 145, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRenderer, Integer.toString(ClientProxy.pointA.y), this.centerX - 25, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, this.strZ, this.centerX - 145, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointA.z), this.centerX - 25, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRenderer, this.strZ, this.centerX - 145, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRenderer, Integer.toString(ClientProxy.pointA.z), this.centerX - 25, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, this.strX, this.centerX + 15, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.x), this.centerX + 135, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRenderer, this.strX, this.centerX + 15, this.centerY - 24, 0xFFFFFF); + drawString(this.fontRenderer, Integer.toString(ClientProxy.pointB.x), this.centerX + 135, this.centerY - 24, 0xFFFFFF); - drawString(this.fontRendererObj, this.strY, this.centerX + 15, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.y), this.centerX + 135, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRenderer, this.strY, this.centerX + 15, this.centerY + 1, 0xFFFFFF); + drawString(this.fontRenderer, Integer.toString(ClientProxy.pointB.y), this.centerX + 135, this.centerY + 1, 0xFFFFFF); - drawString(this.fontRendererObj, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); - drawString(this.fontRendererObj, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRenderer, this.strZ, this.centerX + 15, this.centerY + 26, 0xFFFFFF); + drawString(this.fontRenderer, Integer.toString(ClientProxy.pointB.z), this.centerX + 135, this.centerY + 26, 0xFFFFFF); super.drawScreen(mouseX, mouseY, partialTicks); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index a7702244..bf6de945 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -23,12 +23,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; @@ -450,8 +450,8 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, final int entityPass = 0; this.profiler.startSection("prepare"); - TileEntityRendererDispatcher.instance.prepare(this.world, this.mc.getTextureManager(), this.mc.fontRendererObj, renderViewEntity, this.mc.objectMouseOver, partialTicks); - this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRendererObj, renderViewEntity, this.mc.pointedEntity, this.mc.gameSettings, partialTicks); + TileEntityRendererDispatcher.instance.prepare(this.world, this.mc.getTextureManager(), this.mc.fontRenderer, renderViewEntity, this.mc.objectMouseOver, partialTicks); + this.renderManager.cacheActiveRenderInfo(this.world, this.mc.fontRenderer, renderViewEntity, this.mc.pointedEntity, this.mc.gameSettings, partialTicks); this.countEntitiesTotal = 0; this.countEntitiesRendered = 0; @@ -491,7 +491,7 @@ public void renderEntities(final Entity renderViewEntity, final ICamera camera, continue; } - TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks, -1); + TileEntityRendererDispatcher.instance.render(tileEntity, partialTicks, -1); this.countTileEntitiesRendered++; } } @@ -660,13 +660,13 @@ public void setupTerrain(final Entity viewEntity, final double partialTicks, fin final RenderChunk renderChunk = renderInfo.renderChunk; final RenderOverlay renderOverlay = renderInfo.renderOverlay; - if (renderChunk.isNeedsUpdate() || set.contains(renderChunk)) { + if (renderChunk.needsUpdate() || set.contains(renderChunk)) { this.displayListEntitiesDirty = true; this.chunksToUpdate.add(renderChunk); } - if (renderOverlay.isNeedsUpdate() || set1.contains(renderOverlay)) { + if (renderOverlay.needsUpdate() || set1.contains(renderOverlay)) { this.displayListEntitiesDirty = true; this.overlaysToUpdate.add(renderOverlay); @@ -808,7 +808,7 @@ public void renderSky(final float partialTicks, final int pass) { } @Override - public void renderClouds(final float partialTicks, final int pass) { + public void renderClouds(final float partialTicks, final int pass, final double x, final double y, final double z) { } @Override @@ -859,7 +859,7 @@ public void updateChunks(final long finishTimeNano) { public void renderWorldBorder(final Entity entity, final float partialTicks) {} @Override - public void drawBlockDamageTexture(final Tessellator tessellator, final VertexBuffer buffer, final Entity entity, final float partialTicks) {} + public void drawBlockDamageTexture(final Tessellator tessellator, final BufferBuilder buffer, final Entity entity, final float partialTicks) {} @Override public void drawSelectionBox(final EntityPlayer player, final RayTraceResult rayTraceResult, final int execute, final float partialTicks) {} diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java index aca49c0d..78fd703a 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/OverlayRenderDispatcher.java @@ -3,14 +3,19 @@ import com.github.lunatrius.schematica.client.renderer.chunk.overlay.RenderOverlayList; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; import net.minecraft.client.renderer.chunk.CompiledChunk; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.util.BlockRenderLayer; +import javax.annotation.ParametersAreNonnullByDefault; + +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class OverlayRenderDispatcher extends ChunkRenderDispatcher { public OverlayRenderDispatcher() { super(); @@ -21,7 +26,7 @@ public OverlayRenderDispatcher(int countRenderBuilders) { } @Override - public ListenableFuture uploadChunk(final BlockRenderLayer layer, final VertexBuffer buffer, final RenderChunk renderChunk, final CompiledChunk compiledChunk, final double distanceSq) { + public ListenableFuture uploadChunk(final BlockRenderLayer layer, final BufferBuilder buffer, final RenderChunk renderChunk, final CompiledChunk compiledChunk, final double distanceSq) { if (!Minecraft.getMinecraft().isCallingFromMinecraftThread() || OpenGlHelper.useVbo()) { return super.uploadChunk(layer, buffer, renderChunk, compiledChunk, distanceSq); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 0b4be95d..9d209373 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -8,6 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; @@ -63,13 +64,13 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final VisGraph visgraph = new VisGraph(); - if (!chunkCache.extendedLevelsInChunkCache()) { + if (!chunkCache.isEmpty()) { ++renderChunksUpdated; final World mcWorld = Minecraft.getMinecraft().world; final BlockRenderLayer layer = BlockRenderLayer.TRANSLUCENT; - final net.minecraft.client.renderer.VertexBuffer buffer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); + final BufferBuilder buffer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(layer); GeometryTessellator.setStaticDelta(ConfigurationHandler.blockDelta); @@ -174,7 +175,7 @@ private int getSides(final IBlockState blockState, final Block block, final Worl } @Override - public void preRenderBlocks(final net.minecraft.client.renderer.VertexBuffer buffer, final BlockPos pos) { + public void preRenderBlocks(final BufferBuilder buffer, final BlockPos pos) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ()); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java index 4a2c0812..c9b375a7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkList.java @@ -2,6 +2,7 @@ import com.github.lunatrius.schematica.client.renderer.SchematicRenderCache; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; @@ -13,7 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.ParametersAreNonnullByDefault; + @SideOnly(Side.CLIENT) +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class SchematicRenderChunkList extends ListedRenderChunk { public SchematicRenderChunkList(final World world, final RenderGlobal renderGlobal, final BlockPos pos, final int index) { super(world, renderGlobal, index); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java index e8782962..2002d926 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/proxy/SchematicRenderChunkVbo.java @@ -2,6 +2,7 @@ import com.github.lunatrius.schematica.client.renderer.SchematicRenderCache; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator; import net.minecraft.client.renderer.chunk.CompiledChunk; @@ -13,7 +14,11 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.ParametersAreNonnullByDefault; + @SideOnly(Side.CLIENT) +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class SchematicRenderChunkVbo extends RenderChunk { public SchematicRenderChunkVbo(final World world, final RenderGlobal renderGlobal, final int index) { super(world, renderGlobal, index); diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java index c2f814b8..35b519dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java @@ -17,16 +17,12 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.List; public class FlipHelper { public static final FlipHelper INSTANCE = new FlipHelper(); - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - public boolean flip(final SchematicWorld world, final EnumFacing axis, final boolean forced) { if (world == null) { return false; @@ -111,11 +107,11 @@ private IBlockState flipBlock(final IBlockState blockState, final EnumFacing axi } } } else if (propertyFacing != null) { - Reference.logger.error("'{}': found 'facing' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); + Reference.logger.error("'{}': found 'facing' property with unknown type {}", Block.REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); } if (!forced && propertyFacing != null) { - throw new FlipException("'%s' cannot be flipped across '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axis); + throw new FlipException("'%s' cannot be flipped across '%s'", Block.REGISTRY.getNameForObject(blockState.getBlock()), axis); } return blockState; diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index 3732105f..67c529f7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -19,15 +19,12 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.List; public class RotationHelper { public static final RotationHelper INSTANCE = new RotationHelper(); - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private static final EnumFacing[][] FACINGS = new EnumFacing[EnumFacing.VALUES.length][]; private static final EnumFacing.Axis[][] AXISES = new EnumFacing.Axis[EnumFacing.Axis.values().length][]; private static final BlockLog.EnumAxis[][] AXISES_LOG = new BlockLog.EnumAxis[EnumFacing.Axis.values().length][]; @@ -171,7 +168,7 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a } } } else if (propertyFacing != null) { - Reference.logger.error("'{}': found 'facing' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); + Reference.logger.error("'{}': found 'facing' property with unknown type {}", Block.REGISTRY.getNameForObject(blockState.getBlock()), propertyFacing.getClass().getSimpleName()); } final IProperty propertyAxis = BlockStateHelper.getProperty(blockState, "axis"); @@ -188,7 +185,7 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a return blockState.withProperty(propertyAxis, axisRotated); } } else if (propertyAxis != null) { - Reference.logger.error("'{}': found 'axis' property with unknown type {}", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), propertyAxis.getClass().getSimpleName()); + Reference.logger.error("'{}': found 'axis' property with unknown type {}", Block.REGISTRY.getNameForObject(blockState.getBlock()), propertyAxis.getClass().getSimpleName()); } final IProperty propertyVariant = BlockStateHelper.getProperty(blockState, "variant"); @@ -201,7 +198,7 @@ private IBlockState rotateBlock(final IBlockState blockState, final EnumFacing a } if (!forced && (propertyFacing != null || propertyAxis != null)) { - throw new RotationException("'%s' cannot be rotated around '%s'", BLOCK_REGISTRY.getNameForObject(blockState.getBlock()), axisRotation); + throw new RotationException("'%s' cannot be rotated around '%s'", Block.REGISTRY.getNameForObject(blockState.getBlock()), axisRotation); } return blockState; diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java index 0bcf1d66..54b6a95d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkProviderSchematic.java @@ -1,7 +1,8 @@ package com.github.lunatrius.schematica.client.world.chunk; import com.github.lunatrius.schematica.client.world.SchematicWorld; -import com.google.common.base.Objects; +import com.google.common.base.MoreObjects; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.client.multiplayer.ChunkProviderClient; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; @@ -12,6 +13,7 @@ import java.util.concurrent.ConcurrentHashMap; // FIXME: `extends ChunkProviderClient` is required for the `WorldClient.getChunkProvider` method to work properly +@MethodsReturnNonnullByDefault public class ChunkProviderSchematic extends ChunkProviderClient implements IChunkProvider { private final SchematicWorld world; private final Chunk emptyChunk; @@ -54,8 +56,6 @@ public Chunk provideChunk(final int x, final int z) { return getLoadedChunk(x, z); } - - @Override public String makeString() { return "SchematicChunkCache"; @@ -64,7 +64,7 @@ public String makeString() { // ChunkProviderClient @Override public Chunk loadChunk(int x, int z) { - return Objects.firstNonNull(getLoadedChunk(x, z), this.emptyChunk); + return MoreObjects.firstNonNull(getLoadedChunk(x, z), this.emptyChunk); } // ChunkProviderClient diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java index f992da5d..be20af50 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/chunk/ChunkSchematic.java @@ -28,7 +28,7 @@ public IBlockState getBlockState(final BlockPos pos) { } @Override - public boolean getAreLevelsEmpty(final int startY, final int endY) { + public boolean isEmptyBetween(final int startY, final int endY) { return false; } diff --git a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java index b752e3a9..5a519a52 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java +++ b/src/main/java/com/github/lunatrius/schematica/command/client/CommandSchematicaReplace.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.command.CommandException; @@ -13,14 +14,15 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.Collections; import java.util.List; +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class CommandSchematicaReplace extends CommandSchematicaBase { - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - @Override public String getName() { return Names.Command.Replace.NAME; @@ -32,12 +34,12 @@ public String getUsage(final ICommandSender sender) { } @Override - public List getTabCompletions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { + public List getTabCompletions(final MinecraftServer server, final ICommandSender sender, final String[] args, @Nullable final BlockPos pos) { if (args.length < 3) { - return getListOfStringsMatchingLastWord(args, BLOCK_REGISTRY.getKeys()); + return getListOfStringsMatchingLastWord(args, Block.REGISTRY.getKeys()); } - return null; + return Collections.emptyList(); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java index 53ff31eb..96da46c5 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/ConfigurationHandler.java @@ -10,8 +10,6 @@ import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.io.File; import java.io.IOException; @@ -23,7 +21,6 @@ public class ConfigurationHandler { public static final ConfigurationHandler INSTANCE = new ConfigurationHandler(); - public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); public static final String VERSION = "1"; @@ -263,7 +260,7 @@ private static String mergePaths(final String schematicPath, final String dataPa private static void populateExtraAirBlocks() { extraAirBlockList.clear(); for (final String name : extraAirBlocks) { - final Block block = BLOCK_REGISTRY.getObject(new ResourceLocation(name)); + final Block block = Block.REGISTRY.getObject(new ResourceLocation(name)); if (block != Blocks.AIR) { extraAirBlockList.add(block); } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java index 5d873856..2c6f9be7 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/OverlayHandler.java @@ -13,13 +13,10 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; public class OverlayHandler { - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private final Minecraft minecraft = Minecraft.getMinecraft(); private static final String SCHEMATICA_PREFIX = "[" + TextFormatting.GOLD + "Schematica" + TextFormatting.RESET + "] "; @@ -44,7 +41,7 @@ public void onText(final RenderGameOverlayEvent.Text event) { final IBlockState blockState = schematic.getBlockState(pos); right.add(""); - right.add(String.valueOf(BLOCK_REGISTRY.getNameForObject(blockState.getBlock())) + SCHEMATICA_SUFFIX); + right.add(String.valueOf(Block.REGISTRY.getNameForObject(blockState.getBlock())) + SCHEMATICA_SUFFIX); for (final String formattedProperty : BlockStateHelper.getFormattedProperties(blockState)) { right.add(formattedProperty + SCHEMATICA_SUFFIX); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java index 49f35850..41429888 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/RenderTickHandler.java @@ -41,7 +41,7 @@ private RayTraceResult rayTrace(final SchematicWorld schematic, final float part final Vec3d vecPosition = renderViewEntity.getPositionEyes(partialTicks); final Vec3d vecLook = renderViewEntity.getLook(partialTicks); - final Vec3d vecExtendedLook = vecPosition.addVector(vecLook.xCoord * blockReachDistance, vecLook.yCoord * blockReachDistance, vecLook.zCoord * blockReachDistance); + final Vec3d vecExtendedLook = vecPosition.addVector(vecLook.x * blockReachDistance, vecLook.y * blockReachDistance, vecLook.z * blockReachDistance); renderViewEntity.posX = posX; renderViewEntity.posY = posY; diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java index c4ddc58e..74b365dd 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadBeginAck.java @@ -21,7 +21,7 @@ public void toBytes(final ByteBuf buf) { @Override public IMessage onMessage(final MessageDownloadBeginAck message, final MessageContext ctx) { - final EntityPlayerMP player = ctx.getServerHandler().playerEntity; + final EntityPlayerMP player = ctx.getServerHandler().player; final SchematicTransfer transfer = DownloadHandler.INSTANCE.transferMap.get(player); if (transfer != null) { transfer.setState(SchematicTransfer.State.CHUNK_WAIT); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java index 9a1ca4c0..55201978 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunk.java @@ -15,15 +15,11 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; import java.util.List; public class MessageDownloadChunk implements IMessage, IMessageHandler { - public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - public int baseX; public int baseY; public int baseZ; @@ -53,7 +49,7 @@ public MessageDownloadChunk(final ISchematic schematic, final int baseX, final i pos.set(baseX + x, baseY + y, baseZ + z); final IBlockState blockState = schematic.getBlockState(pos); final Block block = blockState.getBlock(); - final int id = BLOCK_REGISTRY.getId(block); + final int id = Block.REGISTRY.getIDForObject(block); this.blocks[x][y][z] = (short) id; this.metadata[x][y][z] = (byte) block.getMetaFromState(blockState); final TileEntity tileEntity = schematic.getTileEntity(pos); @@ -72,7 +68,7 @@ private void copyToSchematic(final ISchematic schematic) { for (int z = 0; z < Constants.SchematicChunk.LENGTH; z++) { final short id = this.blocks[x][y][z]; final byte meta = this.metadata[x][y][z]; - final Block block = BLOCK_REGISTRY.getObjectById(id); + final Block block = Block.REGISTRY.getObjectById(id); pos.set(this.baseX + x, this.baseY + y, this.baseZ + z); diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java index 5ad0250d..0dea7fff 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadChunkAck.java @@ -38,7 +38,7 @@ public void toBytes(final ByteBuf buf) { @Override public IMessage onMessage(final MessageDownloadChunkAck message, final MessageContext ctx) { - final EntityPlayerMP player = ctx.getServerHandler().playerEntity; + final EntityPlayerMP player = ctx.getServerHandler().player; final SchematicTransfer transfer = DownloadHandler.INSTANCE.transferMap.get(player); if (transfer != null) { transfer.confirmChunk(message.baseX, message.baseY, message.baseZ); diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 46ad331f..0586d279 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -19,8 +19,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.HashMap; import java.util.List; @@ -28,8 +26,6 @@ import java.util.Set; public class SchematicAlpha extends SchematicFormat { - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - @Override public ISchematic readFromNBT(final NBTTagCompound tagCompound) { final ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); @@ -63,7 +59,7 @@ public ISchematic readFromNBT(final NBTTagCompound tagCompound) { final NBTTagCompound mapping = tagCompound.getCompoundTag(Names.NBT.MAPPING_SCHEMATICA); final Set names = mapping.getKeySet(); for (final String name : names) { - oldToNew.put(mapping.getShort(name), (short) BLOCK_REGISTRY.getId(new ResourceLocation(name))); + oldToNew.put(mapping.getShort(name), (short) Block.REGISTRY.getIDForObject(Block.REGISTRY.getObject(new ResourceLocation(name)))); } } @@ -80,13 +76,13 @@ public ISchematic readFromNBT(final NBTTagCompound tagCompound) { blockID = id; } - final Block block = BLOCK_REGISTRY.getObjectById(blockID); + final Block block = Block.REGISTRY.getObjectById(blockID); pos.set(x, y, z); try { final IBlockState blockState = block.getStateFromMeta(meta); schematic.setBlockState(pos, blockState); } catch (final Exception e) { - Reference.logger.error("Could not set block state at {} to {} with metadata {}", pos, BLOCK_REGISTRY.getNameForObject(block), meta, e); + Reference.logger.error("Could not set block state at {} to {} with metadata {}", pos, Block.REGISTRY.getNameForObject(block), meta, e); } } } @@ -134,14 +130,14 @@ public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic sch final int index = x + (y * schematic.getLength() + z) * schematic.getWidth(); final IBlockState blockState = schematic.getBlockState(pos.set(x, y, z)); final Block block = blockState.getBlock(); - final int blockId = BLOCK_REGISTRY.getId(block); + final int blockId = Block.REGISTRY.getIDForObject(block); localBlocks[index] = (byte) blockId; localMetadata[index] = (byte) block.getMetaFromState(blockState); if ((extraBlocks[index] = (byte) (blockId >> 8)) > 0) { extra = true; } - final String name = String.valueOf(BLOCK_REGISTRY.getNameForObject(block)); + final String name = String.valueOf(Block.REGISTRY.getNameForObject(block)); if (!mappings.containsKey(name)) { mappings.put(name, (short) blockId); } @@ -161,9 +157,9 @@ public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic sch if (--count > 0) { final IBlockState blockState = schematic.getBlockState(tePos); final Block block = blockState.getBlock(); - Reference.logger.error("Block {}[{}] with TileEntity {} failed to save! Replacing with bedrock...", block, block != null ? BLOCK_REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName(), e); + Reference.logger.error("Block {}[{}] with TileEntity {} failed to save! Replacing with bedrock...", block, block != null ? Block.REGISTRY.getNameForObject(block) : "?", tileEntity.getClass().getName(), e); } - localBlocks[index] = (byte) BLOCK_REGISTRY.getId(Blocks.BEDROCK); + localBlocks[index] = (byte) Block.REGISTRY.getIDForObject(Blocks.BEDROCK); localMetadata[index] = 0; extraBlocks[index] = 0; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java index d1dc8bec..945a17ba 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicUtil.java @@ -9,8 +9,6 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.io.File; import java.io.FileInputStream; @@ -18,8 +16,6 @@ public final class SchematicUtil { public static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.GRASS); - public static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); - public static final FMLControlledNamespacedRegistry ITEM_REGISTRY = GameData.getItemRegistry(); public static NBTTagCompound readTagCompoundFromFile(final File file) throws IOException { try { @@ -49,12 +45,12 @@ public static ItemStack getIconFromName(final String iconName) { return DEFAULT_ICON.copy(); } - final ItemStack block = new ItemStack(BLOCK_REGISTRY.getObject(rl), 1, damage); + final ItemStack block = new ItemStack(Block.REGISTRY.getObject(rl), 1, damage); if (!block.isEmpty()) { return block; } - final ItemStack item = new ItemStack(ITEM_REGISTRY.getObject(rl), 1, damage); + final ItemStack item = new ItemStack(Item.REGISTRY.getObject(rl), 1, damage); if (!item.isEmpty()) { return item; } diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index a86c4117..c69b1851 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -9,8 +9,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry; -import net.minecraftforge.fml.common.registry.GameData; import java.util.ArrayList; import java.util.Iterator; @@ -18,7 +16,6 @@ public class Schematic implements ISchematic { private static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.GRASS); - private static final FMLControlledNamespacedRegistry BLOCK_REGISTRY = GameData.getBlockRegistry(); private ItemStack icon; private final short[][][] blocks; @@ -48,7 +45,7 @@ public IBlockState getBlockState(final BlockPos pos) { final int x = pos.getX(); final int y = pos.getY(); final int z = pos.getZ(); - final Block block = BLOCK_REGISTRY.getObjectById(this.blocks[x][y][z]); + final Block block = Block.REGISTRY.getObjectById(this.blocks[x][y][z]); return block.getStateFromMeta(this.metadata[x][y][z]); } @@ -60,7 +57,7 @@ public boolean setBlockState(final BlockPos pos, final IBlockState blockState) { } final Block block = blockState.getBlock(); - final int id = BLOCK_REGISTRY.getId(block); + final int id = Block.REGISTRY.getIDForObject(block); if (id == -1) { return false; } diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index b243cdda..14faa294 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -1,11 +1,11 @@ # Schematica public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher field_178524_h # queueChunkUploads -public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178506_a(Lnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/client/renderer/vertex/VertexBuffer;)V # uploadVertexBuffer -public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178510_a(Lnet/minecraft/client/renderer/VertexBuffer;ILnet/minecraft/client/renderer/chunk/RenderChunk;)V # uploadDisplayList +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178506_a(Lnet/minecraft/client/renderer/BufferBuilder;Lnet/minecraft/client/renderer/vertex/VertexBuffer;)V # uploadVertexBuffer +public net.minecraft.client.renderer.chunk.ChunkRenderDispatcher func_178510_a(Lnet/minecraft/client/renderer/BufferBuilder;ILnet/minecraft/client/renderer/chunk/RenderChunk;)V # uploadDisplayList public net.minecraft.client.renderer.chunk.RenderChunk field_178588_d # world -public net.minecraft.client.renderer.chunk.RenderChunk func_178573_a(Lnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/util/math/BlockPos;)V # preRenderBlocks -public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecraft/util/BlockRenderLayer;FFFLnet/minecraft/client/renderer/VertexBuffer;Lnet/minecraft/client/renderer/chunk/CompiledChunk;)V # postRenderBlocks +public net.minecraft.client.renderer.chunk.RenderChunk func_178573_a(Lnet/minecraft/client/renderer/BufferBuilder;Lnet/minecraft/util/math/BlockPos;)V # preRenderBlocks +public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecraft/util/BlockRenderLayer;FFFLnet/minecraft/client/renderer/BufferBuilder;Lnet/minecraft/client/renderer/chunk/CompiledChunk;)V # postRenderBlocks public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk diff --git a/src/main/resources/assets/schematica/lang/ru_ru.lang b/src/main/resources/assets/schematica/lang/ru_ru.lang index 667934f0..67524476 100644 --- a/src/main/resources/assets/schematica/lang/ru_ru.lang +++ b/src/main/resources/assets/schematica/lang/ru_ru.lang @@ -58,8 +58,6 @@ schematica.config.category.server=Сервер schematica.config.category.server.tooltip=Настройки сервера. # gui - config - debug -#schematica.config.dumpBlockList=Dump Block List -#schematica.config.dumpBlockList.tooltip=Dump all block states on startup. schematica.config.showDebugInfo=Информация отладки schematica.config.showDebugInfo.tooltip=Отображает дополнительную информацию на экране отладки (F3). @@ -72,16 +70,12 @@ schematica.config.highlight=Выделение блоков schematica.config.highlight.tooltip=Выделение неверно поставленных и необходимых для постройки блоков. schematica.config.highlightAir=Выделение воздуха schematica.config.highlightAir.tooltip=Выделение блоков, которые должны быть воздухом. -#schematica.config.blockDelta=Block Delta -#schematica.config.blockDelta.tooltip=Delta value used for highlighting (if you experience z-fighting increase this). schematica.config.renderDistance=Дальность прорисовки schematica.config.renderDistance.tooltip=Дальность прорисовки схемы. # gui - config - printer schematica.config.placeDelay=Задержка размещения schematica.config.placeDelay.tooltip=Задержка между попытками размещения блока (в тактах). -#schematica.config.timeout=Timeout -#schematica.config.timeout.tooltip=Timeout before re-trying failed blocks. schematica.config.placeDistance=Дальность размещения schematica.config.placeDistance.tooltip=Максимальная дальность размещения блоков. schematica.config.placeInstantly=Мгновенное размещение From 97e44e77b0aedc9c36ae13a2e8f02b3e737f56eb Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 25 Jul 2017 13:26:45 +0200 Subject: [PATCH 301/314] Replace anonymous classes with lambdas. --- .../printer/registry/PlacementRegistry.java | 277 +++++++----------- .../schematica/util/ItemStackSortType.java | 36 +-- 2 files changed, 121 insertions(+), 192 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java index bdb76d21..909d6295 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/registry/PlacementRegistry.java @@ -53,171 +53,107 @@ private void populateMappings() { this.blockPlacementMap.clear(); this.itemPlacementMap.clear(); - final IValidPlayerFacing playerFacingEntity = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == player.getHorizontalFacing(); - } + final IValidPlayerFacing playerFacingEntity = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == player.getHorizontalFacing(); }; - final IValidPlayerFacing playerFacingEntityOpposite = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == player.getHorizontalFacing().getOpposite(); - } + final IValidPlayerFacing playerFacingEntityOpposite = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == player.getHorizontalFacing().getOpposite(); }; - final IValidPlayerFacing playerFacingPiston = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == EnumFacing.getDirectionFromEntityLiving(pos, player); - } + final IValidPlayerFacing playerFacingPiston = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == EnumFacing.getDirectionFromEntityLiving(pos, player); }; - final IValidPlayerFacing playerFacingObserver = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == EnumFacing.getDirectionFromEntityLiving(pos, player).getOpposite(); - } + final IValidPlayerFacing playerFacingObserver = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == EnumFacing.getDirectionFromEntityLiving(pos, player).getOpposite(); }; - final IValidPlayerFacing playerFacingRotateY = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); - return facing == player.getHorizontalFacing().rotateY(); - } + final IValidPlayerFacing playerFacingRotateY = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final EnumFacing facing = BlockStateHelper.getPropertyValue(blockState, "facing"); + return facing == player.getHorizontalFacing().rotateY(); }; - final IValidPlayerFacing playerFacingLever = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final BlockLever.EnumOrientation value = blockState.getValue(BlockLever.FACING); - return !value.getFacing().getAxis().isVertical() || BlockLever.EnumOrientation.forFacings(value.getFacing(), player.getHorizontalFacing()) == value; - } + final IValidPlayerFacing playerFacingLever = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final BlockLever.EnumOrientation value = blockState.getValue(BlockLever.FACING); + return !value.getFacing().getAxis().isVertical() || BlockLever.EnumOrientation.forFacings(value.getFacing(), player.getHorizontalFacing()) == value; }; - final IValidPlayerFacing playerFacingStandingSign = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - final int value = blockState.getValue(BlockStandingSign.ROTATION); - final int facing = MathHelper.floor((player.rotationYaw + 180.0) * 16.0 / 360.0 + 0.5) & 15; - return value == facing; - } + final IValidPlayerFacing playerFacingStandingSign = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + final int value = blockState.getValue(BlockStandingSign.ROTATION); + final int facing = MathHelper.floor((player.rotationYaw + 180.0) * 16.0 / 360.0 + 0.5) & 15; + return value == facing; }; - final IValidPlayerFacing playerFacingIgnore = new IValidPlayerFacing() { - @Override - public boolean isValid(final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) { - return false; - } + final IValidPlayerFacing playerFacingIgnore = (final IBlockState blockState, final EntityPlayer player, final BlockPos pos, final World world) -> { + return false; }; - final IOffset offsetSlab = new IOffset() { - @Override - public float getOffset(final IBlockState blockState) { - if (!((BlockSlab) blockState.getBlock()).isDouble()) { - final BlockSlab.EnumBlockHalf half = blockState.getValue(BlockSlab.HALF); - return half == BlockSlab.EnumBlockHalf.TOP ? 1 : 0; - } - - return 0; + final IOffset offsetSlab = (final IBlockState blockState) -> { + if (!((BlockSlab) blockState.getBlock()).isDouble()) { + final BlockSlab.EnumBlockHalf half = blockState.getValue(BlockSlab.HALF); + return half == BlockSlab.EnumBlockHalf.TOP ? 1 : 0; } + + return 0; }; - final IOffset offsetStairs = new IOffset() { - @Override - public float getOffset(final IBlockState blockState) { - final BlockStairs.EnumHalf half = blockState.getValue(BlockStairs.HALF); - return half == BlockStairs.EnumHalf.TOP ? 1 : 0; - } + final IOffset offsetStairs = (final IBlockState blockState) -> { + final BlockStairs.EnumHalf half = blockState.getValue(BlockStairs.HALF); + return half == BlockStairs.EnumHalf.TOP ? 1 : 0; }; - final IOffset offsetTrapDoor = new IOffset() { - @Override - public float getOffset(final IBlockState blockState) { - final BlockTrapDoor.DoorHalf half = blockState.getValue(BlockTrapDoor.HALF); - return half == BlockTrapDoor.DoorHalf.TOP ? 1 : 0; - } + final IOffset offsetTrapDoor = (final IBlockState blockState) -> { + final BlockTrapDoor.DoorHalf half = blockState.getValue(BlockTrapDoor.HALF); + return half == BlockTrapDoor.DoorHalf.TOP ? 1 : 0; }; - final IValidBlockFacing blockFacingLog = new IValidBlockFacing() { - @Override - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); + final IValidBlockFacing blockFacingLog = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); - final BlockLog.EnumAxis axis = blockState.getValue(BlockLog.LOG_AXIS); - for (final EnumFacing side : solidSides) { - if (axis != BlockLog.EnumAxis.fromFacingAxis(side.getAxis())) { - continue; - } + final BlockLog.EnumAxis axis = blockState.getValue(BlockLog.LOG_AXIS); + for (final EnumFacing side : solidSides) { + if (axis != BlockLog.EnumAxis.fromFacingAxis(side.getAxis())) { + continue; + } - list.add(side); + list.add(side); + } + + return list; + }; + final IValidBlockFacing blockFacingPillar = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); + + final EnumFacing.Axis axis = blockState.getValue(BlockRotatedPillar.AXIS); + for (final EnumFacing side : solidSides) { + if (axis != side.getAxis()) { + continue; } - return list; + list.add(side); } + + return list; }; - final IValidBlockFacing blockFacingPillar = new IValidBlockFacing() { - @Override - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); + final IValidBlockFacing blockFacingOpposite = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); - final EnumFacing.Axis axis = blockState.getValue(BlockRotatedPillar.AXIS); + final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); + if (propertyFacing != null && propertyFacing.getValueClass().equals(EnumFacing.class)) { + final EnumFacing facing = ((EnumFacing) blockState.getValue(propertyFacing)); for (final EnumFacing side : solidSides) { - if (axis != side.getAxis()) { + if (facing.getOpposite() != side) { continue; } list.add(side); } - - return list; } - }; - final IValidBlockFacing blockFacingOpposite = new IValidBlockFacing() { - @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); - - final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); - if (propertyFacing != null && propertyFacing.getValueClass().equals(EnumFacing.class)) { - final EnumFacing facing = ((EnumFacing) blockState.getValue(propertyFacing)); - for (final EnumFacing side : solidSides) { - if (facing.getOpposite() != side) { - continue; - } - - list.add(side); - } - } - return list; - } + return list; }; - final IValidBlockFacing blockFacingSame = new IValidBlockFacing() { - @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); - - final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); - if (propertyFacing != null && propertyFacing.getValueClass().equals(EnumFacing.class)) { - final EnumFacing facing = (EnumFacing) blockState.getValue(propertyFacing); - for (final EnumFacing side : solidSides) { - if (facing != side) { - continue; - } - - list.add(side); - } - } + final IValidBlockFacing blockFacingSame = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); - return list; - } - }; - final IValidBlockFacing blockFacingHopper = new IValidBlockFacing() { - @Override - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); - - final EnumFacing facing = blockState.getValue(BlockHopper.FACING); + final IProperty propertyFacing = BlockStateHelper.getProperty(blockState, "facing"); + if (propertyFacing != null && propertyFacing.getValueClass().equals(EnumFacing.class)) { + final EnumFacing facing = (EnumFacing) blockState.getValue(propertyFacing); for (final EnumFacing side : solidSides) { if (facing != side) { continue; @@ -225,54 +161,59 @@ public List getValidBlockFacings(final List solidSides, list.add(side); } - - return list; } - }; - final IValidBlockFacing blockFacingLever = new IValidBlockFacing() { - @Override - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); - final BlockLever.EnumOrientation facing = blockState.getValue(BlockLever.FACING); - for (final EnumFacing side : solidSides) { - if (facing.getFacing().getOpposite() != side) { - continue; - } + return list; + }; + final IValidBlockFacing blockFacingHopper = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); - list.add(side); + final EnumFacing facing = blockState.getValue(BlockHopper.FACING); + for (final EnumFacing side : solidSides) { + if (facing != side) { + continue; } - return list; + list.add(side); } - }; - final IValidBlockFacing blockFacingQuartz = new IValidBlockFacing() { - @Override - public List getValidBlockFacings(final List solidSides, final IBlockState blockState) { - final List list = new ArrayList(); - final BlockQuartz.EnumType variant = blockState.getValue(BlockQuartz.VARIANT); - for (final EnumFacing side : solidSides) { - if (variant == BlockQuartz.EnumType.LINES_X && side.getAxis() != EnumFacing.Axis.X) { - continue; - } else if (variant == BlockQuartz.EnumType.LINES_Y && side.getAxis() != EnumFacing.Axis.Y) { - continue; - } else if (variant == BlockQuartz.EnumType.LINES_Z && side.getAxis() != EnumFacing.Axis.Z) { - continue; - } + return list; + }; + final IValidBlockFacing blockFacingLever = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); - list.add(side); + final BlockLever.EnumOrientation facing = blockState.getValue(BlockLever.FACING); + for (final EnumFacing side : solidSides) { + if (facing.getFacing().getOpposite() != side) { + continue; } - return list; + list.add(side); } + + return list; }; + final IValidBlockFacing blockFacingQuartz = (final List solidSides, final IBlockState blockState) -> { + final List list = new ArrayList(); + + final BlockQuartz.EnumType variant = blockState.getValue(BlockQuartz.VARIANT); + for (final EnumFacing side : solidSides) { + if (variant == BlockQuartz.EnumType.LINES_X && side.getAxis() != EnumFacing.Axis.X) { + continue; + } else if (variant == BlockQuartz.EnumType.LINES_Y && side.getAxis() != EnumFacing.Axis.Y) { + continue; + } else if (variant == BlockQuartz.EnumType.LINES_Z && side.getAxis() != EnumFacing.Axis.Z) { + continue; + } - final IExtraClick extraClickDoubleSlab = new IExtraClick() { - @Override - public int getExtraClicks(final IBlockState blockState) { - return ((BlockSlab) blockState.getBlock()).isDouble() ? 1 : 0; + list.add(side); } + + return list; + }; + + final IExtraClick extraClickDoubleSlab = (final IBlockState blockState) -> { + return ((BlockSlab) blockState.getBlock()).isDouble() ? 1 : 0; }; /** diff --git a/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java b/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java index 8f5016e5..1885d782 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java +++ b/src/main/java/com/github/lunatrius/schematica/util/ItemStackSortType.java @@ -8,35 +8,23 @@ import java.util.List; public enum ItemStackSortType { - NAME_ASC("name", "\u2191", new Comparator() { - @Override - public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { - final String nameA = wrappedItemStackA.getItemStackDisplayName(); - final String nameB = wrappedItemStackB.getItemStackDisplayName(); + NAME_ASC("name", "\u2191", (Comparator) (final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) -> { + final String nameA = wrappedItemStackA.getItemStackDisplayName(); + final String nameB = wrappedItemStackB.getItemStackDisplayName(); - return nameA.compareTo(nameB); - } + return nameA.compareTo(nameB); }), - NAME_DESC("name", "\u2193", new Comparator() { - @Override - public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { - final String nameA = wrappedItemStackA.getItemStackDisplayName(); - final String nameB = wrappedItemStackB.getItemStackDisplayName(); + NAME_DESC("name", "\u2193", (Comparator) (final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) -> { + final String nameA = wrappedItemStackA.getItemStackDisplayName(); + final String nameB = wrappedItemStackB.getItemStackDisplayName(); - return nameB.compareTo(nameA); - } + return nameB.compareTo(nameA); }), - SIZE_ASC("amount", "\u2191", new Comparator() { - @Override - public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { - return wrappedItemStackA.total - wrappedItemStackB.total; - } + SIZE_ASC("amount", "\u2191", (Comparator) (final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) -> { + return wrappedItemStackA.total - wrappedItemStackB.total; }), - SIZE_DESC("amount", "\u2193", new Comparator() { - @Override - public int compare(final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) { - return wrappedItemStackB.total - wrappedItemStackA.total; - } + SIZE_DESC("amount", "\u2193", (Comparator) (final BlockList.WrappedItemStack wrappedItemStackA, final BlockList.WrappedItemStack wrappedItemStackB) -> { + return wrappedItemStackB.total - wrappedItemStackA.total; }); private final Comparator comparator; From a88567c4b67a183f1d83c0bdaee1648e782fdfab Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 20 Jul 2017 18:19:35 -0700 Subject: [PATCH 302/314] Render all exterior sides in the overlay regardless of the block's sides This makes repeaters and comparators always render all sides, but also avoids rendering excessive sides on the inside of the overlay (that normally wouldn't be seen). --- .../renderer/chunk/overlay/RenderOverlay.java | 116 +++++++++++------- 1 file changed, 75 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 9d209373..2feac225 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -18,13 +18,29 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCache; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; public class RenderOverlay extends RenderChunk { + private static enum BlockType { + /** Purple - a block that is present in the world but not the schematic */ + EXTRA_BLOCK(0xBF00BF), + /** Red - a mismatch between the block in the world and the schematic */ + WRONG_BLOCK(0xFF0000), + /** Orange - a mismatch between the metadata for the block in the world and the schematic */ + WRONG_META(0xBF5F00), + /** Blue - a block that is present in the schematic but not in the world */ + MISSING_BLOCK(0x00BFFF); + + public final int color; + + private BlockType(int color) { + this.color = color; + } + } + private final VertexBuffer vertexBuffer; public RenderOverlay(final World world, final RenderGlobal renderGlobal, final int index) { @@ -42,6 +58,8 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final CompiledOverlay compiledOverlay = new CompiledOverlay(); final BlockPos from = getPosition(); final BlockPos to = from.add(15, 15, 15); + final BlockPos fromEx = from.add(-1, -1, -1); + final BlockPos toEx = to.add(1, 1, 1); generator.getLock().lock(); ChunkCache chunkCache; final SchematicWorld schematic = (SchematicWorld) this.world; @@ -56,7 +74,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun return; } - chunkCache = new ChunkCache(this.world, from.add(-1, -1, -1), to.add(1, 1, 1), 1); + chunkCache = new ChunkCache(this.world, fromEx, toEx, 1); generator.setCompiledChunk(compiledOverlay); } finally { generator.getLock().unlock(); @@ -74,14 +92,21 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun GeometryTessellator.setStaticDelta(ConfigurationHandler.blockDelta); - for (final BlockPos pos : BlockPos.getAllInBox(from, to)) { + // Elements in this array may be null, indicating that nothing should be rendered (or out of bounds) + // 18 elements to provide padding on both sides (this padding is not rendered). + final BlockType[][][] types = new BlockType[18][18][18]; + + // Build the type array (including the padding) + BlockPos.MutableBlockPos mcPos = new BlockPos.MutableBlockPos(); + for (final BlockPos.MutableBlockPos pos : BlockPos.getAllInBoxMutable(fromEx, toEx)) { if (schematic.isRenderingLayer && schematic.renderingLayer != pos.getY() || !schematic.isInside(pos)) { continue; } - boolean render = false; - int sides = 0; - int color = 0; + // Indices in types + int secX = pos.getX() - fromEx.getX(); + int secY = pos.getY() - fromEx.getY(); + int secZ = pos.getZ() - fromEx.getZ(); final IBlockState schBlockState = schematic.getBlockState(pos); final Block schBlock = schBlockState.getBlock(); @@ -90,50 +115,44 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun visgraph.setOpaqueCube(pos); } - final BlockPos mcPos = pos.add(schematic.position); + mcPos.setPos(pos.getX() + schematic.position.getX(), pos.getY() + schematic.position.getY(), pos.getZ() + schematic.position.getZ()); final IBlockState mcBlockState = mcWorld.getBlockState(mcPos); final Block mcBlock = mcBlockState.getBlock(); final boolean isSchAirBlock = schematic.isAirBlock(pos); final boolean isMcAirBlock = mcWorld.isAirBlock(mcPos) || ConfigurationHandler.isExtraAirBlock(mcBlock); - if (!isMcAirBlock) { - if (isSchAirBlock && ConfigurationHandler.highlightAir) { - render = true; - color = 0xBF00BF; - - sides = getSides(mcBlockState, mcBlock, mcWorld, mcPos, sides); + if (ConfigurationHandler.highlightAir && !isMcAirBlock && isSchAirBlock) { + types[secX][secY][secZ] = BlockType.EXTRA_BLOCK; + } else if (ConfigurationHandler.highlight) { + if (!isMcAirBlock) { + if (schBlock != mcBlock) { + types[secX][secY][secZ] = BlockType.WRONG_BLOCK; + } else if (schBlock.getMetaFromState(schBlockState) != mcBlock.getMetaFromState(mcBlockState)) { + types[secX][secY][secZ] = BlockType.WRONG_META; + } + } else if (!isSchAirBlock) { + types[secX][secY][secZ] = BlockType.MISSING_BLOCK; } } + } - if (!render) { - if (ConfigurationHandler.highlight) { - if (!isMcAirBlock) { - if (schBlock != mcBlock) { - render = true; - color = 0xFF0000; - } else if (schBlock.getMetaFromState(schBlockState) != mcBlock.getMetaFromState(mcBlockState)) { - render = true; - color = 0xBF5F00; - } - } else if (!isSchAirBlock) { - render = true; - color = 0x00BFFF; - } - } + // Draw the type array (but not the padding) + for (final BlockPos.MutableBlockPos pos : BlockPos.getAllInBoxMutable(from, to)) { + int secX = pos.getX() - fromEx.getX(); + int secY = pos.getY() - fromEx.getY(); + int secZ = pos.getZ() - fromEx.getZ(); - if (render) { - sides = getSides(schBlockState, schBlock, schematic, pos, sides); - } - } + BlockType type = types[secX][secY][secZ]; - if (render && sides != 0) { + if (type != null) { if (!compiledOverlay.isLayerStarted(layer)) { compiledOverlay.setLayerStarted(layer); preRenderBlocks(buffer, from); } - GeometryTessellator.drawCuboid(buffer, pos, sides, 0x3F000000 | color); + int sides = getSides(types, secX, secY, secZ); + GeometryTessellator.drawCuboid(buffer, pos, sides, 0x3F000000 | type.color); compiledOverlay.setLayerUsed(layer); } } @@ -146,28 +165,43 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun compiledOverlay.setVisibility(visgraph.computeVisibility()); } - private int getSides(final IBlockState blockState, final Block block, final World world, final BlockPos pos, int sides) { - if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.DOWN)) { + private int getSides(final BlockType[][][] types, final int x, final int y, final int z) { + // The padding cannot be rendered (it lacks neighbors) + if (!(x > 0 && x < 17)) { + throw new IndexOutOfBoundsException("x cannot be in padding: " + x); + } + if (!(y > 0 && y < 17)) { + throw new IndexOutOfBoundsException("y cannot be in padding: " + y); + } + if (!(z > 0 && z < 17)) { + throw new IndexOutOfBoundsException("z cannot be in padding: " + z); + } + + int sides = 0; + + final BlockType type = types[x][y][z]; + + if (types[x][y - 1][z] != type) { sides |= GeometryMasks.Quad.DOWN; } - if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.UP)) { + if (types[x][y + 1][z] != type) { sides |= GeometryMasks.Quad.UP; } - if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.NORTH)) { + if (types[x][y][z - 1] != type) { sides |= GeometryMasks.Quad.NORTH; } - if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.SOUTH)) { + if (types[x][y][z + 1] != type) { sides |= GeometryMasks.Quad.SOUTH; } - if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.WEST)) { + if (types[x - 1][y][z] != type) { sides |= GeometryMasks.Quad.WEST; } - if (block.shouldSideBeRendered(blockState, world, pos, EnumFacing.EAST)) { + if (types[x + 1][y][z] != type) { sides |= GeometryMasks.Quad.EAST; } From bc5ed433f7254b4fe11ac4bade73371a72cb2ec1 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 21 Jul 2017 19:33:12 -0700 Subject: [PATCH 303/314] Implement loading and saving schematics in the structure block format --- .../lunatrius/schematica/api/ISchematic.java | 17 +++ .../schematica/client/util/FlipHelper.java | 2 +- .../client/util/RotationHelper.java | 2 +- .../schematica/proxy/CommonProxy.java | 2 +- .../lunatrius/schematica/reference/Names.java | 1 + .../world/schematic/SchematicFormat.java | 18 ++-- .../world/schematic/SchematicStructure.java | 102 ++++++++++++++++++ .../schematica/world/storage/Schematic.java | 27 +++++ src/main/resources/META-INF/schematica_at.cfg | 4 + 9 files changed, 166 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java diff --git a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java index 2175c24a..36bab69a 100644 --- a/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java +++ b/src/api/java/com/github/lunatrius/schematica/api/ISchematic.java @@ -8,6 +8,8 @@ import java.util.List; +import javax.annotation.Nonnull; + public interface ISchematic { /** * Gets a block state at a given location within the schematic. Requesting a block state outside of those bounds @@ -114,4 +116,19 @@ public interface ISchematic { * @return the schematic height */ int getHeight(); + + /** + * Gets the author of the schematic, or an empty String if unknown. + * + * @return The author of the schematic. + */ + @Nonnull + String getAuthor(); + + /** + * Sets the author of the schematic. + * + * @param author The new author of the schematic. + */ + void setAuthor(@Nonnull String author); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java index 35b519dd..7198e5c7 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/FlipHelper.java @@ -50,7 +50,7 @@ public boolean flip(final SchematicWorld world, final EnumFacing axis, final boo public Schematic flip(final ISchematic schematic, final EnumFacing axis, final boolean forced) throws FlipException { final Vec3i dimensionsFlipped = new Vec3i(schematic.getWidth(), schematic.getHeight(), schematic.getLength()); - final Schematic schematicFlipped = new Schematic(schematic.getIcon(), dimensionsFlipped.getX(), dimensionsFlipped.getY(), dimensionsFlipped.getZ()); + final Schematic schematicFlipped = new Schematic(schematic.getIcon(), dimensionsFlipped.getX(), dimensionsFlipped.getY(), dimensionsFlipped.getZ(), schematic.getAuthor()); final MBlockPos tmp = new MBlockPos(); for (final MBlockPos pos : BlockPosHelper.getAllInBox(0, 0, 0, schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1)) { diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java index 67c529f7..d8f0e347 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/RotationHelper.java @@ -87,7 +87,7 @@ private void updatePosition(final SchematicWorld world, final EnumFacing axis) { public Schematic rotate(final ISchematic schematic, final EnumFacing axis, final boolean forced) throws RotationException { final Vec3i dimensionsRotated = rotateDimensions(axis, schematic.getWidth(), schematic.getHeight(), schematic.getLength()); - final Schematic schematicRotated = new Schematic(schematic.getIcon(), dimensionsRotated.getX(), dimensionsRotated.getY(), dimensionsRotated.getZ()); + final Schematic schematicRotated = new Schematic(schematic.getIcon(), dimensionsRotated.getX(), dimensionsRotated.getY(), dimensionsRotated.getZ(), schematic.getAuthor()); final MBlockPos tmp = new MBlockPos(); for (final MBlockPos pos : BlockPosHelper.getAllInBox(0, 0, 0, schematic.getWidth() - 1, schematic.getHeight() - 1, schematic.getLength() - 1)) { diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 0e404866..5d80b18e 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -185,7 +185,7 @@ public boolean saveSchematic(final EntityPlayer player, final File directory, St final short height = (short) (Math.abs(maxY - minY) + 1); final short length = (short) (Math.abs(maxZ - minZ) + 1); - final ISchematic schematic = new Schematic(SchematicUtil.getIconFromName(iconName), width, height, length); + final ISchematic schematic = new Schematic(SchematicUtil.getIconFromName(iconName), width, height, length, player.getName()); final SchematicContainer container = new SchematicContainer(schematic, player, world, new File(directory, filename), minX, maxX, minY, maxY, minZ, maxZ); QueueTickHandler.INSTANCE.queueSchematic(container); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index dfc2a3c6..6ad39238 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -212,6 +212,7 @@ public static final class NBT { public static final String MATERIALS = "Materials"; public static final String FORMAT_CLASSIC = "Classic"; public static final String FORMAT_ALPHA = "Alpha"; + public static final String FORMAT_STRUCTURE = "Structure"; public static final String ICON = "Icon"; public static final String BLOCKS = "Blocks"; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index ca28e86d..26c62417 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -27,11 +27,16 @@ public abstract class SchematicFormat { public static ISchematic readFromFile(final File file) { try { final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); - final String format = tagCompound.getString(Names.NBT.MATERIALS); - final SchematicFormat schematicFormat = FORMATS.get(format); - - if (schematicFormat == null) { - throw new UnsupportedFormatException(format); + final SchematicFormat schematicFormat; + if (tagCompound.hasKey(Names.NBT.MATERIALS)) { + final String format = tagCompound.getString(Names.NBT.MATERIALS); + schematicFormat = FORMATS.get(format); + + if (schematicFormat == null) { + throw new UnsupportedFormatException(format); + } + } else { + schematicFormat = FORMATS.get(Names.NBT.FORMAT_STRUCTURE); } return schematicFormat.readFromNBT(tagCompound); @@ -85,7 +90,8 @@ public static void writeToFileAndNotify(final File file, final ISchematic schema // TODO? // FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); + FORMATS.put(Names.NBT.FORMAT_STRUCTURE, new SchematicStructure()); - FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; + FORMAT_DEFAULT = Names.NBT.FORMAT_STRUCTURE; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java new file mode 100644 index 00000000..38528d1a --- /dev/null +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java @@ -0,0 +1,102 @@ +package com.github.lunatrius.schematica.world.schematic; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.gen.structure.template.Template; +import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.nbt.NBTHelper; +import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.storage.Schematic; + +public class SchematicStructure extends SchematicFormat { + @Override + public ISchematic readFromNBT(final NBTTagCompound tagCompound) { + final ItemStack icon = SchematicUtil.getIconFromNBT(tagCompound); + + final Template template = new Template(); + template.read(tagCompound); + + final Schematic schematic = new Schematic(icon, + template.size.getX(), template.size.getY(), template.size.getZ(), template.getAuthor()); + + for (Template.BlockInfo block : template.blocks) { + schematic.setBlockState(block.pos, block.blockState); + if (block.tileentityData != null) { + try { + // This position isn't included by default + block.tileentityData.setInteger("x", block.pos.getX()); + block.tileentityData.setInteger("y", block.pos.getY()); + block.tileentityData.setInteger("z", block.pos.getZ()); + + final TileEntity tileEntity = NBTHelper.readTileEntityFromCompound(block.tileentityData); + if (tileEntity != null) { + schematic.setTileEntity(block.pos, tileEntity); + } + } catch (final Exception e) { + Reference.logger.error("TileEntity failed to load properly!", e); + } + } + } + + // for (Template.EntityInfo entity : template.entities) { + // schematic.addEntity(...); + // } + + return schematic; + } + + @Override + public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic schematic) { + Template template = new Template(); + template.size = new BlockPos(schematic.getWidth(), schematic.getHeight(), schematic.getLength()); + + template.setAuthor(schematic.getAuthor()); + + // NOTE: Can't use MutableBlockPos here because we're keeping a reference to it in BlockInfo + for (BlockPos pos : BlockPos.getAllInBox(BlockPos.ORIGIN, template.size.add(-1, -1, -1))) { + final TileEntity tileEntity = schematic.getTileEntity(pos); + final NBTTagCompound compound; + if (tileEntity != null) { + compound = NBTHelper.writeTileEntityToCompound(tileEntity); + // Tile entities in structures don't store these coords + compound.removeTag("x"); + compound.removeTag("y"); + compound.removeTag("z"); + } else { + compound = null; + } + + template.blocks.add(new Template.BlockInfo(pos, schematic.getBlockState(pos), compound)); + } + + for (Entity entity : schematic.getEntities()) { + try { + // Entity positions are already offset via NBTHelper.reloadEntity + Vec3d vec3d = new Vec3d(entity.posX, entity.posY, entity.posZ); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + entity.writeToNBTOptional(nbttagcompound); + BlockPos blockpos; + + // TODO: Vanilla has a check like this, but we don't; this doesn't seem to + // cause any problems though. + // if (entity instanceof EntityPainting) { + // blockpos = ((EntityPainting)entity).getHangingPosition().subtract(startPos); + // } else { + blockpos = new BlockPos(vec3d); + // } + + template.entities.add(new Template.EntityInfo(vec3d, blockpos, nbttagcompound)); + } catch (final Throwable t) { + Reference.logger.error("Entity {} failed to save, skipping!", entity, t); + } + } + + template.writeToNBT(tagCompound); + return true; + } +} diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java index c69b1851..d591c798 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/Schematic.java @@ -14,6 +14,8 @@ import java.util.Iterator; import java.util.List; +import javax.annotation.Nonnull; + public class Schematic implements ISchematic { private static final ItemStack DEFAULT_ICON = new ItemStack(Blocks.GRASS); @@ -25,8 +27,17 @@ public class Schematic implements ISchematic { private final int width; private final int height; private final int length; + private String author; public Schematic(final ItemStack icon, final int width, final int height, final int length) { + this(icon, width, height, length, ""); + } + + public Schematic(final ItemStack icon, final int width, final int height, final int length, @Nonnull final String author) { + if (author == null) { + throw new IllegalArgumentException("Author cannot be null"); + } + this.icon = icon; this.blocks = new short[width][height][length]; this.metadata = new byte[width][height][length]; @@ -34,6 +45,8 @@ public Schematic(final ItemStack icon, final int width, final int height, final this.width = width; this.height = height; this.length = length; + + this.author = author; } @Override @@ -184,4 +197,18 @@ private boolean isValid(final BlockPos pos) { return !(x < 0 || y < 0 || z < 0 || x >= this.width || y >= this.height || z >= this.length); } + + @Override + @Nonnull + public String getAuthor() { + return this.author; + } + + @Override + public void setAuthor(@Nonnull final String author) { + if (author == null) { + throw new IllegalArgumentException("Author cannot be null"); + } + this.author = author; + } } diff --git a/src/main/resources/META-INF/schematica_at.cfg b/src/main/resources/META-INF/schematica_at.cfg index 14faa294..7fdae6a1 100644 --- a/src/main/resources/META-INF/schematica_at.cfg +++ b/src/main/resources/META-INF/schematica_at.cfg @@ -10,3 +10,7 @@ public net.minecraft.client.renderer.chunk.RenderChunk func_178584_a(Lnet/minecr public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/client/renderer/chunk/RenderChunk; # getRenderChunk public net.minecraft.nbt.NBTTagCompound func_150298_a(Ljava/lang/String;Lnet/minecraft/nbt/NBTBase;Ljava/io/DataOutput;)V # writeNamedTag + +public net.minecraft.world.gen.structure.template.Template field_186270_a # blocks +public net.minecraft.world.gen.structure.template.Template field_186271_b # entities +public net.minecraft.world.gen.structure.template.Template field_186272_c # size \ No newline at end of file From 47c6bb35cacf62ada9a48883fcfe12ed4331403c Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 22 Jul 2017 00:12:05 -0700 Subject: [PATCH 304/314] Allow selection of the schematic format in the UI --- .../client/gui/load/GuiSchematicLoadSlot.java | 3 +- .../client/gui/save/GuiSchematicSave.java | 58 ++++++++++-- .../command/CommandSchematicaSave.java | 2 +- .../schematica/handler/QueueTickHandler.java | 2 +- .../network/message/MessageDownloadEnd.java | 2 +- .../schematica/proxy/CommonProxy.java | 6 +- .../lunatrius/schematica/reference/Names.java | 12 +++ .../schematica/util/FileFilterSchematic.java | 11 ++- .../world/chunk/SchematicContainer.java | 7 +- .../world/schematic/SchematicAlpha.java | 10 +++ .../world/schematic/SchematicClassic.java | 12 +++ .../world/schematic/SchematicFormat.java | 89 +++++++++++++++++-- .../world/schematic/SchematicStructure.java | 11 +++ .../assets/schematica/lang/en_us.lang | 6 ++ 14 files changed, 208 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java index 70af8206..fe634b21 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoadSlot.java @@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; +import org.apache.commons.io.FilenameUtils; public class GuiSchematicLoadSlot extends GuiSlot { private final Minecraft minecraft = Minecraft.getMinecraft(); @@ -66,7 +67,7 @@ protected void drawSlot(final int index, final int x, final int y, final int par if (schematic.isDirectory()) { schematicName += "/"; } else { - schematicName = schematicName.replaceAll("(?i)\\.schematic$", ""); + schematicName = FilenameUtils.getBaseName(schematicName); } GuiHelper.drawItemStackWithSlot(this.minecraft.renderEngine, schematic.getItemStack(), x, y); diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index b9a1b07f..7d6093bf 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -16,6 +16,7 @@ import java.io.File; import java.io.IOException; +import java.util.Iterator; public class GuiSchematicSave extends GuiScreenBase { private int centerX = 0; @@ -34,11 +35,21 @@ public class GuiSchematicSave extends GuiScreenBase { private GuiNumericField numericBZ = null; private GuiButton btnEnable = null; + private GuiButton btnFormat = null; private GuiButton btnSave = null; private GuiTextField tfFilename = null; private String filename = ""; + /** The currently selected format */ + private String format; + /** + * An iterator that gets new formats from {@link SchematicFormat#FORMATS}. + * + * Is reset after it no longer has new elements. + */ + private Iterator formatIterator = null; + private final String strSaveSelection = I18n.format(Names.Gui.Save.SAVE_SELECTION); private final String strX = I18n.format(Names.Gui.X); private final String strY = I18n.format(Names.Gui.Y); @@ -48,10 +59,12 @@ public class GuiSchematicSave extends GuiScreenBase { public GuiSchematicSave(final GuiScreen guiScreen) { super(guiScreen); + this.format = nextFormat(); } @Override public void initGui() { + SchematicFormat.FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; this.centerX = this.width / 2; this.centerY = this.height / 2; @@ -83,16 +96,20 @@ public void initGui() { this.numericBZ = new GuiNumericField(this.fontRenderer, id++, this.centerX + 30, this.centerY + 20); this.buttonList.add(this.numericBZ); - this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 30, 50, 20, ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled ? this.strOn : this.strOff); + this.btnEnable = new GuiButton(id++, this.width - 210, this.height - 55, 50, 20, ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled ? this.strOn : this.strOff); this.buttonList.add(this.btnEnable); - this.tfFilename = new GuiTextField(id++, this.fontRenderer, this.width - 155, this.height - 29, 100, 18); + this.tfFilename = new GuiTextField(id++, this.fontRenderer, this.width - 209, this.height - 29, 153, 18); this.textFields.add(this.tfFilename); this.btnSave = new GuiButton(id++, this.width - 50, this.height - 30, 40, 20, I18n.format(Names.Gui.Save.SAVE)); this.btnSave.enabled = ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled || ClientProxy.schematic != null; this.buttonList.add(this.btnSave); + this.btnFormat = new GuiButton(id++, this.width - 155, this.height - 55, 145, 20, I18n.format(Names.Gui.Save.FORMAT, I18n.format(SchematicFormat.getFormatName(this.format)))); + this.btnFormat.enabled = ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled || ClientProxy.schematic != null; + this.buttonList.add(this.btnFormat); + this.tfFilename.setMaxStringLength(1024); this.tfFilename.setText(this.filename); @@ -151,15 +168,19 @@ protected void actionPerformed(final GuiButton guiButton) { ClientProxy.isRenderingGuide = !ClientProxy.isRenderingGuide && Schematica.proxy.isSaveEnabled; this.btnEnable.displayString = ClientProxy.isRenderingGuide ? this.strOn : this.strOff; this.btnSave.enabled = ClientProxy.isRenderingGuide || ClientProxy.schematic != null; + this.btnFormat.enabled = ClientProxy.isRenderingGuide || ClientProxy.schematic != null; + } else if (guiButton.id == this.btnFormat.id) { + this.format = nextFormat(); + this.btnFormat.displayString = I18n.format(Names.Gui.Save.FORMAT, I18n.format(SchematicFormat.getFormatName(this.format))); } else if (guiButton.id == this.btnSave.id) { - final String path = this.tfFilename.getText() + ".schematic"; + final String path = this.tfFilename.getText() + SchematicFormat.getExtension(this.format); if (ClientProxy.isRenderingGuide) { - if (Schematica.proxy.saveSchematic(this.mc.player, ConfigurationHandler.schematicDirectory, path, this.mc.world, ClientProxy.pointMin, ClientProxy.pointMax)) { + if (Schematica.proxy.saveSchematic(this.mc.player, ConfigurationHandler.schematicDirectory, path, this.mc.world, this.format, ClientProxy.pointMin, ClientProxy.pointMax)) { this.filename = ""; this.tfFilename.setText(this.filename); } } else { - SchematicFormat.writeToFileAndNotify(new File(ConfigurationHandler.schematicDirectory, path), ClientProxy.schematic.getSchematic(), this.mc.player); + SchematicFormat.writeToFileAndNotify(new File(ConfigurationHandler.schematicDirectory, path), this.format, ClientProxy.schematic.getSchematic(), this.mc.player); } } } @@ -175,7 +196,7 @@ protected void keyTyped(final char character, final int code) throws IOException public void drawScreen(final int mouseX, final int mouseY, final float partialTicks) { // drawDefaultBackground(); - drawString(this.fontRenderer, this.strSaveSelection, this.width - 205, this.height - 45, 0xFFFFFF); + drawString(this.fontRenderer, this.strSaveSelection, this.width - 205, this.height - 70, 0xFFFFFF); drawString(this.fontRenderer, this.strX, this.centerX - 145, this.centerY - 24, 0xFFFFFF); drawString(this.fontRenderer, Integer.toString(ClientProxy.pointA.x), this.centerX - 25, this.centerY - 24, 0xFFFFFF); @@ -197,4 +218,29 @@ public void drawScreen(final int mouseX, final int mouseY, final float partialTi super.drawScreen(mouseX, mouseY, partialTicks); } + + /** + * Advances the format iterator, reseting it as needed. + * If the format iterator is null, initializes it to the default format. + * + * @return The next format value + */ + private String nextFormat() { + if (this.formatIterator == null) { + // First time; prime it so that it just returned the default value + assert SchematicFormat.FORMATS.size() > 0 : "No formats are defined!"; + assert SchematicFormat.FORMATS.containsKey(SchematicFormat.FORMAT_DEFAULT) : "The default format does not exist!"; + + this.formatIterator = SchematicFormat.FORMATS.keySet().iterator(); + while (!this.formatIterator.next().equals(SchematicFormat.FORMAT_DEFAULT)) { + continue; + } + return SchematicFormat.FORMAT_DEFAULT; + } + + if (!this.formatIterator.hasNext()) { + this.formatIterator = SchematicFormat.FORMATS.keySet().iterator(); + } + return this.formatIterator.next(); + } } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 4b148421..806d69c9 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -73,7 +73,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f } try { - Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), from, to); + Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), null /*TODO*/, from, to); sender.sendMessage(new TextComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); } catch (final Exception e) { throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); diff --git a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java index 8243d79f..1230005d 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/QueueTickHandler.java @@ -68,7 +68,7 @@ private void processQueue() { if (container.hasNext()) { this.queue.offer(container); } else { - SchematicFormat.writeToFileAndNotify(container.file, container.schematic, container.player); + SchematicFormat.writeToFileAndNotify(container.file, container.format, container.schematic, container.player); } } diff --git a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java index 00677126..d2a36be6 100644 --- a/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java +++ b/src/main/java/com/github/lunatrius/schematica/network/message/MessageDownloadEnd.java @@ -37,7 +37,7 @@ public void toBytes(final ByteBuf buf) { @Override public IMessage onMessage(final MessageDownloadEnd message, final MessageContext ctx) { final File directory = Schematica.proxy.getPlayerSchematicDirectory(null, true); - final boolean success = SchematicFormat.writeToFile(directory, message.name, DownloadHandler.INSTANCE.schematic); + final boolean success = SchematicFormat.writeToFile(directory, message.name, null, DownloadHandler.INSTANCE.schematic); if (success) { Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation(Names.Command.Download.Message.DOWNLOAD_SUCCEEDED, message.name)); diff --git a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java index 5d80b18e..ce26bc56 100644 --- a/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java +++ b/src/main/java/com/github/lunatrius/schematica/proxy/CommonProxy.java @@ -35,6 +35,8 @@ import java.io.IOException; import java.util.List; +import javax.annotation.Nullable; + public abstract class CommonProxy { public boolean isSaveEnabled = true; public boolean isLoadEnabled = true; @@ -160,7 +162,7 @@ public void copyChunkToSchematic(final ISchematic schematic, final World world, } } - public boolean saveSchematic(final EntityPlayer player, final File directory, String filename, final World world, final BlockPos from, final BlockPos to) { + public boolean saveSchematic(final EntityPlayer player, final File directory, String filename, final World world, @Nullable final String format, final BlockPos from, final BlockPos to) { try { String iconName = ""; @@ -186,7 +188,7 @@ public boolean saveSchematic(final EntityPlayer player, final File directory, St final short length = (short) (Math.abs(maxZ - minZ) + 1); final ISchematic schematic = new Schematic(SchematicUtil.getIconFromName(iconName), width, height, length, player.getName()); - final SchematicContainer container = new SchematicContainer(schematic, player, world, new File(directory, filename), minX, maxX, minY, maxY, minZ, maxZ); + final SchematicContainer container = new SchematicContainer(schematic, player, world, new File(directory, filename), format, minX, maxX, minY, maxY, minZ, maxZ); QueueTickHandler.INSTANCE.queueSchematic(container); return true; diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 6ad39238..8ff236bf 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -153,6 +153,7 @@ public static final class Save { public static final String POINT_BLUE = "schematica.gui.point.blue"; public static final String SAVE = "schematica.gui.save"; public static final String SAVE_SELECTION = "schematica.gui.saveselection"; + public static final String FORMAT = "schematica.gui.format"; } public static final class Control { @@ -227,4 +228,15 @@ public static final class NBT { public static final String ENTITIES = "Entities"; public static final String EXTENDED_METADATA = "ExtendedMetadata"; } + + public static final class Formats { + public static final String CLASSIC = "schematica.format.classic"; + public static final String ALPHA = "schematica.format.alpha"; + public static final String STRUCTURE = "schematica.format.structure"; + } + + public static final class Extensions { + public static final String SCHEMATIC = ".schematic"; + public static final String STRUCTURE = ".nbt"; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java index 829d4c07..c04787df 100644 --- a/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/util/FileFilterSchematic.java @@ -1,5 +1,8 @@ package com.github.lunatrius.schematica.util; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import org.apache.commons.io.FilenameUtils; + import java.io.File; import java.io.FileFilter; import java.util.Locale; @@ -17,6 +20,12 @@ public boolean accept(final File file) { return file.isDirectory(); } - return file.getName().toLowerCase(Locale.ENGLISH).endsWith(".schematic"); + String extension = "." + FilenameUtils.getExtension(file.getName().toLowerCase(Locale.ROOT)); + for (SchematicFormat format : SchematicFormat.FORMATS.values()) { + if (format.getExtension().equals(extension)) { + return true; + } + } + return false; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java index affbe25b..c6510503 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java +++ b/src/main/java/com/github/lunatrius/schematica/world/chunk/SchematicContainer.java @@ -8,11 +8,15 @@ import java.io.File; +import javax.annotation.Nullable; + public class SchematicContainer { public final ISchematic schematic; public final EntityPlayer player; public final World world; public final File file; + @Nullable + public final String format; public final int minX; public final int maxX; @@ -32,11 +36,12 @@ public class SchematicContainer { public final int chunkCount; public int processedChunks; - public SchematicContainer(final ISchematic schematic, final EntityPlayer player, final World world, final File file, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { + public SchematicContainer(final ISchematic schematic, final EntityPlayer player, final World world, final File file, @Nullable final String format, final int minX, final int maxX, final int minY, final int maxY, final int minZ, final int maxZ) { this.schematic = schematic; this.player = player; this.world = world; this.file = file; + this.format = format; this.minX = minX; this.maxX = maxX; diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java index 0586d279..7fe6b4ee 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicAlpha.java @@ -210,4 +210,14 @@ public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic sch return true; } + + @Override + public String getName() { + return Names.Formats.ALPHA; + } + + @Override + public String getExtension() { + return Names.Extensions.SCHEMATIC; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java index 23b06f46..183d9fc1 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicClassic.java @@ -1,6 +1,8 @@ package com.github.lunatrius.schematica.world.schematic; import com.github.lunatrius.schematica.api.ISchematic; +import com.github.lunatrius.schematica.reference.Names; + import net.minecraft.nbt.NBTTagCompound; // TODO: http://minecraft.gamepedia.com/Data_values_%28Classic%29 @@ -16,4 +18,14 @@ public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic sch // TODO return false; } + + @Override + public String getName() { + return Names.Formats.CLASSIC; + } + + @Override + public String getExtension() { + return Names.Extensions.SCHEMATIC; + } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 26c62417..3a4f52b7 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -12,18 +12,31 @@ import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.zip.GZIPOutputStream; +import javax.annotation.Nullable; + public abstract class SchematicFormat { - public static final Map FORMATS = new HashMap(); + // LinkedHashMap to ensure defined iteration order + public static final Map FORMATS = new LinkedHashMap(); public static String FORMAT_DEFAULT; public abstract ISchematic readFromNBT(NBTTagCompound tagCompound); public abstract boolean writeToNBT(NBTTagCompound tagCompound, ISchematic schematic); + /** + * Gets the translation key used for this format. + */ + public abstract String getName(); + + /** + * Gets the file extension used for this format, including the leading dot. + */ + public abstract String getExtension(); + public static ISchematic readFromFile(final File file) { try { final NBTTagCompound tagCompound = SchematicUtil.readTagCompoundFromFile(file); @@ -51,14 +64,30 @@ public static ISchematic readFromFile(final File directory, final String filenam return readFromFile(new File(directory, filename)); } - public static boolean writeToFile(final File file, final ISchematic schematic) { + /** + * Writes the given schematic. + * + * @param directory The file to write to + * @param format The format to use, or null for {@linkplain #FORMAT_DEFAULT the default} + * @param schematic The schematic to write + * @return True if successful + */ + public static boolean writeToFile(final File file, @Nullable String format, final ISchematic schematic) { try { + if (format == null) { + format = FORMAT_DEFAULT; + } + + if (!FORMATS.containsKey(format)) { + throw new UnsupportedFormatException(format); + } + final PostSchematicCaptureEvent event = new PostSchematicCaptureEvent(schematic); MinecraftForge.EVENT_BUS.post(event); final NBTTagCompound tagCompound = new NBTTagCompound(); - FORMATS.get(FORMAT_DEFAULT).writeToNBT(tagCompound, schematic); + FORMATS.get(format).writeToNBT(tagCompound, schematic); final DataOutputStream dataOutputStream = new DataOutputStream(new GZIPOutputStream(new FileOutputStream(file))); @@ -76,22 +105,64 @@ public static boolean writeToFile(final File file, final ISchematic schematic) { return false; } - public static boolean writeToFile(final File directory, final String filename, final ISchematic schematic) { - return writeToFile(new File(directory, filename), schematic); + /** + * Writes the given schematic. + * + * @param directory The directory to write in + * @param filename The filename (including the extension) to write to + * @param format The format to use, or null for {@linkplain #FORMAT_DEFAULT the default} + * @param schematic The schematic to write + * @return True if successful + */ + public static boolean writeToFile(final File directory, final String filename, @Nullable final String format, final ISchematic schematic) { + return writeToFile(new File(directory, filename), format, schematic); } - public static void writeToFileAndNotify(final File file, final ISchematic schematic, final EntityPlayer player) { - final boolean success = writeToFile(file, schematic); + /** + * Writes the given schematic, notifying the player when finished. + * + * @param file The file to write to + * @param format The format to use, or null for {@linkplain #FORMAT_DEFAULT the default} + * @param schematic The schematic to write + * @param player The player to notify + */ + public static void writeToFileAndNotify(final File file, @Nullable final String format, final ISchematic schematic, final EntityPlayer player) { + final boolean success = writeToFile(file, format, schematic); final String message = success ? Names.Command.Save.Message.SAVE_SUCCESSFUL : Names.Command.Save.Message.SAVE_FAILED; player.sendMessage(new TextComponentTranslation(message, file.getName())); } + /** + * Gets a schematic format name translation key for the given format ID. + * + * Returns null if no such format exists, and logs a warning. + */ + public static String getFormatName(final String id) { + if (!FORMATS.containsKey(id)) { + Reference.logger.warn("No format for schematic with id {}; returning null", new UnsupportedFormatException(id).fillInStackTrace(), id); + return null; + } + return FORMATS.get(id).getName(); + } + + /** + * Gets the extension used by the given format. + * + * @param format The format (or null to use {@link #FORMAT_DEFAULT the default}). + */ + public static String getExtension(@Nullable String format) { + if (format == null) { + format = FORMAT_DEFAULT; + } + return FORMATS.get(format).getExtension(); + } + static { // TODO? // FORMATS.put(Names.NBT.FORMAT_CLASSIC, new SchematicClassic()); FORMATS.put(Names.NBT.FORMAT_ALPHA, new SchematicAlpha()); FORMATS.put(Names.NBT.FORMAT_STRUCTURE, new SchematicStructure()); - FORMAT_DEFAULT = Names.NBT.FORMAT_STRUCTURE; + FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; } } diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java index 38528d1a..e0579846 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicStructure.java @@ -10,6 +10,7 @@ import net.minecraft.world.gen.structure.template.Template; import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.nbt.NBTHelper; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.storage.Schematic; @@ -99,4 +100,14 @@ public boolean writeToNBT(final NBTTagCompound tagCompound, final ISchematic sch template.writeToNBT(tagCompound); return true; } + + @Override + public String getName() { + return Names.Formats.STRUCTURE; + } + + @Override + public String getExtension() { + return Names.Extensions.STRUCTURE; + } } diff --git a/src/main/resources/assets/schematica/lang/en_us.lang b/src/main/resources/assets/schematica/lang/en_us.lang index dd748f5d..2bb13ee8 100644 --- a/src/main/resources/assets/schematica/lang/en_us.lang +++ b/src/main/resources/assets/schematica/lang/en_us.lang @@ -23,6 +23,7 @@ schematica.gui.point.red=Red point schematica.gui.point.blue=Blue point schematica.gui.save=Save schematica.gui.saveselection=Save the selection as a schematic +schematica.gui.format=Format: %s # gui - general - control schematica.gui.moveschematic=Move schematic @@ -180,3 +181,8 @@ schematica.message.togglePrinter=Printer: %s schematica.message.invalidBlock="%s" does not exist. schematica.message.invalidProperty="%s" is not a valid property. schematica.message.invalidPropertyForBlock="%s" is not a valid property for "%s". + +# schematic formats +schematica.format.classic=Classic +schematica.format.alpha=Alpha (standard) +schematica.format.structure=Structure block From 0f1701f810c49d5d86182ad1de636b068618f49b Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 24 Jul 2017 19:05:15 -0700 Subject: [PATCH 305/314] Allow format specification in /schematicaSave --- .../client/gui/save/GuiSchematicSave.java | 1 - .../command/CommandSchematicaSave.java | 14 +++++++++-- .../lunatrius/schematica/reference/Names.java | 2 ++ .../world/schematic/SchematicFormat.java | 23 +++++++++++++------ .../assets/schematica/lang/en_us.lang | 4 +++- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java index 7d6093bf..f09ccbbb 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/save/GuiSchematicSave.java @@ -64,7 +64,6 @@ public GuiSchematicSave(final GuiScreen guiScreen) { @Override public void initGui() { - SchematicFormat.FORMAT_DEFAULT = Names.NBT.FORMAT_ALPHA; this.centerX = this.width / 2; this.centerY = this.height / 2; diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index 806d69c9..c0c489cf 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -5,6 +5,7 @@ import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; +import com.github.lunatrius.schematica.world.schematic.SchematicFormat; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.NumberInvalidException; @@ -46,13 +47,22 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f final MBlockPos to = new MBlockPos(); final String filename; final String name; + final String format; try { from.set(parseCoord(args[0]), parseCoord(args[1]), parseCoord(args[2])); to.set(parseCoord(args[3]), parseCoord(args[4]), parseCoord(args[5])); name = args[6]; - filename = String.format("%s.schematic", name); + if (args.length >= 8) { + format = args[7]; + if (!SchematicFormat.FORMATS.containsKey(format)) { + throw new CommandException(Names.Command.Save.Message.UNKNOWN_FORMAT, format); + } + } else { + format = null; + } + filename = name + SchematicFormat.getExtension(format); } catch (final NumberFormatException exception) { throw new WrongUsageException(getUsage(sender)); } @@ -73,7 +83,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f } try { - Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), null /*TODO*/, from, to); + Schematica.proxy.saveSchematic(player, schematicDirectory, filename, player.getEntityWorld(), format, from, to); sender.sendMessage(new TextComponentTranslation(Names.Command.Save.Message.SAVE_SUCCESSFUL, name)); } catch (final Exception e) { throw new CommandException(Names.Command.Save.Message.SAVE_FAILED, name); diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index 8ff236bf..fa815beb 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -77,6 +77,7 @@ public static final class Message { public static final String SAVE_FAILED = "schematica.command.save.saveFailed"; public static final String QUOTA_EXCEEDED = "schematica.command.save.quotaExceeded"; public static final String PLAYER_SCHEMATIC_DIR_UNAVAILABLE = "schematica.command.save.playerSchematicDirUnavailable"; + public static final String UNKNOWN_FORMAT = "schematica.command.save.unknownFormat"; } public static final String NAME = "schematicaSave"; @@ -233,6 +234,7 @@ public static final class Formats { public static final String CLASSIC = "schematica.format.classic"; public static final String ALPHA = "schematica.format.alpha"; public static final String STRUCTURE = "schematica.format.structure"; + public static final String INVALID = "schematica.format.invalid"; } public static final class Extensions { diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index 3a4f52b7..aa4a2662 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -135,25 +135,34 @@ public static void writeToFileAndNotify(final File file, @Nullable final String /** * Gets a schematic format name translation key for the given format ID. * - * Returns null if no such format exists, and logs a warning. + * If an invalid format is chosen, logs a warning and returns a key stating + * that it's invalid. + * + * @param format The format. */ - public static String getFormatName(final String id) { - if (!FORMATS.containsKey(id)) { - Reference.logger.warn("No format for schematic with id {}; returning null", new UnsupportedFormatException(id).fillInStackTrace(), id); - return null; + public static String getFormatName(final String format) { + if (!FORMATS.containsKey(format)) { + Reference.logger.warn("No format with id {}; returning invalid for name", format, new UnsupportedFormatException(format).fillInStackTrace()); + return Names.Formats.INVALID; } - return FORMATS.get(id).getName(); + return FORMATS.get(format).getName(); } /** * Gets the extension used by the given format. * - * @param format The format (or null to use {@link #FORMAT_DEFAULT the default}). + * If the format is invalid, returns the default format's extension. + * + * @param format The format (or null to use {@link #FORMAT_DEFAULT the default}). */ public static String getExtension(@Nullable String format) { if (format == null) { format = FORMAT_DEFAULT; } + if (!FORMATS.containsKey(format)) { + Reference.logger.warn("No format with id {}; returning default extension", format, new UnsupportedFormatException(format).fillInStackTrace()); + format = FORMAT_DEFAULT; + } return FORMATS.get(format).getExtension(); } diff --git a/src/main/resources/assets/schematica/lang/en_us.lang b/src/main/resources/assets/schematica/lang/en_us.lang index 2bb13ee8..6d1cbc3f 100644 --- a/src/main/resources/assets/schematica/lang/en_us.lang +++ b/src/main/resources/assets/schematica/lang/en_us.lang @@ -142,13 +142,14 @@ schematica.key.moveHere=Move here schematica.key.pickBlock=Pick Block # commands - save -schematica.command.save.usage=/schematicaSave +schematica.command.save.usage=/schematicaSave [format] schematica.command.save.playersOnly=This command can only be used by players. schematica.command.save.started=Started saving %d chunks into %s. schematica.command.save.saveSucceeded=Successfully saved %s. schematica.command.save.saveFailed=There was a problem saving the schematic %s. schematica.command.save.quotaExceeded=You have exceeded your quota on the server. Please use /schematicaList and /schematicaRemove to remove some old schematics. schematica.command.save.playerSchematicDirUnavailable=There was a problem on the server and your schematic was not saved. Please contact the server administrator. +schematica.command.save.unknownFormat=Unknown format "%s". # commands - list schematica.command.list.usage=/schematicaList [page] @@ -186,3 +187,4 @@ schematica.message.invalidPropertyForBlock="%s" is not a valid property for "%s" schematica.format.classic=Classic schematica.format.alpha=Alpha (standard) schematica.format.structure=Structure block +schematica.format.invalid=Invalid \ No newline at end of file From d5cc7db92a01c6875e76bec069d23dd64579f7d4 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 18 Aug 2017 09:34:36 -0700 Subject: [PATCH 306/314] Use full filenames in commands --- .../schematica/command/CommandSchematicaDownload.java | 5 ++--- .../schematica/command/CommandSchematicaList.java | 4 ++-- .../schematica/command/CommandSchematicaRemove.java | 10 ++++------ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index 31077f1c..f28f362d 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -17,7 +17,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; -import org.apache.commons.io.FilenameUtils; import java.io.File; import java.util.ArrayList; @@ -49,7 +48,7 @@ public List getTabCompletions(final MinecraftServer server, final IComma final List filenames = new ArrayList(); for (final File file : files) { - filenames.add(FilenameUtils.removeExtension(file.getName())); + filenames.add(file.getName()); } return getListOfStringsMatchingLastWord(args, filenames); @@ -68,7 +67,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f throw new CommandException(Names.Command.Download.Message.PLAYERS_ONLY); } - final String filename = args[0] + ".schematic"; + final String filename = String.join(" ", args); final EntityPlayerMP player = (EntityPlayerMP) sender; final File directory = Schematica.proxy.getPlayerSchematicDirectory(player, true); if (!FileUtils.contains(directory, filename)) { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index 5dc1b90c..bfaaa91e 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -74,9 +74,9 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f final File[] files = schematicDirectory.listFiles(FILE_FILTER_SCHEMATIC); for (final File path : files) { if (currentFile >= pageStart && currentFile < pageEnd) { - final String fileName = FilenameUtils.removeExtension(path.getName()); + final String fileName = path.getName(); - final ITextComponent chatComponent = new TextComponentString(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), fileName)); + final ITextComponent chatComponent = new TextComponentString(String.format("%2d (%s): %s [", currentFile + 1, FileUtils.humanReadableByteCount(path.length()), FilenameUtils.removeExtension(fileName))); final String removeCommand = String.format("/%s %s", Names.Command.Remove.NAME, fileName); final ITextComponent removeLink = withStyle(new TextComponentTranslation(Names.Command.List.Message.REMOVE), TextFormatting.RED, removeCommand); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 41aa40fb..28ae51c0 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -6,7 +6,6 @@ import com.github.lunatrius.schematica.reference.Reference; import com.google.common.base.Charsets; import com.google.common.hash.Hashing; -import joptsimple.internal.Strings; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; @@ -44,7 +43,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f final EntityPlayer player = (EntityPlayer) sender; boolean delete = false; - String name = Strings.join(args, " "); + String name = String.join(" ", args); if (args.length > 1) { //check if the last parameter is a hash, which constitutes a confirmation. @@ -53,7 +52,7 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f //We probably have a match. final String[] a = Arrays.copyOfRange(args, 0, args.length - 1); //The name then should be everything except the last element - name = Strings.join(a, " "); + name = String.join(" ", a); final String hash = Hashing.md5().hashString(name, Charsets.UTF_8).toString(); @@ -63,11 +62,10 @@ public void execute(final MinecraftServer server, final ICommandSender sender, f } } - final String filename = String.format("%s.schematic", name); final File schematicDirectory = Schematica.proxy.getPlayerSchematicDirectory(player, true); - final File file = new File(schematicDirectory, filename); + final File file = new File(schematicDirectory, name); if (!FileUtils.contains(schematicDirectory, file)) { - Reference.logger.error("{} has tried to download the file {}", player.getName(), filename); + Reference.logger.error("{} has tried to download the file {}", player.getName(), name); throw new CommandException(Names.Command.Remove.Message.SCHEMATIC_NOT_FOUND); } From 79abcfc07bacd5e85287631b794356b115bad2a9 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Mon, 21 Aug 2017 01:12:41 +0200 Subject: [PATCH 307/314] Fix some minor issues and add non-null annotations to command related classes. --- .../client/gui/control/GuiSchematicMaterials.java | 8 +++----- .../schematica/client/renderer/RenderSchematic.java | 9 +++++++-- .../client/renderer/chunk/overlay/RenderOverlay.java | 2 +- .../lunatrius/schematica/client/util/BlockList.java | 4 ++-- .../schematica/command/CommandSchematicaBase.java | 8 +++++++- .../schematica/command/CommandSchematicaDownload.java | 9 +++++++-- .../schematica/command/CommandSchematicaList.java | 4 ++++ .../schematica/command/CommandSchematicaRemove.java | 4 ++++ .../schematica/command/CommandSchematicaSave.java | 4 ++++ .../schematica/world/schematic/SchematicFormat.java | 2 +- .../schematica/world/storage/SaveHandlerSchematic.java | 4 ++++ 11 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java index ae7642ed..08dc82df 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicMaterials.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.charset.Charset; import java.util.Formatter; import java.util.List; @@ -129,11 +130,8 @@ private void dumpMaterialList(final List blockList) final File dumps = Schematica.proxy.getDirectory("dumps"); try { - final FileOutputStream outputStream = new FileOutputStream(new File(dumps, Reference.MODID + "-materials.txt")); - try { - IOUtils.write(stringBuilder.toString(), outputStream); - } finally { - outputStream.close(); + try (FileOutputStream outputStream = new FileOutputStream(new File(dumps, Reference.MODID + "-materials.txt"))) { + IOUtils.write(stringBuilder.toString(), outputStream, Charset.forName("utf-8")); } } catch (final Exception e) { Reference.logger.error("Could not dump the material list!", e); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java index bf6de945..1a9dba8d 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/RenderSchematic.java @@ -19,6 +19,7 @@ import com.github.lunatrius.schematica.proxy.ClientProxy; import com.google.common.collect.Lists; import com.google.common.collect.Sets; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; @@ -60,6 +61,8 @@ import org.lwjgl.opengl.GL20; import org.lwjgl.util.vector.Vector3f; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collection; import java.util.EnumSet; import java.util.Iterator; @@ -68,6 +71,8 @@ import java.util.Set; @SideOnly(Side.CLIENT) +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class RenderSchematic extends RenderGlobal { public static final RenderSchematic INSTANCE = new RenderSchematic(Minecraft.getMinecraft()); @@ -177,7 +182,7 @@ protected boolean isRenderEntityOutlines() { } @Override - public void setWorldAndLoadRenderers(final WorldClient worldClient) { + public void setWorldAndLoadRenderers(@Nullable final WorldClient worldClient) { if (worldClient instanceof SchematicWorld) { setWorldAndLoadRenderers((SchematicWorld) worldClient); } else { @@ -185,7 +190,7 @@ public void setWorldAndLoadRenderers(final WorldClient worldClient) { } } - public void setWorldAndLoadRenderers(final SchematicWorld world) { + public void setWorldAndLoadRenderers(@Nullable final SchematicWorld world) { if (this.world != null) { this.world.removeEventListener(this); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 2feac225..09398ebf 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -111,7 +111,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun final IBlockState schBlockState = schematic.getBlockState(pos); final Block schBlock = schBlockState.getBlock(); - if (schBlock.isOpaqueCube(schBlockState)) { + if (schBlockState.isOpaqueCube()) { visgraph.setOpaqueCube(pos); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index bc4a2734..f83348cf 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -138,13 +138,13 @@ public String getItemStackDisplayName() { public String getFormattedAmount() { final char color = this.placed < this.total ? 'c' : 'a'; - return String.format("\u00a7%c%s\u00a7r/%s", color, getFormattedStackAmount(itemStack, this.placed), getFormattedStackAmount(itemStack, this.total)); + return String.format("\u00a7%c%s\u00a7r/%s", color, getFormattedStackAmount(this.itemStack, this.placed), getFormattedStackAmount(itemStack, this.total)); } public String getFormattedAmountMissing(final String strAvailable, final String strMissing) { final int need = this.total - (this.inventory + this.placed); if (this.inventory != -1 && need > 0) { - return String.format("\u00a7c%s: %s", strMissing, getFormattedStackAmount(itemStack, need)); + return String.format("\u00a7c%s: %s", strMissing, getFormattedStackAmount(this.itemStack, need)); } else { return String.format("\u00a7a%s", strAvailable); } diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java index 12af41be..1325133e 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaBase.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.command; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayerMP; @@ -9,6 +10,11 @@ import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.event.ClickEvent; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public abstract class CommandSchematicaBase extends CommandBase { @Override public int getRequiredPermissionLevel() { @@ -21,7 +27,7 @@ public boolean checkPermission(final MinecraftServer server, final ICommandSende return super.checkPermission(server, sender) || (sender instanceof EntityPlayerMP && getRequiredPermissionLevel() <= 0); } - protected T withStyle(final T component, final TextFormatting formatting, final String command) { + protected T withStyle(final T component, final TextFormatting formatting, @Nullable final String command) { final Style style = new Style(); style.setColor(formatting); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java index f28f362d..cbe7b963 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaDownload.java @@ -9,6 +9,7 @@ import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.util.FileFilterSchematic; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; @@ -18,10 +19,14 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentTranslation; +import javax.annotation.ParametersAreNonnullByDefault; import java.io.File; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class CommandSchematicaDownload extends CommandSchematicaBase { private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); @@ -38,7 +43,7 @@ public String getUsage(final ICommandSender sender) { @Override public List getTabCompletions(final MinecraftServer server, final ICommandSender sender, final String[] args, final BlockPos pos) { if (!(sender instanceof EntityPlayer)) { - return null; + return Collections.emptyList(); } final File directory = Schematica.proxy.getPlayerSchematicDirectory((EntityPlayer) sender, true); @@ -54,7 +59,7 @@ public List getTabCompletions(final MinecraftServer server, final IComma return getListOfStringsMatchingLastWord(args, filenames); } - return null; + return Collections.emptyList(); } @Override diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java index bfaaa91e..e38f1f64 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaList.java @@ -5,6 +5,7 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.util.FileFilterSchematic; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; @@ -16,9 +17,12 @@ import net.minecraft.util.text.TextFormatting; import org.apache.commons.io.FilenameUtils; +import javax.annotation.ParametersAreNonnullByDefault; import java.io.File; import java.util.LinkedList; +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class CommandSchematicaList extends CommandSchematicaBase { private static final FileFilterSchematic FILE_FILTER_SCHEMATIC = new FileFilterSchematic(false); diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java index 28ae51c0..428066b9 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaRemove.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.reference.Reference; import com.google.common.base.Charsets; import com.google.common.hash.Hashing; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; @@ -16,9 +17,12 @@ import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; +import javax.annotation.ParametersAreNonnullByDefault; import java.io.File; import java.util.Arrays; +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class CommandSchematicaRemove extends CommandSchematicaBase { @Override public String getName() { diff --git a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java index c0c489cf..1b1b06bc 100644 --- a/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java +++ b/src/main/java/com/github/lunatrius/schematica/command/CommandSchematicaSave.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import com.github.lunatrius.schematica.world.schematic.SchematicFormat; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.NumberInvalidException; @@ -14,8 +15,11 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.util.text.TextComponentTranslation; +import javax.annotation.ParametersAreNonnullByDefault; import java.io.File; +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class CommandSchematicaSave extends CommandSchematicaBase { @Override public String getName() { diff --git a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java index aa4a2662..6e2ad2c9 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java +++ b/src/main/java/com/github/lunatrius/schematica/world/schematic/SchematicFormat.java @@ -67,7 +67,7 @@ public static ISchematic readFromFile(final File directory, final String filenam /** * Writes the given schematic. * - * @param directory The file to write to + * @param file The file to write to * @param format The format to use, or null for {@linkplain #FORMAT_DEFAULT the default} * @param schematic The schematic to write * @return True if successful diff --git a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java index f2c1a6cf..9c888402 100644 --- a/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java +++ b/src/main/java/com/github/lunatrius/schematica/world/storage/SaveHandlerSchematic.java @@ -1,5 +1,6 @@ package com.github.lunatrius.schematica.world.storage; +import mcp.MethodsReturnNonnullByDefault; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.MinecraftException; import net.minecraft.world.WorldProvider; @@ -9,8 +10,11 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.WorldInfo; +import javax.annotation.ParametersAreNonnullByDefault; import java.io.File; +@MethodsReturnNonnullByDefault +@ParametersAreNonnullByDefault public class SaveHandlerSchematic implements ISaveHandler { @Override public WorldInfo loadWorldInfo() { From 59526409dc0f156fca3a1680137ba7532bda902e Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 27 Aug 2017 17:07:53 +0200 Subject: [PATCH 308/314] Update to 1.12.1. --- gradle.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 77da16c4..ead20b9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 -version_minor=7 -version_micro=8 -version_minecraft=1.12 -version_forge=14.21.1.2415 -version_minforge=14.21.1.2387 -version_mappings=snapshot_20170720 -version_lunatriuscore=1.2.0.40 +version_minor=8 +version_micro=0 +version_minecraft=1.12.1 +version_forge=14.22.0.2462 +version_minforge=14.22.0.2444 +version_mappings=snapshot_20170827 +version_lunatriuscore=1.2.0.41 extra_modsio_id=1008 extra_curseforge_id=225603 From f4d62157ea77473842a79c2ac6dddbb93365484b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Wed, 11 Oct 2017 11:01:54 +0200 Subject: [PATCH 309/314] Update to 1.12.2. --- gradle.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index ead20b9c..e4bb2ee7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ version_major=1 version_minor=8 version_micro=0 -version_minecraft=1.12.1 -version_forge=14.22.0.2462 -version_minforge=14.22.0.2444 -version_mappings=snapshot_20170827 -version_lunatriuscore=1.2.0.41 +version_minecraft=1.12.2 +version_forge=14.23.0.2512 +version_minforge=14.23.0.2491 +version_mappings=snapshot_20171010 +version_lunatriuscore=1.2.0.42 extra_modsio_id=1008 extra_curseforge_id=225603 From 9247682bac6699aae6714ebc38fc51d1bbe955de Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Thu, 16 Nov 2017 17:51:51 -0800 Subject: [PATCH 310/314] Add support for rendering all layers below the current layer --- .../gui/control/GuiSchematicControl.java | 14 +++--- .../client/printer/SchematicPrinter.java | 19 +++++--- .../renderer/chunk/overlay/RenderOverlay.java | 2 +- .../schematica/client/util/BlockList.java | 2 +- .../client/world/SchematicWorld.java | 48 +++++++++++++++---- .../handler/client/InputHandler.java | 7 +-- .../lunatrius/schematica/reference/Names.java | 1 + .../assets/schematica/lang/en_us.lang | 1 + 8 files changed, 65 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java index 6369b358..137680d2 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/control/GuiSchematicControl.java @@ -8,6 +8,7 @@ import com.github.lunatrius.schematica.client.util.FlipHelper; import com.github.lunatrius.schematica.client.util.RotationHelper; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.client.world.SchematicWorld.LayerMode; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Constants; import com.github.lunatrius.schematica.reference.Names; @@ -48,8 +49,6 @@ public class GuiSchematicControl extends GuiScreenBase { private final String strMoveSchematic = I18n.format(Names.Gui.Control.MOVE_SCHEMATIC); private final String strOperations = I18n.format(Names.Gui.Control.OPERATIONS); private final String strUnload = I18n.format(Names.Gui.Control.UNLOAD); - private final String strAll = I18n.format(Names.Gui.Control.MODE_ALL); - private final String strLayers = I18n.format(Names.Gui.Control.MODE_LAYERS); private final String strMaterials = I18n.format(Names.Gui.Control.MATERIALS); private final String strPrinter = I18n.format(Names.Gui.Control.PRINTER); private final String strHide = I18n.format(Names.Gui.Control.HIDE); @@ -87,7 +86,7 @@ public void initGui() { this.btnUnload = new GuiButton(id++, this.width - 90, this.height - 200, 80, 20, this.strUnload); this.buttonList.add(this.btnUnload); - this.btnLayerMode = new GuiButton(id++, this.width - 90, this.height - 150 - 25, 80, 20, this.schematic != null && this.schematic.isRenderingLayer ? this.strLayers : this.strAll); + this.btnLayerMode = new GuiButton(id++, this.width - 90, this.height - 150 - 25, 80, 20, I18n.format((this.schematic != null ? this.schematic.layerMode : LayerMode.ALL).name)); this.buttonList.add(this.btnLayerMode); this.nfLayer = new GuiNumericField(this.fontRenderer, id++, this.width - 90, this.height - 150, 80, 20); @@ -123,7 +122,7 @@ public void initGui() { this.btnUnload.enabled = this.schematic != null; this.btnLayerMode.enabled = this.schematic != null; - this.nfLayer.setEnabled(this.schematic != null && this.schematic.isRenderingLayer); + this.nfLayer.setEnabled(this.schematic != null && this.schematic.layerMode != LayerMode.ALL); this.btnHide.enabled = this.schematic != null; this.btnMove.enabled = this.schematic != null; @@ -180,9 +179,9 @@ protected void actionPerformed(final GuiButton guiButton) { Schematica.proxy.unloadSchematic(); this.mc.displayGuiScreen(this.parentScreen); } else if (guiButton.id == this.btnLayerMode.id) { - this.schematic.isRenderingLayer = !this.schematic.isRenderingLayer; - this.btnLayerMode.displayString = this.schematic.isRenderingLayer ? this.strLayers : this.strAll; - this.nfLayer.setEnabled(this.schematic.isRenderingLayer); + this.schematic.layerMode = LayerMode.next(this.schematic.layerMode); + this.btnLayerMode.displayString = I18n.format(this.schematic.layerMode.name); + this.nfLayer.setEnabled(this.schematic.layerMode != LayerMode.ALL); RenderSchematic.INSTANCE.refresh(); } else if (guiButton.id == this.nfLayer.id) { this.schematic.renderingLayer = this.nfLayer.getValue(); @@ -241,7 +240,6 @@ public void drawScreen(final int mouseX, final int mouseY, final float partialTi drawCenteredString(this.fontRenderer, this.strMoveSchematic, this.centerX, this.centerY - 45, 0xFFFFFF); drawCenteredString(this.fontRenderer, this.strMaterials, 50, this.height - 85, 0xFFFFFF); drawCenteredString(this.fontRenderer, this.strPrinter, 50, this.height - 45, 0xFFFFFF); - drawCenteredString(this.fontRenderer, this.strLayers, this.width - 50, this.height - 165, 0xFFFFFF); drawCenteredString(this.fontRenderer, this.strOperations, this.width - 50, this.height - 120, 0xFFFFFF); drawString(this.fontRenderer, this.strX, this.centerX - 65, this.centerY - 24, 0xFFFFFF); diff --git a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java index 605fbea8..42f945a9 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java +++ b/src/main/java/com/github/lunatrius/schematica/client/printer/SchematicPrinter.java @@ -112,15 +112,20 @@ public boolean print(final WorldClient world, final EntityPlayerSP player) { final int slot = player.inventory.currentItem; final boolean isSneaking = player.isSneaking(); - final boolean isRenderingLayer = this.schematic.isRenderingLayer; - final int renderingLayer = this.schematic.renderingLayer; - - if (isRenderingLayer) { - if (renderingLayer > maxY || renderingLayer < minY) { + switch (schematic.layerMode) { + case ALL: break; + case SINGLE_LAYER: + if (schematic.renderingLayer > maxY) { return false; } - - minY = maxY = renderingLayer; + maxY = schematic.renderingLayer; + //$FALL-THROUGH$ + case ALL_BELOW: + if (schematic.renderingLayer < minY) { + return false; + } + maxY = schematic.renderingLayer; + break; } syncSneaking(player, true); diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java index 09398ebf..c7d5eebd 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/chunk/overlay/RenderOverlay.java @@ -99,7 +99,7 @@ public void rebuildChunk(final float x, final float y, final float z, final Chun // Build the type array (including the padding) BlockPos.MutableBlockPos mcPos = new BlockPos.MutableBlockPos(); for (final BlockPos.MutableBlockPos pos : BlockPos.getAllInBoxMutable(fromEx, toEx)) { - if (schematic.isRenderingLayer && schematic.renderingLayer != pos.getY() || !schematic.isInside(pos)) { + if (!schematic.isInside(pos) || !schematic.layerMode.shouldUseLayer(schematic, pos.getY())) { continue; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index f83348cf..915c559e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -37,7 +37,7 @@ public List getList(final EntityPlayer player, final Schematic final MBlockPos mcPos = new MBlockPos(); for (final MBlockPos pos : BlockPosHelper.getAllInBox(BlockPos.ORIGIN, new BlockPos(world.getWidth() - 1, world.getHeight() - 1, world.getLength() - 1))) { - if (world.isRenderingLayer && pos.getY() != world.renderingLayer) { + if (!world.layerMode.shouldUseLayer(world, pos.getY())) { continue; } diff --git a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java index 9c2b0294..f897fb37 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java +++ b/src/main/java/com/github/lunatrius/schematica/client/world/SchematicWorld.java @@ -5,6 +5,7 @@ import com.github.lunatrius.schematica.api.ISchematic; import com.github.lunatrius.schematica.block.state.pattern.BlockStateReplacer; import com.github.lunatrius.schematica.client.world.chunk.ChunkProviderSchematic; +import com.github.lunatrius.schematica.reference.Names; import com.github.lunatrius.schematica.reference.Reference; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; @@ -34,12 +35,45 @@ public class SchematicWorld extends WorldClient { private static final WorldSettings WORLD_SETTINGS = new WorldSettings(0, GameType.CREATIVE, false, false, WorldType.FLAT); + public static enum LayerMode { + ALL(Names.Gui.Control.MODE_ALL) { + @Override + public boolean shouldUseLayer(final SchematicWorld world, final int layer) { + return true; + } + }, + SINGLE_LAYER(Names.Gui.Control.MODE_LAYERS) { + @Override + public boolean shouldUseLayer(final SchematicWorld world, final int layer) { + return layer == world.renderingLayer; + } + }, + ALL_BELOW(Names.Gui.Control.MODE_BELOW) { + @Override + public boolean shouldUseLayer(final SchematicWorld world, final int layer) { + return layer <= world.renderingLayer; + } + }; + public abstract boolean shouldUseLayer(SchematicWorld world, int layer); + + private LayerMode(String name) { + this.name = name; + } + + public final String name; + + public static LayerMode next(final LayerMode mode) { + LayerMode[] values = values(); + return values[(mode.ordinal() + 1) % values.length]; + } + } + private ISchematic schematic; public final MBlockPos position = new MBlockPos(); - public boolean isRendering; - public boolean isRenderingLayer; - public int renderingLayer; + public boolean isRendering = false; + public LayerMode layerMode = LayerMode.ALL; + public int renderingLayer = 0; public SchematicWorld(final ISchematic schematic) { super(null, WORLD_SETTINGS, 0, EnumDifficulty.PEACEFUL, Minecraft.getMinecraft().mcProfiler); @@ -48,15 +82,11 @@ public SchematicWorld(final ISchematic schematic) { for (final TileEntity tileEntity : schematic.getTileEntities()) { initializeTileEntity(tileEntity); } - - this.isRendering = false; - this.isRenderingLayer = false; - this.renderingLayer = 0; } @Override public IBlockState getBlockState(final BlockPos pos) { - if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { + if (!this.layerMode.shouldUseLayer(this, pos.getY())) { return Blocks.AIR.getDefaultState(); } @@ -70,7 +100,7 @@ public boolean setBlockState(final BlockPos pos, final IBlockState state, final @Override public TileEntity getTileEntity(final BlockPos pos) { - if (this.isRenderingLayer && this.renderingLayer != pos.getY()) { + if (!this.layerMode.shouldUseLayer(this, pos.getY())) { return null; } diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index c4e0e305..a36af79f 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -6,6 +6,7 @@ import com.github.lunatrius.schematica.client.printer.SchematicPrinter; import com.github.lunatrius.schematica.client.renderer.RenderSchematic; import com.github.lunatrius.schematica.client.world.SchematicWorld; +import com.github.lunatrius.schematica.client.world.SchematicWorld.LayerMode; import com.github.lunatrius.schematica.proxy.ClientProxy; import com.github.lunatrius.schematica.reference.Names; import net.minecraft.client.Minecraft; @@ -70,7 +71,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_INC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic != null && schematic.isRenderingLayer) { + if (schematic.layerMode != LayerMode.ALL) { schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } @@ -78,7 +79,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_DEC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic != null && schematic.isRenderingLayer) { + if (schematic.layerMode != LayerMode.ALL) { schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } @@ -87,7 +88,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_TOGGLE.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; if (schematic != null) { - schematic.isRenderingLayer = !schematic.isRenderingLayer; + schematic.layerMode = LayerMode.next(schematic.layerMode); RenderSchematic.INSTANCE.refresh(); } } diff --git a/src/main/java/com/github/lunatrius/schematica/reference/Names.java b/src/main/java/com/github/lunatrius/schematica/reference/Names.java index fa815beb..9e7f7036 100644 --- a/src/main/java/com/github/lunatrius/schematica/reference/Names.java +++ b/src/main/java/com/github/lunatrius/schematica/reference/Names.java @@ -166,6 +166,7 @@ public static final class Control { public static final String UNLOAD = "schematica.gui.unload"; public static final String MODE_ALL = "schematica.gui.all"; public static final String MODE_LAYERS = "schematica.gui.layers"; + public static final String MODE_BELOW = "schematica.gui.below"; public static final String HIDE = "schematica.gui.hide"; public static final String SHOW = "schematica.gui.show"; public static final String MOVE_HERE = "schematica.gui.movehere"; diff --git a/src/main/resources/assets/schematica/lang/en_us.lang b/src/main/resources/assets/schematica/lang/en_us.lang index 6d1cbc3f..f899b396 100644 --- a/src/main/resources/assets/schematica/lang/en_us.lang +++ b/src/main/resources/assets/schematica/lang/en_us.lang @@ -33,6 +33,7 @@ schematica.gui.operations=Operations schematica.gui.unload=Unload schematica.gui.all=ALL schematica.gui.layers=Layers +schematica.gui.below=All below schematica.gui.hide=Hide schematica.gui.show=Show schematica.gui.movehere=Move here From e4135f518fdbfc2015b23b35c3b0ad3d40ee3161 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Tue, 28 Nov 2017 17:09:14 +0100 Subject: [PATCH 311/314] Sort folders and schematic files. Fixes gh-73 --- .../lunatrius/schematica/client/gui/load/GuiSchematicLoad.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java index cb7377d8..3e3c6771 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java +++ b/src/main/java/com/github/lunatrius/schematica/client/gui/load/GuiSchematicLoad.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class GuiSchematicLoad extends GuiScreenBase { @@ -138,6 +139,7 @@ protected void reloadSchematics() { if (filesFolders == null) { Reference.logger.error("listFiles returned null (directory: {})!", this.currentDirectory); } else { + Arrays.sort(filesFolders, (final File a, final File b) -> a.getName().compareToIgnoreCase(b.getName())); for (final File file : filesFolders) { if (file == null) { continue; @@ -156,6 +158,7 @@ protected void reloadSchematics() { if (filesSchematics == null || filesSchematics.length == 0) { this.schematicFiles.add(new GuiSchematicEntry(this.strNoSchematic, Blocks.DIRT, 0, false)); } else { + Arrays.sort(filesSchematics, (final File a, final File b) -> a.getName().compareToIgnoreCase(b.getName())); for (final File file : filesSchematics) { name = file.getName(); From 485a0bd8219c4d0856338a10a8e3822fd8828ee0 Mon Sep 17 00:00:00 2001 From: Timofey Date: Tue, 28 Nov 2017 19:45:08 +0300 Subject: [PATCH 312/314] Update ru_ru --- .../assets/schematica/lang/ru_ru.lang | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/resources/assets/schematica/lang/ru_ru.lang b/src/main/resources/assets/schematica/lang/ru_ru.lang index 67524476..f9d29246 100644 --- a/src/main/resources/assets/schematica/lang/ru_ru.lang +++ b/src/main/resources/assets/schematica/lang/ru_ru.lang @@ -23,18 +23,20 @@ schematica.gui.point.red=Красная точка schematica.gui.point.blue=Синяя точка schematica.gui.save=Сохранить schematica.gui.saveselection=Сохранение схемы +schematica.gui.format=Формат: %s # gui - general - control -schematica.gui.moveschematic=Передвинуть схему +schematica.gui.moveschematic=Перемещение схемы schematica.gui.materials=Материалы schematica.gui.printer=Принтер schematica.gui.operations=Операции schematica.gui.unload=Выгрузить schematica.gui.all=Все слои schematica.gui.layers=Один слой +schematica.gui.below=Все ниже schematica.gui.hide=Скрыть schematica.gui.show=Показать -schematica.gui.movehere=Передвинуть сюда +schematica.gui.movehere=Сместить сюда schematica.gui.flip=Отразить schematica.gui.rotate=Повернуть schematica.gui.materialname=Материал @@ -111,7 +113,7 @@ schematica.config.swapSlot8.tooltip=Позволяет принтеру испо schematica.config.schematicDirectory=Папка схем schematica.config.schematicDirectory.tooltip=Папка, в которой хранятся схемы. schematica.config.extraAirBlocks=Блоки воздуха -schematica.config.extraAirBlocks.tooltip=Данные блоки отображаются в схемах как воздух. +schematica.config.extraAirBlocks.tooltip=Заданные блоки отображаются в схемах в качестве воздуха. # gui - config - server schematica.config.printerEnabled=Принтер @@ -135,13 +137,14 @@ schematica.key.moveHere=Передвинуть сюда schematica.key.pickBlock=Выбор блока в схеме # commands - save -schematica.command.save.usage=/schematicaSave <началоX> <началоY> <началоZ> <конецX> <конецY> <конецZ> <название> +schematica.command.save.usage=/schematicaSave <началоX> <началоY> <началоZ> <конецX> <конецY> <конецZ> <название> [формат] schematica.command.save.playersOnly=Только игроки могут использовать данную команду. -schematica.command.save.started=Сохранение %d чанка(-ов) в файл %s... -schematica.command.save.saveSucceeded=Схема %s сохранена. -schematica.command.save.saveFailed=Произошла ошибка при сохранении файла %s. +schematica.command.save.started=Сохранение %d чанка(-ов) в файл «%s»... +schematica.command.save.saveSucceeded=Схема «%s» сохранена. +schematica.command.save.saveFailed=Произошла ошибка при сохранении файла «%s». schematica.command.save.quotaExceeded=Превышена квота сервера. Используйте /schematicaList и /schematicaRemove, чтобы удалить старые схемы. schematica.command.save.playerSchematicDirUnavailable=Произошла ошибка на сервере, из-за которой неудалось сохранить схему. Свяжитесь с администратором сервера. +schematica.command.save.unknownFormat=Формат неизвестен: «%s» # commands - list schematica.command.list.usage=/schematicaList [страница] @@ -174,3 +177,9 @@ schematica.message.togglePrinter=Принтер: %s schematica.message.invalidBlock=Блок «%s» не существует. schematica.message.invalidProperty=Свойтво «%s» не существует. schematica.message.invalidPropertyForBlock=Свойтво «%s» не существует у блока «%s». + +# schematic formats +schematica.format.classic=Classic +schematica.format.alpha=Стандартный +schematica.format.structure=Блок-конструктор +schematica.format.invalid=Неизвестный From 7171cb02905b377ead9eb73e3ed78ccf39299160 Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sat, 6 Jan 2018 15:59:24 +0100 Subject: [PATCH 313/314] Add missing null checks. Fixes gh-299 --- .../lunatrius/schematica/handler/client/InputHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java index a36af79f..8693e5ff 100644 --- a/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java +++ b/src/main/java/com/github/lunatrius/schematica/handler/client/InputHandler.java @@ -71,7 +71,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_INC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic.layerMode != LayerMode.ALL) { + if (schematic != null && schematic.layerMode != LayerMode.ALL) { schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer + 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } @@ -79,7 +79,7 @@ public void onKeyInput(final InputEvent event) { if (KEY_BINDING_LAYER_DEC.isPressed()) { final SchematicWorld schematic = ClientProxy.schematic; - if (schematic.layerMode != LayerMode.ALL) { + if (schematic != null && schematic.layerMode != LayerMode.ALL) { schematic.renderingLayer = MathHelper.clamp(schematic.renderingLayer - 1, 0, schematic.getHeight() - 1); RenderSchematic.INSTANCE.refresh(); } From e663b48db009ea9ff0be7c5f1b418077b093f10b Mon Sep 17 00:00:00 2001 From: Lunatrius Date: Sun, 22 Apr 2018 13:17:57 +0200 Subject: [PATCH 314/314] Add additional null checks to prevent crashes under certain conditions. This should address most of the issues in gh-310 --- .../schematica/client/renderer/SchematicRenderCache.java | 9 +++++++-- .../lunatrius/schematica/client/util/BlockList.java | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java index 2426c186..e5ecd09e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java +++ b/src/main/java/com/github/lunatrius/schematica/client/renderer/SchematicRenderCache.java @@ -18,10 +18,15 @@ public SchematicRenderCache(final World world, final BlockPos from, final BlockP @Override public IBlockState getBlockState(final BlockPos pos) { - final BlockPos realPos = pos.add(ClientProxy.schematic.position); + final BlockPos schPos = ClientProxy.schematic.position; + if (schPos == null) { + return Blocks.AIR.getDefaultState(); + } + + final BlockPos realPos = pos.add(schPos); final World world = this.minecraft.world; - if (!world.isAirBlock(realPos) && !ConfigurationHandler.isExtraAirBlock(world.getBlockState(realPos).getBlock())) { + if (world == null || !world.isAirBlock(realPos) && !ConfigurationHandler.isExtraAirBlock(world.getBlockState(realPos).getBlock())) { return Blocks.AIR.getDefaultState(); } diff --git a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java index 915c559e..3c88dc6e 100644 --- a/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java +++ b/src/main/java/com/github/lunatrius/schematica/client/util/BlockList.java @@ -72,6 +72,11 @@ public List getList(final EntityPlayer player, final Schematic } } + if (stack == null) { + Reference.logger.error("Could not find the item for: {} (getPickBlock() returned null, this is a bug)", blockState); + continue; + } + if (stack.isEmpty()) { Reference.logger.warn("Could not find the item for: {}", blockState); continue;