Created
November 28, 2010 12:07
-
-
Save grum/718862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class bt extends fu { | |
private int a; | |
public bt(int paramInt) { | |
super(paramInt); | |
this.a = (paramInt + 256); | |
a(ga.m[(paramInt + 256)].a(2)); | |
} | |
@Override | |
public boolean a(hl paramhl, fx paramfx, eo parameo, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { | |
// hMod: Bail if we have nothing of the items in hand | |
if (paramhl.a == 0) { | |
return false; | |
} | |
// hMod: Store blockInfo of the one we clicked | |
int blockClickedId = parameo.a(paramInt1, paramInt2, paramInt3); | |
Block blockClicked = new Block( paramInt1, paramInt2, paramInt3, blockClickedId); | |
if (blockClickedId == ga.aS.bh) { | |
paramInt4 = 0; | |
} else { | |
if (paramInt4 == 0) { | |
paramInt2--; | |
} | |
if (paramInt4 == 1) { | |
paramInt2++; | |
} | |
if (paramInt4 == 2) { | |
paramInt3--; | |
} | |
if (paramInt4 == 3) { | |
paramInt3++; | |
} | |
if (paramInt4 == 4) { | |
paramInt1--; | |
} | |
if (paramInt4 == 5) { | |
paramInt1++; | |
} | |
} | |
// hMod: Store faceClicked (must be here to have the 'snow' specialcase. | |
blockClicked.setFaceClicked(Block.Face.fromId( paramInt4 )); | |
// hMod: And the block we're about to place | |
Block blockPlaced = new Block( paramInt1, paramInt2, paramInt3, this.a); | |
// hMod Store all the old settings 'externally' in case someone changes blockPlaced. | |
int oldX = blockPlaced.getX(); | |
int oldY = blockPlaced.getY(); | |
int oldZ = blockPlaced.getZ(); | |
int oldMaterial = parameo.a(oldX, oldY, oldZ); | |
int oldData = parameo.b(oldX, oldY, oldZ); | |
if (parameo.a(this.a, paramInt1, paramInt2, paramInt3, false)) { | |
ga localga = ga.m[this.a]; | |
//hMod: Take over blockplacement | |
if (parameo.a(paramInt1, paramInt2, paramInt3, this.a)) { | |
// hMod: Check if this was playerPlaced and call the hook | |
if (paramfx instanceof er && true /* hook result */) { | |
//undo! | |
parameo.a( oldX, oldY, oldZ, oldMaterial ); | |
parameo.c( oldX, oldY, oldZ, oldData ); | |
return false; | |
} else { | |
parameo.f(paramInt1, paramInt2, paramInt3); | |
parameo.g(paramInt1, paramInt2, paramInt3, this.a); | |
ga.m[this.a].c(parameo, paramInt1, paramInt2, paramInt3, paramInt4); | |
ga.m[this.a].a(parameo, paramInt1, paramInt2, paramInt3, paramfx); | |
parameo.a(paramInt1 + 0.5F, paramInt2 + 0.5F, paramInt3 + 0.5F, localga.bq.c(), (localga.bq.a() + 1.0F) / 2.0F, | |
localga.bq.b() * 0.8F); | |
paramhl.a -= 1; | |
} | |
} else { | |
// hMod: actually we failed placing it! | |
return false; | |
} | |
} else { | |
// hMod: actually we didn't place it! | |
return false; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment