Search in sources :

Example 1 with OnlyIn

use of net.minecraftforge.api.distmarker.OnlyIn in project Bookshelf by Darkhax-Minecraft.

the class PlayerUtils method getPlayerTexture.

/**
 * Gets a resource location that is bound to a player skin texture.
 *
 * @param profile The profile to lookup.
 * @return The texture to use for that profile.
 */
@OnlyIn(Dist.CLIENT)
public static ResourceLocation getPlayerTexture(GameProfile profile) {
    // Validate the profile first.
    if (profile != null) {
        final Minecraft minecraft = Minecraft.getInstance();
        // Load skin data about the profile.
        final Map<Type, MinecraftProfileTexture> map = minecraft.getSkinManager().getInsecureSkinInformation(profile);
        // If the loaded data has a skin, return that.
        if (map.containsKey(Type.SKIN)) {
            return minecraft.getSkinManager().registerTexture(map.get(Type.SKIN), Type.SKIN);
        } else {
            return DefaultPlayerSkin.getDefaultSkin(PlayerEntity.createPlayerUUID(profile));
        }
    }
    // Default to the legacy steve skin.
    return DefaultPlayerSkin.getDefaultSkin();
}
Also used : Type(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type) EquipmentSlotType(net.minecraft.inventory.EquipmentSlotType) MinecraftProfileTexture(com.mojang.authlib.minecraft.MinecraftProfileTexture) Minecraft(net.minecraft.client.Minecraft) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 2 with OnlyIn

use of net.minecraftforge.api.distmarker.OnlyIn in project NetherEx by LogicTechCorp.

the class NetherEx method onRegisterParticleFactory.

@OnlyIn(Dist.CLIENT)
private void onRegisterParticleFactory(ParticleFactoryRegisterEvent event) {
    ParticleManager particleManager = Minecraft.getInstance().particles;
    particleManager.registerFactory(NetherExParticles.SPORE_CREEPER_EXPLOSION.get(), SporeCreeperExplosionParticle.Factory::new);
    particleManager.registerFactory(NetherExParticles.SPORE_CREEPER_EXPLOSION_EMITTER.get(), new SporeCreeperExplosionEmitterParticle.Factory());
}
Also used : SporeCreeperExplosionEmitterParticle(logictechcorp.netherex.client.particle.SporeCreeperExplosionEmitterParticle) ParticleManager(net.minecraft.client.particle.ParticleManager) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 3 with OnlyIn

use of net.minecraftforge.api.distmarker.OnlyIn in project NetherEx by LogicTechCorp.

the class DullMirrorItem method addInformation.

@Override
@OnlyIn(Dist.CLIENT)
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
    CompoundNBT compound = stack.getTag();
    if (compound != null) {
        if (compound.contains("SpawnDimension")) {
            DimensionType type = DimensionType.byName(new ResourceLocation(compound.getString("SpawnDimension")));
            tooltip.add(new TranslationTextComponent("tooltip.netherex.dull_mirror.spawn_dimension", StringUtils.capitalize(type.getRegistryName().getPath().replace("_", " "))));
        }
        if (compound.contains("SpawnPoint")) {
            BlockPos spawnPos = NBTUtil.readBlockPos(compound.getCompound("SpawnPoint"));
            tooltip.add(new TranslationTextComponent("tooltip.netherex.dull_mirror.spawn_point", spawnPos.getX() + " " + spawnPos.getY() + " " + spawnPos.getZ()));
        }
        if (compound.contains("DeathPoint")) {
            BlockPos deathPos = NBTUtil.readBlockPos(compound.getCompound("DeathPoint"));
            tooltip.add(new TranslationTextComponent("tooltip.netherex.dull_mirror.death_point", deathPos.getX() + " " + deathPos.getY() + " " + deathPos.getZ()));
        }
    }
}
Also used : DimensionType(net.minecraft.world.dimension.DimensionType) CompoundNBT(net.minecraft.nbt.CompoundNBT) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) BlockPos(net.minecraft.util.math.BlockPos) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 4 with OnlyIn

use of net.minecraftforge.api.distmarker.OnlyIn in project Overloaded by CJ-MC-Mods.

the class ItemFluidCore method registerModel.

@OnlyIn(Dist.CLIENT)
@Override
public void registerModel() {
    ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), null);
    // ModelLoader.setCustomModelResourceLocation(this, 0, location);
    ImageUtil.registerDynamicTexture(new ResourceLocation(MODID, "textures/item/fluid_core.png"), OverloadedConfig.INSTANCE.textureResolutions.itemResolution);
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.model.ModelResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.model.ModelResourceLocation) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 5 with OnlyIn

use of net.minecraftforge.api.distmarker.OnlyIn in project Overloaded by CJ-MC-Mods.

the class ItemLinkingCard method appendHoverText.

@OnlyIn(Dist.CLIENT)
@Override
public void appendHoverText(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
    CompoundNBT tag = stack.getTag();
    if (tag != null && tag.contains("TYPE")) {
        String type = tag.getString("TYPE");
        int x = tag.getInt("X");
        int y = tag.getInt("Y");
        int z = tag.getInt("Z");
        String worldID = tag.getString("WORLD");
        tooltip.add(new StringTextComponent(String.format("Bound to %s at %s: %d,%d,%d", type, worldID, x, y, z)));
    }
    super.appendHoverText(stack, worldIn, tooltip, flagIn);
}
Also used : CompoundNBT(net.minecraft.nbt.CompoundNBT) StringTextComponent(net.minecraft.util.text.StringTextComponent) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)45 ResourceLocation (net.minecraft.util.ResourceLocation)23 ModelResourceLocation (net.minecraft.client.renderer.model.ModelResourceLocation)17 Minecraft (net.minecraft.client.Minecraft)5 ResizeableTextureGenerator (com.cjm721.overloaded.client.render.dynamic.general.ResizeableTextureGenerator)3 StringTextComponent (net.minecraft.util.text.StringTextComponent)3 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)3 CompoundNBT (net.minecraft.nbt.CompoundNBT)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2 BlockPos (net.minecraft.util.math.BlockPos)2 Vector3d (net.minecraft.util.math.vector.Vector3d)2 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)2 BlockBPMultipart (com.bluepowermod.block.BlockBPMultipart)1 RailGunFireMessage (com.cjm721.overloaded.network.packets.RailGunFireMessage)1 Streams (com.google.common.collect.Streams)1 MinecraftProfileTexture (com.mojang.authlib.minecraft.MinecraftProfileTexture)1 Type (com.mojang.authlib.minecraft.MinecraftProfileTexture.Type)1 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)1 ILaunchPluginService (cpw.mods.modlauncher.serviceapi.ILaunchPluginService)1 ArrayList (java.util.ArrayList)1