mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Kicking now costs a proportionate amount of energy to the food 'coaxed' from the tree
This commit is contained in:
parent
5f94aa6d5b
commit
5d6588c9e8
1 changed files with 21 additions and 9 deletions
|
@ -25,6 +25,7 @@ import com.minelittlepony.util.vector.VecHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLeaves;
|
import net.minecraft.block.BlockLeaves;
|
||||||
import net.minecraft.block.BlockLog;
|
import net.minecraft.block.BlockLog;
|
||||||
|
import net.minecraft.block.BlockPlanks;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
@ -169,18 +170,28 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
||||||
IPower.takeFromPlayer(player, rad);
|
IPower.takeFromPlayer(player, rad);
|
||||||
} else if (data.hitType == 1) {
|
} else if (data.hitType == 1) {
|
||||||
|
|
||||||
if (player.world.rand.nextInt(5) == 0) {
|
boolean harmed = player.getHealth() < player.getMaxHealth();
|
||||||
int cost = dropApples(player.world, data.pos());
|
|
||||||
|
|
||||||
if (cost > 0) {
|
if (harmed && player.world.rand.nextInt(30) == 0) {
|
||||||
IPower.takeFromPlayer(player, cost / 3);
|
IPower.takeFromPlayer(player, 3);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
if (harmed || player.world.rand.nextInt(5) == 0) {
|
||||||
|
|
||||||
|
if (!harmed || player.world.rand.nextInt(30) == 0) {
|
||||||
UWorld.enqueueTask(() -> {
|
UWorld.enqueueTask(() -> {
|
||||||
removeTree(player.world, data.pos());
|
removeTree(player.world, data.pos());
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
IPower.takeFromPlayer(player, 3);
|
IPower.takeFromPlayer(player, 3);
|
||||||
|
} else {
|
||||||
|
int cost = dropApples(player.world, data.pos());
|
||||||
|
|
||||||
|
if (cost > 0) {
|
||||||
|
IPower.takeFromPlayer(player, cost * 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,6 +277,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
||||||
if (variantAndBlockEquals(w.getBlockState(pos.south()), log)) {
|
if (variantAndBlockEquals(w.getBlockState(pos.south()), log)) {
|
||||||
result = ascendTrunk(done, w, pos.south(), log, level + 1);
|
result = ascendTrunk(done, w, pos.south(), log, level + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return pos;
|
return pos;
|
||||||
|
@ -344,7 +356,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
||||||
WorldEvent.DESTROY_BLOCK.play(w, pos, state);
|
WorldEvent.DESTROY_BLOCK.play(w, pos, state);
|
||||||
|
|
||||||
EntityItem item = new EntityItem(w);
|
EntityItem item = new EntityItem(w);
|
||||||
item.setPosition(pos.getX() + 0.5, pos.getY() - 0.5, pos.getZ() + 0.5);
|
item.setPosition(pos.getX() + w.rand.nextFloat(), pos.getY() - 0.5, pos.getZ() + w.rand.nextFloat());
|
||||||
item.setItem(getApple(w, log));
|
item.setItem(getApple(w, log));
|
||||||
|
|
||||||
drops.add(item);
|
drops.add(item);
|
||||||
|
|
Loading…
Reference in a new issue