Skip to content

Commit 238013d

Browse files
committed
make hoe tilt 3x3 area, close #12
1 parent b54c60d commit 238013d

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

java/buildcraftAdditions/items/ItemMegaHoe.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ public ItemMegaHoe(int maxEnergy){
2424

2525
@Override
2626
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int geenIdee, float hitX, float hitY, float hitZ){
27-
if ((world.getBlock(x, y, z) == Blocks.dirt || world.getBlock(x, y, z) == Blocks.grass) && getEnergy(stack) >=5){
28-
world.setBlock(x, y, z, Blocks.farmland);
29-
decreaseEnergy(stack, 5, player);
30-
return true;
31-
}
32-
return false;
27+
boolean tilted = false;
28+
for (int i = x-1; i <= x+1; i++){
29+
for (int j = z-1; j <= z+1; j++){
30+
if ((world.getBlock(i, y, j) == Blocks.dirt || world.getBlock(i, y, j) == Blocks.grass) && getEnergy(stack) >=5) {
31+
world.setBlock(i, y, j, Blocks.farmland);
32+
decreaseEnergy(stack, 5, player);
33+
tilted = true;
34+
}
35+
}
36+
}
37+
return tilted;
3338
}
3439

3540
@Override

java/buildcraftAdditions/items/ItemPoweredBase.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@ public ItemPoweredBase(){
2626
}
2727

2828
public void decreaseEnergy(ItemStack stack, double energy, EntityPlayer player){
29-
if (energyB1 - energy < 0){
29+
if (energyB1 - energy <= 0){
3030
energy -= energyB1;
3131
energyB1=0;
3232
}
3333
if (energyB1 > energy){
3434
energyB1 -= energy;
3535
energy = 0;
3636
}
37-
if (energyB2 - energy < 0){
37+
if (energyB2 - energy <= 0){
3838
energy -= energyB1;
3939
energyB2=0;
4040
}
4141
if (energyB2 > energy){
4242
energyB2 -= energy;
4343
energy = 0;
4444
}
45-
if (energyB3 - energy < 0){
45+
if (energyB3 - energy <= 0){
4646
energy -= energyB3;
4747
energyB3=0;
4848
}

0 commit comments

Comments
 (0)