Search in sources :

Example 71 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project AgriCraft by AgriCraft.

the class ItemBlockCustomWood method addInformation.

/**
 * Retrieves the block's displayable information. This method does not need to be overridden by
 * most CustomWood blocks.
 * <p>
 * If the block name is not displaying correctly, check the language files and
 * Names.Objects.[blockname]. If that does not correct the issue, ensure that the block
 * overrides both getInternalName() and getTileEntityName() and returns
 * Names.Objects.[blockname].
 * </p>
 * <p>
 * All custom WOOD blocks have a MATERIAL that we want shown, so we make this method final. Some
 * however, has more information they want to add, so we add a addMore() method to OVERRIDE in
 * that event.
 * </p>
 *
 * @param stack
 * @param world
 * @param tooltip
 * @param flag
 */
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
    ItemStack material;
    if (stack.getItemDamage() == 0 && stack.hasTagCompound() && stack.getTagCompound().hasKey(AgriNBT.MATERIAL) && stack.getTagCompound().hasKey(AgriNBT.MATERIAL_META)) {
        NBTTagCompound tag = stack.getTagCompound();
        String name = tag.getString(AgriNBT.MATERIAL);
        int meta = tag.getInteger(AgriNBT.MATERIAL_META);
        material = new ItemStack(Block.getBlockFromName(name), 1, meta);
    } else {
        material = new ItemStack(Blocks.PLANKS);
    }
    tooltip.add(AgriCore.getTranslator().translate("agricraft_tooltip.material") + ": " + material.getItem().getItemStackDisplayName(material));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 72 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project AgriCraft by AgriCraft.

the class TileEntitySprinkler method spawnLiquidSpray.

@SideOnly(Side.CLIENT)
private void spawnLiquidSpray(double xOffset, double zOffset, Vec3d vector) {
    LiquidSprayFX liquidSpray = new LiquidSprayFX(this.getWorld(), this.xCoord() + 0.5F + xOffset, this.yCoord() + 8 * Constants.UNIT, this.zCoord() + 0.5F + zOffset, 0.3F, 0.7F, vector);
    Minecraft.getMinecraft().effectRenderer.addEffect(liquidSpray);
}
Also used : LiquidSprayFX(com.infinityraider.agricraft.renderers.particles.LiquidSprayFX) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 73 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project AgriCraft by AgriCraft.

the class TileEntitySprinkler method renderLiquidSpray.

@SideOnly(Side.CLIENT)
private void renderLiquidSpray() {
    if (AgriCraftConfig.disableParticles) {
        return;
    }
    this.angle = (this.angle + 5F) % 360;
    // 0 = all, 1 = decreased; 2 = minimal;
    int particleSetting = Minecraft.getMinecraft().gameSettings.particleSetting;
    counter = (counter + 1) % (particleSetting + 1);
    if (counter == 0) {
        for (int i = 0; i < 4; i++) {
            float alpha = -(this.angle + 90 * i) * ((float) Math.PI) / 180;
            double xOffset = (4 * Constants.UNIT) * Math.cos(alpha);
            double zOffset = (4 * Constants.UNIT) * Math.sin(alpha);
            float radius = 0.3F;
            for (int j = 0; j <= 4; j++) {
                float beta = -j * ((float) Math.PI) / (8.0F);
                Vec3d vector = new Vec3d(radius * Math.cos(alpha), radius * Math.sin(beta), radius * Math.sin(alpha));
                this.spawnLiquidSpray(xOffset * (4 - j) / 4, zOffset * (4 - j) / 4, vector);
            }
        }
    }
}
Also used : Vec3d(net.minecraft.util.math.Vec3d) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 74 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project BetterWithAddons by DaedalusGame.

the class AssortedHandler method onToolTip.

@SubscribeEvent(priority = EventPriority.HIGHEST)
@SideOnly(Side.CLIENT)
public void onToolTip(ItemTooltipEvent event) {
    ItemStack stack = event.getItemStack();
    if (stack.getItem() == Items.ENCHANTED_BOOK && InteractionBWM.HIDDEN_ENCHANTS) {
        event.getToolTip().clear();
        event.getToolTip().add(TextFormatting.WHITE + I18n.format("item.ancient_manuscript.name"));
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 75 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project BetterWithAddons by DaedalusGame.

the class RenewablesHandler method renderQuartzTooltip.

@SubscribeEvent(priority = EventPriority.HIGH)
@SideOnly(Side.CLIENT)
public void renderQuartzTooltip(ItemTooltipEvent event) {
    ItemStack stack = event.getItemStack();
    if (stack == null)
        return;
    NBTTagCompound compound = stack.getTagCompound();
    if (!stack.isEmpty() && compound != null && compound.hasKey("QuartzCrystal")) {
        int growth = compound.getInteger("QuartzCrystalGrowth");
        int souls = compound.getInteger("QuartzSouls");
        event.getToolTip().add(TextFormatting.LIGHT_PURPLE + getSaturationString(growth, false));
        if (souls > 0)
            event.getToolTip().add(TextFormatting.DARK_RED + getSoulString(souls, 27, false));
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1328 ItemStack (net.minecraft.item.ItemStack)238 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)149 IBlockState (net.minecraft.block.state.IBlockState)140 ResourceLocation (net.minecraft.util.ResourceLocation)139 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)127 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)126 BlockPos (net.minecraft.util.math.BlockPos)85 Block (net.minecraft.block.Block)82 TileEntity (net.minecraft.tileentity.TileEntity)80 EntityPlayer (net.minecraft.entity.player.EntityPlayer)72 Vec3d (net.minecraft.util.math.Vec3d)71 World (net.minecraft.world.World)69 EnumFacing (net.minecraft.util.EnumFacing)64 Minecraft (net.minecraft.client.Minecraft)62 ArrayList (java.util.ArrayList)50 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)42 Nonnull (javax.annotation.Nonnull)41 Entity (net.minecraft.entity.Entity)39 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)39