123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package me.km.effects.active;
- import me.km.KajetansMod;
- import me.km.api.Location;
- import me.km.api.Module;
- import me.km.effects.ActiveEffectBase;
- import net.minecraft.block.BlockCrops;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.entity.player.EntityPlayerMP;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- public class Harvest extends ActiveEffectBase
- {
- @Override
- protected boolean executeEffect(EntityPlayerMP p, int power)
- {
- int radius = 1 + 2 * power;
- World w = p.world;
- BlockPos pos = p.getPosition();
- BlockPos pos2;
- IBlockState b;
- for(int x = -radius; x <= radius; x++)
- {
- for(int y = -radius; y <= radius; y++)
- {
- for(int z = -radius; z <= radius; z++)
- {
- pos2 = pos.add(x, y, z);
- b = w.getBlockState(pos2);
- if(b.getBlock() instanceof BlockCrops && b.getValue(BlockCrops.AGE) == 7)
- {
- b.getBlock().dropBlockAsItem(w, pos2, b, 0);
- w.setBlockState(pos2, b.withProperty(BlockCrops.AGE, 0));
- }
- }
- }
- }
- KajetansMod.effects.send(p, "Die Pflanzen in deiner Umgebung wurden geerntet!");
- return true;
- }
-
- @Override
- protected int getManaCost(int manaFactor)
- {
- return 5 * manaFactor;
- }
- }
|