Jump to content

isFull3D() doesn't work in custom items


SteveKunG

Recommended Posts

I using Forge build 1336.

 

Here my some example code for isFull3D().

 

 

package stevekung.mods.moreplanets.planets.diona.items;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

import stevekung.mods.moreplanets.common.items.ItemMorePlanets;

import stevekung.mods.moreplanets.planets.diona.entities.projectiles.EntityLaserMP;

import stevekung.mods.moreplanets.planets.diona.entities.projectiles.EntityLaserMP.LaserType;

 

public class ItemLaserGun extends ItemMorePlanets

{

public ItemLaserGun(String name)

{

super();

this.setMaxStackSize(1);

this.setMaxDamage(860);

this.setUnlocalizedName(name);

}

 

@Override

@SideOnly(Side.CLIENT)

public boolean isFull3D()

{

return true;

}

 

@Override

public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)

{

boolean flag = player.capabilities.isCreativeMode;

 

if (flag || player.inventory.hasItem(DionaItems.laser_ammo))

{

EntityLaserMP laser = new EntityLaserMP(world, player, 1.0F);

 

itemStack.damageItem(1, player);

world.playSoundAtEntity(player, "moreplanets:player.laser", 1.0F, 2.0F / (1.0F * 0.4F + 1.2F) + 1.0F * 0.5F);

 

int slot = -1;

if (player.inventory.hasItemStack(new ItemStack(DionaItems.laser_ammo, 1, 1)))

{

laser.setLaserType(LaserType.HYPER);

 

for (int k = 0; k < player.inventory.mainInventory.length; ++k)

{

if (player.inventory.mainInventory[k] != null && player.inventory.mainInventory[k].getItem() == DionaItems.laser_ammo && player.inventory.mainInventory[k].getItemDamage() == 1)

{

slot = k;

break;

}

}

}

else if (player.inventory.hasItemStack(new ItemStack(DionaItems.laser_ammo, 1, 0)))

{

laser.setLaserType(LaserType.NORMAL);

 

for (int k = 0; k < player.inventory.mainInventory.length; ++k)

{

if (player.inventory.mainInventory[k] != null && player.inventory.mainInventory[k].getItem() == DionaItems.laser_ammo && player.inventory.mainInventory[k].getItemDamage() == 0)

{

slot = k;

break;

}

}

}

else if (player.inventory.hasItemStack(new ItemStack(DionaItems.laser_ammo, 1, 2)))

{

laser.setLaserType(LaserType.EMP);

 

for (int k = 0; k < player.inventory.mainInventory.length; ++k)

{

if (player.inventory.mainInventory[k] != null && player.inventory.mainInventory[k].getItem() == DionaItems.laser_ammo && player.inventory.mainInventory[k].getItemDamage() == 2)

{

slot = k;

break;

}

}

}

if (!world.isRemote)

{

world.spawnEntityInWorld(laser);

}

if (!flag && slot >= 0)

{

player.inventory.decrStackSize(slot, 1);

}

}

return itemStack;

}

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.