Skip to content

Commit

Permalink
[BLIND] Quick fix attempt for Acacia leaves (adding a new block-flag).
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Dec 29, 2013
1 parent 77a6307 commit 2b0b0a8
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -343,6 +343,9 @@ public void validate() {
/** ICE */
public static final long F_ICE = 0x20000;

/** LEAVES */
public static final long F_LEAVES = 0x40000;

/**
* Map flag to names.
*/
Expand Down Expand Up @@ -610,6 +613,7 @@ else if (mcAccess.isBlockSolid(i).decide()){
Material.LEAVES, Material.BED_BLOCK}){
blocks[mat.getId()] = leafType;
}
blockFlags[Material.LEAVES.getId()] |= F_LEAVES;
// Huge mushroom type (...)
for (Material mat : new Material[]{
Material.HUGE_MUSHROOM_1, Material.HUGE_MUSHROOM_2,
Expand Down Expand Up @@ -969,7 +973,7 @@ public static long getBreakingDuration(final int blockId, final BlockProps block
public static long getBreakingDuration(final int blockId, final BlockProps blockProps, final ToolProps toolProps, final boolean onGround, final boolean inWater, boolean aquaAffinity, int efficiency) {
if (efficiency > 0){
// Workaround until something better is found..
if (blockId == Material.LEAVES.getId() || blockProps == glassType){
if (isLeaves(blockId) || blockProps == glassType){
/*
* TODO: Some might be dealt with by insta break, by now,
* still getting exact durations would be nice to have, for expected breaking times and
Expand Down Expand Up @@ -1018,7 +1022,7 @@ else if (blockId == Material.WOOL.getId()){
duration = 240;
isValidTool = true;
}
else if (blockId == Material.LEAVES.getId()){
else if (isLeaves(blockId)){
duration = 20;
isValidTool = true;
}
Expand Down Expand Up @@ -1269,6 +1273,10 @@ public static final boolean isIce(final int id) {
return (blockFlags[id] & F_ICE) != 0;
}

public static final boolean isLeaves(final int id) {
return (blockFlags[id] & F_LEAVES) != 0;
}

/**
* Might hold true for liquids too.
* @param id
Expand Down

0 comments on commit 2b0b0a8

Please sign in to comment.