Basic sigils implementation
This commit is contained in:
parent
ae85224003
commit
5dff08380d
61 changed files with 1394 additions and 106 deletions
|
@ -0,0 +1,42 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
|
||||
import WayofTime.bloodmagic.item.ItemBindable;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
public class ItemSigilBloodLight extends ItemSigilBase {
|
||||
|
||||
public ItemSigilBloodLight() {
|
||||
super("bloodLight", 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getEnergyUsed() * 5) && !world.isRemote)
|
||||
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) return false;
|
||||
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getEnergyUsed())) {
|
||||
BlockPos newPos = blockPos.offset(side);
|
||||
|
||||
if (world.isAirBlock(newPos)) {
|
||||
world.setBlockState(newPos, ModBlocks.bloodLight.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue