Search in sources :

Example 51 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class SimpleSidedRenderer method registerSprites.

@SideOnly(Side.CLIENT)
public void registerSprites(TextureMap textureMap) {
    this.sprites = new HashMap<>();
    for (RenderSide overlayFace : RenderSide.values()) {
        String faceName = overlayFace.name().toLowerCase();
        ResourceLocation resourceLocation = new ResourceLocation(GTValues.MODID, String.format("blocks/%s/%s", basePath, faceName));
        sprites.put(overlayFace, textureMap.registerSprite(resourceLocation));
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 52 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class GTUtility method addPotionTooltip.

/**
 * Adds potion tooltip into given lines list
 *
 * @param potions potion effects to add to tooltip
 * @param lines   description lines
 */
@SideOnly(Side.CLIENT)
public static void addPotionTooltip(Iterable<PotionEffect> potions, List<String> lines) {
    ArrayList<Tuple<String, AttributeModifier>> attributeLines = new ArrayList<>();
    for (PotionEffect potionEffect : potions) {
        String line = I18n.format(potionEffect.getEffectName());
        Potion potion = potionEffect.getPotion();
        Map<IAttribute, AttributeModifier> attributes = potionEffect.getPotion().getAttributeModifierMap();
        if (!attributes.isEmpty()) {
            for (Map.Entry<IAttribute, AttributeModifier> entry : attributes.entrySet()) {
                AttributeModifier modifier = entry.getValue();
                attributeLines.add(new Tuple<>(entry.getKey().getName(), new AttributeModifier(modifier.getName(), potion.getAttributeModifierAmount(potionEffect.getAmplifier(), modifier), modifier.getOperation())));
            }
        }
        if (potionEffect.getAmplifier() > 0) {
            line = line + " " + I18n.format("potion.potency." + potionEffect.getAmplifier());
        }
        if (potionEffect.getDuration() > 20) {
            line = line + " (" + Potion.getPotionDurationString(potionEffect, 1.0f) + ")";
        }
        if (potion.isBadEffect()) {
            lines.add(TextFormatting.RED + line);
        } else {
            lines.add(TextFormatting.BLUE + line);
        }
    }
    if (!attributeLines.isEmpty()) {
        lines.add("");
        lines.add(TextFormatting.DARK_PURPLE + I18n.format("potion.whenDrank"));
        for (Tuple<String, AttributeModifier> tuple : attributeLines) {
            AttributeModifier modifier = tuple.getSecond();
            double d0 = modifier.getAmount();
            double d1;
            if (modifier.getOperation() != 1 && modifier.getOperation() != 2) {
                d1 = modifier.getAmount();
            } else {
                d1 = modifier.getAmount() * 100.0D;
            }
            if (d0 > 0.0D) {
                lines.add(TextFormatting.BLUE + I18n.format("attribute.modifier.plus." + modifier.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.format("attribute.name." + tuple.getFirst())));
            } else if (d0 < 0.0D) {
                d1 = d1 * -1.0D;
                lines.add(TextFormatting.RED + I18n.format("attribute.modifier.take." + modifier.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.format("attribute.name." + tuple.getFirst())));
            }
        }
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) Potion(net.minecraft.potion.Potion) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier) IAttribute(net.minecraft.entity.ai.attributes.IAttribute) Tuple(net.minecraft.util.Tuple) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 53 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project GregTech by GregTechCE.

the class OreItemBlock method getItemStackDisplayName.

@Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack stack) {
    IBlockState blockState = getBlockState(stack);
    boolean small = blockState.getValue(BlockOre.SMALL);
    if (small) {
        return OrePrefix.oreSmall.getLocalNameForItem(block.material);
    } else {
        StoneType stoneType = blockState.getValue(block.STONE_TYPE);
        return stoneType.processingPrefix.getLocalNameForItem(block.material);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) StoneType(gregtech.api.unification.ore.StoneType) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 54 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project Gaia-Dimension by Andromander.

the class GDCrystalGrowth method registerModel.

@SideOnly(Side.CLIENT)
@Override
public void registerModel() {
    for (int i = 0; i < CrystalGrowthVariant.values().length; i++) {
        String variant = "inventory_" + CrystalGrowthVariant.values()[i].getName();
        ModelResourceLocation mrl = new ModelResourceLocation(getRegistryName(), variant);
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), i, mrl);
    }
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 55 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project SecurityCraft by Geforce132.

the class BlockReinforcedNewLog method getSubBlocks.

/**
 * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
 */
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
    list.add(new ItemStack(this, 1, BlockPlanks.EnumType.ACACIA.getMetadata() - 4));
    list.add(new ItemStack(this, 1, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4));
}
Also used : ItemStack(net.minecraft.item.ItemStack) 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