mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +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.BlockLeaves;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -169,18 +170,28 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
|||
IPower.takeFromPlayer(player, rad);
|
||||
} else if (data.hitType == 1) {
|
||||
|
||||
if (player.world.rand.nextInt(5) == 0) {
|
||||
int cost = dropApples(player.world, data.pos());
|
||||
boolean harmed = player.getHealth() < player.getMaxHealth();
|
||||
|
||||
if (cost > 0) {
|
||||
IPower.takeFromPlayer(player, cost / 3);
|
||||
if (harmed && player.world.rand.nextInt(30) == 0) {
|
||||
IPower.takeFromPlayer(player, 3);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (harmed || player.world.rand.nextInt(5) == 0) {
|
||||
|
||||
if (!harmed || player.world.rand.nextInt(30) == 0) {
|
||||
UWorld.enqueueTask(() -> {
|
||||
removeTree(player.world, data.pos());
|
||||
});
|
||||
}
|
||||
|
||||
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)) {
|
||||
result = ascendTrunk(done, w, pos.south(), log, level + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return pos;
|
||||
|
@ -344,7 +356,7 @@ public class PowerStomp implements IPower<PowerStomp.Data> {
|
|||
WorldEvent.DESTROY_BLOCK.play(w, pos, state);
|
||||
|
||||
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));
|
||||
|
||||
drops.add(item);
|
||||
|
|
Loading…
Reference in a new issue