From c0d9da251e76b3b7e376afcae07c86da74d2a7f5 Mon Sep 17 00:00:00 2001 From: DuchLord Date: Sat, 25 Feb 2017 15:55:02 +0100 Subject: [PATCH] #31 Port to MC 1.11.2 --- README.md | 5 +- build.gradle | 27 ++--- .../treechopper/client/gui/GuiFactory.java | 3 +- .../treechopper/common/command/Commands.java | 112 +++++++++--------- .../common/handler/TreeHandler.java | 6 +- .../java/treechopper/core/TreeChopper.java | 2 +- .../java/treechopper/proxy/ClientProxy.java | 8 +- .../java/treechopper/proxy/ServerProxy.java | 6 +- src/main/resources/mcmod.info | 2 +- 9 files changed, 85 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 9126498..708c727 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ * Supports mods (e.g. Biomes O' Plenty, Forestry, Tinkers Construct). * Can be deactivated by holding SHIFT. * Config with settings and list of allowed axes and types of wood. +* Option to reverse function (chopping with SHIFT)

Usage

Type in-game command "/tch help" or "/treechop help" for more info @@ -20,6 +21,6 @@ Add UnlocalizedName of new item into "treechopper.cfg" (appdata/roaming/.minecra [Curse.com](https://mods.curse.com/mc-mods/minecraft/250241-tree-chopper) -For Minecraft **1.10.2**. +For Minecraft **1.11.2**. -Recommended forge version: **1.10.2 - 12.18.3.2185** \ No newline at end of file +Recommended forge version: **1.11.2 - 13.20.0.2228** \ No newline at end of file diff --git a/build.gradle b/build.gradle index de4059e..4500888 100644 --- a/build.gradle +++ b/build.gradle @@ -8,11 +8,11 @@ buildscript { } } apply plugin: 'net.minecraftforge.gradle.forge' -//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup. +//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -version = "1.10.2-1.1.2" -group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +version = "1.11.2-1.1.2" +group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "TreeChopper" sourceCompatibility = targetCompatibility = "1.6" // Need this here so eclipse task generates correctly. @@ -21,15 +21,15 @@ compileJava { } minecraft { - version = "1.10.2-12.18.3.2185" + version = "1.11.2-13.20.0.2228" runDir = "run" - + // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not allways work. + // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20161111" + mappings = "snapshot_20161220" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } @@ -38,7 +38,7 @@ dependencies { // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" - + // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env @@ -57,8 +57,7 @@ dependencies { } -processResources -{ +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version @@ -66,12 +65,12 @@ processResources // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - + // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version + expand 'version': project.version, 'mcversion': project.minecraft.version } - - // copy everything else, thats not the mcmod.info + + // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } diff --git a/src/main/java/treechopper/client/gui/GuiFactory.java b/src/main/java/treechopper/client/gui/GuiFactory.java index 13410cb..56f28e6 100644 --- a/src/main/java/treechopper/client/gui/GuiFactory.java +++ b/src/main/java/treechopper/client/gui/GuiFactory.java @@ -26,8 +26,7 @@ public Set runtimeGuiCategories() { } @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { //Why + public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; } - } diff --git a/src/main/java/treechopper/common/command/Commands.java b/src/main/java/treechopper/common/command/Commands.java index 09322db..694d308 100644 --- a/src/main/java/treechopper/common/command/Commands.java +++ b/src/main/java/treechopper/common/command/Commands.java @@ -25,12 +25,12 @@ public class Commands extends CommandBase { @Override - public String getCommandName() { + public String getName() { return "treechop"; } @Override - public String getCommandUsage(ICommandSender sender) { + public String getUsage(ICommandSender sender) { return "Type \"/treechop help\" for help"; } @@ -40,14 +40,14 @@ public boolean checkPermission(MinecraftServer server, ICommandSender sender) { } @Override - public List getCommandAliases() { + public List getAliases() { return Lists.newArrayList("tch"); } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if ((server.isSinglePlayer()) && server.getServerOwner().equals(sender.getName()) || sender.canCommandSenderUseCommand(2, this.getCommandName())) { + if ((server.isSinglePlayer()) && server.getServerOwner().equals(sender.getName()) || sender.canUseCommand(2, this.getName())) { if (args.length < 1) throw new WrongUsageException("Type \"/treechop help\" for help"); @@ -57,9 +57,9 @@ else if (args[0].equals("ignoredur")) { ConfigHandler.setIgnoreDurability(parseBoolean(args[1])); if (ConfigHandler.ignoreDurability) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Ignore axe durability has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Ignore axe durability has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Ignore axe durability has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Ignore axe durability has been switched " + TextFormatting.RED + "OFF")); TreeChopper.network.sendToAll(new ServerMessage(ConfigHandler.breakSpeed, ConfigHandler.ignoreDurability)); @@ -69,9 +69,9 @@ else if (args[0].equals("ignoredur")) { ConfigHandler.setPlantSapling(parseBoolean(args[1])); if (ConfigHandler.plantSapling) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Auto sapling has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Auto sapling has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Auto sapling has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Auto sapling has been switched " + TextFormatting.RED + "OFF")); } else if (args[0].equals("decayleaves")) { if (args.length != 2) @@ -79,16 +79,16 @@ else if (args[0].equals("ignoredur")) { ConfigHandler.setDecayLeaves(parseBoolean(args[1])); if (ConfigHandler.decayLeaves) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Decay leaves has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Decay leaves has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Decay leaves has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Decay leaves has been switched " + TextFormatting.RED + "OFF")); } else if (args[0].equals("breakspeed")) { if (args.length != 2) throw new WrongUsageException("/treechop breakspeed [value]"); ConfigHandler.setBreakSpeed(parseInt(args[1], 1, 1000)); - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Break speed has been set to " + ConfigHandler.breakSpeed + ", [DEFAULT: 10]")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Break speed has been set to " + ConfigHandler.breakSpeed + ", [DEFAULT: 10]")); TreeChopper.network.sendToAll(new ServerMessage(ConfigHandler.breakSpeed, ConfigHandler.ignoreDurability)); @@ -104,9 +104,9 @@ else if (args[0].equals("ignoredur")) { ConfigHandler.setPlantSaplingTree(parseBoolean(args[1])); if (ConfigHandler.plantSaplingTree) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Planting on tree position has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Planting on tree position has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Planting on tree position has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Planting on tree position has been switched " + TextFormatting.RED + "OFF")); } else if (args[0].equals("reset")) { @@ -120,16 +120,16 @@ else if (args[0].equals("ignoredur")) { TreeChopper.network.sendToAll(new ServerMessage(ConfigHandler.breakSpeed, ConfigHandler.ignoreDurability)); - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Settings has been reset")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Settings has been reset")); } else if (args[0].equals("roots")) { if (args.length != 2) throw new WrongUsageException("/treechop roots [0,1]"); ConfigHandler.setRoots(parseBoolean(args[1])); if (ConfigHandler.roots) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Breaking roots has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Breaking roots has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Breaking roots has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Breaking roots has been switched " + TextFormatting.RED + "OFF")); } else if (!args[0].equals("printname") && !args[0].equals("reverse")) throw new WrongUsageException("Type \"/treechop help\" for help"); } else { @@ -158,9 +158,9 @@ else if (args[0].equals("info") || args[0].equals("?")) { boolean reverseShift = parseBoolean(args[1]); if (reverseShift) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Reverse function has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Reverse function has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Reverse function has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Reverse function has been switched " + TextFormatting.RED + "OFF")); try { StaticHandler.playerReverseShift.put(sender.getCommandSenderEntity().getEntityId(), reverseShift); @@ -168,7 +168,7 @@ else if (args[0].equals("info") || args[0].equals("?")) { TreeChopper.network.sendTo(new sendReverseToClient(reverseShift), (EntityPlayerMP) sender); } catch (Exception e) { - sender.addChatMessage(new TextComponentTranslation("You are not a player..")); + sender.sendMessage(new TextComponentTranslation("You are not a player..")); } } @@ -176,97 +176,97 @@ else if (args[0].equals("info") || args[0].equals("?")) { } private void printSettings(ICommandSender sender) { - sender.addChatMessage(new TextComponentTranslation(TextFormatting.GOLD + "Tree Chopper")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.GRAY + "Settings:")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.GOLD + "Tree Chopper")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.GRAY + "Settings:")); - sender.addChatMessage(new TextComponentTranslation("Break speed: " + TextFormatting.GOLD + ConfigHandler.breakSpeed)); + sender.sendMessage(new TextComponentTranslation("Break speed: " + TextFormatting.GOLD + ConfigHandler.breakSpeed)); if (ConfigHandler.decayLeaves) - sender.addChatMessage(new TextComponentTranslation("Leaves decay: " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("Leaves decay: " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("Leaves decay: " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("Leaves decay: " + TextFormatting.RED + "OFF")); if (ConfigHandler.plantSapling) - sender.addChatMessage(new TextComponentTranslation("Automatic sapling plant: " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("Automatic sapling plant: " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("Automatic sapling plant: " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("Automatic sapling plant: " + TextFormatting.RED + "OFF")); if (ConfigHandler.plantSaplingTree) - sender.addChatMessage(new TextComponentTranslation("Planting on tree position: " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("Planting on tree position: " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("Planting on tree position: " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("Planting on tree position: " + TextFormatting.RED + "OFF")); if (ConfigHandler.ignoreDurability) - sender.addChatMessage(new TextComponentTranslation("Ignore durability: " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("Ignore durability: " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("Ignore durability: " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("Ignore durability: " + TextFormatting.RED + "OFF")); if (ConfigHandler.roots) - sender.addChatMessage(new TextComponentTranslation("Breaking roots: " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("Breaking roots: " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("Breaking roots: " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("Breaking roots: " + TextFormatting.RED + "OFF")); try { if (StaticHandler.playerReverseShift.get(sender.getCommandSenderEntity().getEntityId())) - sender.addChatMessage(new TextComponentTranslation("Reverse func: " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("Reverse func: " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("Reverse func: " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("Reverse func: " + TextFormatting.RED + "OFF")); } catch (Exception e) { - sender.addChatMessage(new TextComponentTranslation("Reverse func: " + TextFormatting.RED + "-")); + sender.sendMessage(new TextComponentTranslation("Reverse func: " + TextFormatting.RED + "-")); } } private void printName(boolean print, ICommandSender sender) { if (print) - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Printing UnlocalizedNames has been switched " + TextFormatting.GREEN + "ON")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Printing UnlocalizedNames has been switched " + TextFormatting.GREEN + "ON")); else - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Printing UnlocalizedNames has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Printing UnlocalizedNames has been switched " + TextFormatting.RED + "OFF")); if (print) try { StaticHandler.playerPrintUnName.add(sender.getCommandSenderEntity().getEntityId()); } catch (Exception e) { - sender.addChatMessage(new TextComponentTranslation("You are not a player..")); - sender.addChatMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Printing UnlocalizedNames has been switched " + TextFormatting.RED + "OFF")); + sender.sendMessage(new TextComponentTranslation("You are not a player..")); + sender.sendMessage(new TextComponentTranslation("[" + TextFormatting.GOLD + "TCH" + TextFormatting.RESET + "] Printing UnlocalizedNames has been switched " + TextFormatting.RED + "OFF")); } else try { StaticHandler.playerPrintUnName.remove(sender.getCommandSenderEntity().getEntityId()); } catch (Exception e) { - sender.addChatMessage(new TextComponentTranslation("No effect.. (Not been switched on)")); + sender.sendMessage(new TextComponentTranslation("No effect.. (Not been switched on)")); } } private void usage(ICommandSender sender, int permissins) { - sender.addChatMessage(new TextComponentTranslation(TextFormatting.GOLD + "Format: /treechop [value]")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.GRAY + "Arguments:")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.GOLD + "Format: /treechop [value]")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.GRAY + "Arguments:")); switch (permissins) { case 0: - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "?" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Print info about server settings")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "printname" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Logging UnlocalizedName of target block and main hand item, on mouse click")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "reverse" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Reverse shift function")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "?" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Print info about server settings")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "printname" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Logging UnlocalizedName of target block and main hand item, on mouse click")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "reverse" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Reverse shift function")); break; case 2: - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "?" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Print info about server settings")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "ignoredur" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Ignoring duration of axe.")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "plantsap" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Auto plant sapling, around his trunk.")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "plantsaptree" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Set plant position on tree position.")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "decayleaves" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Decay leaves with tree fall.")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "breakspeed" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Set speed of breaking tree. Default: 10")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "printname" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Logging UnlocalizedName of target block and main hand item, on mouse click")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "reset" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Reset settings to default.")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "roots" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Break roots - dig 3 blocks under ground")); - sender.addChatMessage(new TextComponentTranslation(TextFormatting.AQUA + "reverse" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Reverse shift function")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "?" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Print info about server settings")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "ignoredur" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Ignoring duration of axe.")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "plantsap" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Auto plant sapling, around his trunk.")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "plantsaptree" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Set plant position on tree position.")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "decayleaves" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Decay leaves with tree fall.")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "breakspeed" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Set speed of breaking tree. Default: 10")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "printname" + TextFormatting.RESET + " [value] -" + TextFormatting.ITALIC + " Logging UnlocalizedName of target block and main hand item, on mouse click")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "reset" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Reset settings to default.")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "roots" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Break roots - dig 3 blocks under ground")); + sender.sendMessage(new TextComponentTranslation(TextFormatting.AQUA + "reverse" + TextFormatting.RESET + " -" + TextFormatting.ITALIC + " Reverse shift function")); break; } } @Override - public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + public List getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) return getListOfStringsMatchingLastWord(args, "ignoredur", "plantsap", "plantsaptree", "decayleaves", "breakspeed", "info", "printname", "help", "reset", "roots", "reverse"); diff --git a/src/main/java/treechopper/common/handler/TreeHandler.java b/src/main/java/treechopper/common/handler/TreeHandler.java index 3805d48..110481f 100644 --- a/src/main/java/treechopper/common/handler/TreeHandler.java +++ b/src/main/java/treechopper/common/handler/TreeHandler.java @@ -125,7 +125,7 @@ private boolean logAnalyze(Block logType, BlockPos position, BlockPos originPos, return false; } - if (world.getBlockState(position).getPropertyNames().toString().contains("variant") && logType.getBlockState().getProperty("variant") != null) + if (world.getBlockState(position).getPropertyKeys().toString().contains("variant") && logType.getBlockState().getProperty("variant") != null) return ((world.getBlockState(position).getValue(logType.getBlockState().getProperty("variant")) == world.getBlockState(originPos).getValue(logType.getBlockState().getProperty("variant")))); return true; // Ignoring log variant - doesnt have one.. @@ -208,7 +208,7 @@ public int treeDestroy(BlockEvent.BreakEvent event) { if (!ConfigHandler.decayLeaves) { for (BlockPos blockPos : leaves) { - if (event.getWorld().getBlockState(blockPos).getPropertyNames().toString().contains("variant") && event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant") != null) + if (event.getWorld().getBlockState(blockPos).getPropertyKeys().toString().contains("variant") && event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant") != null) leafVariant = event.getWorld().getBlockState(blockPos).getValue(event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant")).toString().toUpperCase(); else leafVariant = "notKnown"; @@ -245,7 +245,7 @@ public int treeDestroy(BlockEvent.BreakEvent event) { soundMuter = 0; for (BlockPos blockPos : leaves) { - if (event.getWorld().getBlockState(blockPos).getPropertyNames().toString().contains("variant") && event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant") != null) + if (event.getWorld().getBlockState(blockPos).getPropertyKeys().toString().contains("variant") && event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant") != null) leafVariant = event.getWorld().getBlockState(blockPos).getValue(event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant")).toString().toUpperCase(); else leafVariant = "notKnown"; diff --git a/src/main/java/treechopper/core/TreeChopper.java b/src/main/java/treechopper/core/TreeChopper.java index 2b9d43f..677032f 100644 --- a/src/main/java/treechopper/core/TreeChopper.java +++ b/src/main/java/treechopper/core/TreeChopper.java @@ -23,7 +23,7 @@ * Created by Duchy on 8/11/2016. */ -@Mod(modid = TreeChopper.MODID, version = TreeChopper.VERSION, dependencies = "required-after:Forge@[12.18.1.2017,)", guiFactory = "treechopper.client.gui.GuiFactory") +@Mod(modid = TreeChopper.MODID, version = TreeChopper.VERSION, dependencies = "required-after:forge@[13.20.0.2200,)", guiFactory = "treechopper.client.gui.GuiFactory") public class TreeChopper { public static SimpleNetworkWrapper network; diff --git a/src/main/java/treechopper/proxy/ClientProxy.java b/src/main/java/treechopper/proxy/ClientProxy.java index 44ddc8c..970a72d 100644 --- a/src/main/java/treechopper/proxy/ClientProxy.java +++ b/src/main/java/treechopper/proxy/ClientProxy.java @@ -52,10 +52,10 @@ public void interactTree(PlayerInteractEvent event) { StaticHandler.playerHoldShift.put(event.getEntityPlayer().getEntityId(), event.getEntityPlayer().isSneaking()); if (StaticHandler.playerPrintUnName.contains(event.getEntityPlayer().getEntityId()) && event.getSide().isServer()) { // No text formation because of forge diferences may cause error - event.getEntityPlayer().addChatMessage(new TextComponentTranslation("Block: " + event.getWorld().getBlockState(event.getPos()).getBlock().getUnlocalizedName())); + event.getEntityPlayer().sendMessage(new TextComponentTranslation("Block: " + event.getWorld().getBlockState(event.getPos()).getBlock().getUnlocalizedName())); if (event.getEntityPlayer().getHeldItemMainhand() != null) - event.getEntityPlayer().addChatMessage(new TextComponentTranslation("Main hand item: " + event.getEntityPlayer().getHeldItemMainhand().getItem().getUnlocalizedName())); - event.getEntityPlayer().addChatMessage(new TextComponentTranslation("-")); + event.getEntityPlayer().sendMessage(new TextComponentTranslation("Main hand item: " + event.getEntityPlayer().getHeldItemMainhand().getItem().getUnlocalizedName())); + event.getEntityPlayer().sendMessage(new TextComponentTranslation("-")); } return; @@ -83,7 +83,7 @@ public void interactTree(PlayerInteractEvent event) { if (logCount > axeDurability && !ConfigHandler.ignoreDurability) { if (event.getSide().isClient()) { String notEnoughDur = ChatFormatting.WHITE + "[" + ChatFormatting.GOLD + "TreeChop" + ChatFormatting.WHITE + "] Not enough durability.."; - event.getEntityPlayer().addChatMessage(new TextComponentString(notEnoughDur)); + event.getEntityPlayer().sendMessage(new TextComponentString(notEnoughDur)); } ClientProxy.logCount = 0; return; diff --git a/src/main/java/treechopper/proxy/ServerProxy.java b/src/main/java/treechopper/proxy/ServerProxy.java index 11cb81a..caf885b 100644 --- a/src/main/java/treechopper/proxy/ServerProxy.java +++ b/src/main/java/treechopper/proxy/ServerProxy.java @@ -20,10 +20,10 @@ public void interactTree(PlayerInteractEvent event) { StaticHandler.playerHoldShift.put(event.getEntityPlayer().getEntityId(), event.getEntityPlayer().isSneaking()); if (StaticHandler.playerPrintUnName.contains(event.getEntityPlayer().getEntityId()) && event.getSide().isServer()) { // No text formation because of forge diferences may cause error - event.getEntityPlayer().addChatMessage(new TextComponentTranslation("Block: " + event.getWorld().getBlockState(event.getPos()).getBlock().getUnlocalizedName())); + event.getEntityPlayer().sendMessage(new TextComponentTranslation("Block: " + event.getWorld().getBlockState(event.getPos()).getBlock().getUnlocalizedName())); if (event.getEntityPlayer().getHeldItemMainhand() != null) - event.getEntityPlayer().addChatMessage(new TextComponentTranslation("Main hand item: " + event.getEntityPlayer().getHeldItemMainhand().getItem().getUnlocalizedName())); - event.getEntityPlayer().addChatMessage(new TextComponentTranslation("-")); + event.getEntityPlayer().sendMessage(new TextComponentTranslation("Main hand item: " + event.getEntityPlayer().getHeldItemMainhand().getItem().getUnlocalizedName())); + event.getEntityPlayer().sendMessage(new TextComponentTranslation("-")); } } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index ea293b5..7c6fff5 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,7 +1,7 @@ [{ "modid": "treechopper", "name": "Tree Chopper", - "description": "Simple mod for chop down whole tree and much more.. \n\nRecommended forge version: 1.10.2 - 12.18.3.2185", + "description": "Simple mod for chop down whole tree and much more.. \n\nRecommended forge version: 1.11.2 - 13.20.0.2228", "version": "1.1", "mcversion": "${version}", "logoFile": "textures/logo.jpg",