use of icbm.classic.content.entity.EntityGrenade in project ICBM-Classic by BuiltBrokenModding.
the class RenderGrenade method doRender.
@Override
public void doRender(Entity entity, double x, double y, double z, float par8, float par9) {
/** Renders the grenade based on the explosive ID. */
IIcon icon = ICBMClassic.itemGrenade.getIconFromDamage(((EntityGrenade) entity).haoMa.ordinal());
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + 0.4f, (float) z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.6F, 0.6F, 0.6F);
RenderUtility.setSpriteTexture(new ItemStack(ICBMClassic.itemGrenade));
Tessellator tessellator = Tessellator.instance;
this.renderIcon(tessellator, icon);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
use of icbm.classic.content.entity.EntityGrenade in project ICBM-Classic by BuiltBrokenModding.
the class ItemGrenade method onPlayerStoppedUsing.
@Override
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer entityPlayer, int nengLiang) {
if (!world.isRemote) {
Explosives zhaPin = Explosives.get(itemStack.getItemDamage());
ExplosivePreDetonationEvent evt = new ExplosivePreDetonationEvent(world, entityPlayer, ExplosiveType.ITEM, zhaPin.handler);
MinecraftForge.EVENT_BUS.post(evt);
if (!evt.isCanceled()) {
if (!entityPlayer.capabilities.isCreativeMode) {
itemStack.stackSize--;
if (itemStack.stackSize <= 0) {
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}
}
world.playSoundAtEntity(entityPlayer, "random.fuse", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
world.spawnEntityInWorld(new EntityGrenade(world, entityPlayer, zhaPin, (float) (this.getMaxItemUseDuration(itemStack) - nengLiang) / (float) this.getMaxItemUseDuration(itemStack)));
} else {
entityPlayer.addChatMessage(new ChatComponentText("Grenades are banned in this region."));
}
}
}
Aggregations