mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-28 23:59:25 +00:00
Rod of the Shifting Crust and a bunch of other tweaks to go along with it.
This commit is contained in:
1 parent
8989a12835
commit
4eeec9bd49
16 files changed
+693
-12
No files matched your search
@@ -10,22 +10,26 @@
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.item.IBlockProvider;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.rod.ItemExchangeRod;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemEnderHand extends ItemMod implements IManaUsingItem {
|
||||
public class ItemEnderHand extends ItemMod implements IManaUsingItem, IBlockProvider {
|
||||
|
||||
private static final int COST_PROVIDE = 5;
|
||||
private static final int COST_SELF = 250;
|
||||
private static final int COST_OTHER = 5000;
|
||||
|
||||
public ItemEnderHand() {
|
||||
setMaxDamage(1);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(LibItemNames.ENDER_HAND);
|
||||
}
|
||||
|
||||
@@ -56,4 +60,33 @@ public class ItemEnderHand extends ItemMod implements IManaUsingItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean provideBlock(EntityPlayer player, ItemStack requestor, ItemStack stack, Block block, int meta, boolean doit) {
|
||||
if(requestor != null && requestor.getItem() == this)
|
||||
return false;
|
||||
|
||||
ItemStack istack = ItemExchangeRod.removeFromInventory(player, player.getInventoryEnderChest(), stack, block, meta, false);
|
||||
if(istack != null) {
|
||||
boolean mana = ManaItemHandler.requestManaExact(stack, player, COST_PROVIDE, false);
|
||||
if(mana) {
|
||||
if(doit) {
|
||||
ManaItemHandler.requestManaExact(stack, player, COST_PROVIDE, true);
|
||||
ItemExchangeRod.removeFromInventory(player, player.getInventoryEnderChest(), stack, block, meta, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockCount(EntityPlayer player, ItemStack requestor, ItemStack stack, Block block, int meta) {
|
||||
if(requestor != null && requestor.getItem() == this)
|
||||
return 0;
|
||||
|
||||
return ItemExchangeRod.getInventoryItemCount(player, player.getInventoryEnderChest(), stack, block, meta);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user