diff --git a/README.md b/README.md index f2cc033..06b0fb8 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,4 @@ Add UnlocalizedName of new item into "treechopper.cfg" (appdata/roaming/.minecra For Minecraft **1.10.2** version. -Recommended forge version **1.10.2 - 12.18.2.2098** +Recommended forge version **1.10.2 - 12.18.2.2099** diff --git a/build.gradle b/build.gradle index 2e19066..0cec201 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ 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. -version = "1.10.2-1.1.0a" +version = "1.10.2-1.1.1" group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "TreeChopper" @@ -21,7 +21,7 @@ compileJava { } minecraft { - version = "1.10.2-12.18.2.2098" + version = "1.10.2-12.18.2.2099" runDir = "run" // the mappings can be changed at any time, and must be in the following format. diff --git a/src/main/java/treechopper/common/handler/TreeHandler.java b/src/main/java/treechopper/common/handler/TreeHandler.java index 4f5380d..39a00d1 100644 --- a/src/main/java/treechopper/common/handler/TreeHandler.java +++ b/src/main/java/treechopper/common/handler/TreeHandler.java @@ -3,6 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockPlanks; import net.minecraft.block.BlockSapling; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -166,6 +167,20 @@ private void lookAround(BlockPos position, World world, Set newLeaves) } + public boolean destroyBlockOverr(BlockPos pos, boolean dropBlock, World world) { + IBlockState iblockstate = world.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (block.isAir(iblockstate, world, pos)) { + return false; + } else { + if (dropBlock) + block.dropBlockAsItem(world, pos, iblockstate, 0); + + return world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); + } + } + public int treeDestroy(BlockEvent.BreakEvent event) { int logCount = tree.size(); boolean destruction; @@ -219,22 +234,31 @@ public int treeDestroy(BlockEvent.BreakEvent event) { leaves.add(blockPos); } + int soundMuter = 0; for (BlockPos blockPos : leaves) { if (event.getWorld().getBlockState(blockPos).getPropertyNames().toString().contains("variant")) leafVariant = event.getWorld().getBlockState(blockPos).getValue(event.getWorld().getBlockState(blockPos).getBlock().getBlockState().getProperty("variant")).toString().toUpperCase(); else leafVariant = "notKnown"; - destruction = event.getWorld().destroyBlock(blockPos, true); + // DESTROY LEAVES + if (soundMuter <= 2) + destruction = event.getWorld().destroyBlock(blockPos, true); + else + destruction = destroyBlockOverr(blockPos, true, event.getWorld()); + if (!destruction) System.out.println("Problem with block.. " + blockPos); event.getWorld().setBlockToAir(blockPos); + // if (leafVariantCount.containsKey(leafVariant)) { int tmpCount = leafVariantCount.get(leafVariant); leafVariantCount.put(leafVariant, ++tmpCount); } else leafVariantCount.put(leafVariant, 1); + + soundMuter++; } int maxValue = 0; diff --git a/src/main/java/treechopper/core/TreeChopper.java b/src/main/java/treechopper/core/TreeChopper.java index c023cc5..cf662f5 100644 --- a/src/main/java/treechopper/core/TreeChopper.java +++ b/src/main/java/treechopper/core/TreeChopper.java @@ -26,7 +26,7 @@ public class TreeChopper { public static SimpleNetworkWrapper network; public static final String MODID = "treechopper"; - public static final String VERSION = "1.1.0a"; + public static final String VERSION = "1.1.1"; public static boolean BoPPresent = false; public static boolean ForestryPresent = false; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 5a95e2d..3e22f88 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.2.2098", + "description": "Simple mod for chop down whole tree and much more.. \n\nRecommended forge version: 1.10.2 - 12.18.2.2099", "version": "1.1", "mcversion": "${version}", "logoFile": "textures/logo.jpg",