Skip to content

Commit

Permalink
Massive sound fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DuchLord committed Nov 1, 2016
1 parent 8924762 commit 63f4026
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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.
Expand Down
26 changes: 25 additions & 1 deletion src/main/java/treechopper/common/handler/TreeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -166,6 +167,20 @@ private void lookAround(BlockPos position, World world, Set<BlockPos> 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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/treechopper/core/TreeChopper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 63f4026

Please sign in to comment.