Search in sources :

Example 51 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project Armourers-Workshop by RiskyKen.

the class ContainerArmourLibrary method updateSkinName.

@SideOnly(Side.CLIENT)
public void updateSkinName(int slotId) {
    Minecraft mc = Minecraft.getMinecraft();
    GuiScreen screen = mc.currentScreen;
    if (screen != null && screen instanceof GuiSkinLibrary) {
        GuiSkinLibrary libScreen = (GuiSkinLibrary) screen;
        ItemStack stack = getSlot(36).getStack();
        if (stack == null) {
            libScreen.setFileName("");
        } else {
            SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
            if (skinPointer != null) {
                if (ClientSkinCache.INSTANCE.isSkinInCache(skinPointer)) {
                    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
                    String skinName = skin.getCustomName();
                    if (!StringUtils.isNullOrEmpty(skinName)) {
                        libScreen.setFileName(skinName);
                    }
                }
            }
        }
    }
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) GuiScreen(net.minecraft.client.gui.GuiScreen) ItemSkin(riskyken.armourersWorkshop.common.items.ItemSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) GuiSkinLibrary(riskyken.armourersWorkshop.client.gui.skinlibrary.GuiSkinLibrary) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 52 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project Armourers-Workshop by RiskyKen.

the class AbstractModItemArmour method getArmorModel.

@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack stack, int armorSlot) {
    if (!SkinNBTHelper.stackHasSkinData(stack)) {
        return null;
    }
    SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(stack);
    AbstractModelSkin targetModel = null;
    SkinModelRenderer emr = SkinModelRenderer.INSTANCE;
    Skin data = emr.getCustomArmourItemData(skinData);
    if (data == null) {
        return null;
    }
    targetModel = emr.getModelForEquipmentType(data.getSkinType());
    if (targetModel == null) {
        return null;
    }
    targetModel.npcSkinData = data;
    targetModel.npcDyeData = skinData.getSkinDye();
    return targetModel;
}
Also used : SkinModelRenderer(riskyken.armourersWorkshop.client.render.SkinModelRenderer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 53 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project PneumaticCraft by MineMaarten.

the class SearchUpgradeHandler method render2D.

@Override
@SideOnly(Side.CLIENT)
public void render2D(float partialTicks, boolean helmetEnabled) {
    ItemStack searchStack = ItemPneumaticArmor.getSearchedStack(FMLClientHandler.instance().getClient().thePlayer.getCurrentArmor(3));
    List<String> textList = new ArrayList<String>();
    if (searchStack == null) {
        textList.add("press '" + Keyboard.getKeyName(KeyHandler.getInstance().keybindOpenOptions.getKeyCode()) + "' to configure");
    } else {
        textList.add(searchStack.getDisplayName() + " (" + totalSearchedItemCount + " found)");
    }
    searchInfo.setText(textList);
}
Also used : ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 54 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project PneumaticCraft by MineMaarten.

the class SearchUpgradeHandler method update.

@Override
@SideOnly(Side.CLIENT)
public void update(EntityPlayer player, int rangeUpgrades) {
    ticksExisted++;
    ItemStack searchStack = ItemPneumaticArmor.getSearchedStack(player.getCurrentArmor(3));
    if (ticksExisted % 20 == 0) {
        List<EntityItem> items = player.worldObj.getEntitiesWithinAABB(EntityItem.class, EntityTrackUpgradeHandler.getAABBFromRange(player, rangeUpgrades));
        searchedItems.clear();
        for (EntityItem item : items) {
            if (item.getEntityItem() != null && searchStack != null) {
                if (item.getEntityItem().isItemEqual(searchStack))
                    searchedItems.put(item, item.getEntityItem().stackSize);
                else {
                    List<ItemStack> inventoryItems = PneumaticCraftUtils.getStacksInItem(item.getEntityItem());
                    int itemCount = 0;
                    for (ItemStack inventoryItem : inventoryItems) {
                        if (inventoryItem.isItemEqual(searchStack)) {
                            itemCount += inventoryItem.stackSize;
                        }
                    }
                    if (itemCount > 0)
                        searchedItems.put(item, itemCount);
                }
            }
        }
        totalSearchedItemCount = searchedItemCounter;
        searchedItemCounter = 0;
        for (Integer itemCount : searchedItems.values()) {
            searchedItemCounter += itemCount;
        }
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 55 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project PneumaticCraft by MineMaarten.

the class CoordTrackUpgradeHandler method navigateToSurface.

@SideOnly(Side.CLIENT)
public EnumNavigationResult navigateToSurface(EntityPlayer player) {
    World worldObj = player.worldObj;
    int y = worldObj.getHeightValue((int) player.posX, (int) player.posZ);
    PathEntity path = worldObj.getEntityPathToXYZ(player, (int) player.posX, y, (int) player.posZ, SEARCH_RANGE, true, true, false, true);
    EnumNavigationResult result = path != null ? EnumNavigationResult.EASY_PATH : EnumNavigationResult.DRONE_PATH;
    if (path != null) {
        for (int i = 0; i < path.getCurrentPathLength(); i++) {
            PathPoint pathPoint = path.getPathPointFromIndex(i);
            if (worldObj.canBlockSeeTheSky(pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord)) {
                coordTracker = new RenderCoordWireframe(worldObj, pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord);
                navigator = new RenderNavigator(worldObj, pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord);
                return EnumNavigationResult.EASY_PATH;
            }
        }
    }
    path = getDronePath(player, (int) player.posX, y, (int) player.posZ);
    if (path != null) {
        for (int i = 0; i < path.getCurrentPathLength(); i++) {
            PathPoint pathPoint = path.getPathPointFromIndex(i);
            if (worldObj.canBlockSeeTheSky(pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord)) {
                coordTracker = new RenderCoordWireframe(worldObj, pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord);
                navigator = new RenderNavigator(worldObj, pathPoint.xCoord, pathPoint.yCoord, pathPoint.zCoord);
                return EnumNavigationResult.DRONE_PATH;
            }
        }
    }
    return EnumNavigationResult.NO_PATH;
}
Also used : PathPoint(net.minecraft.pathfinding.PathPoint) World(net.minecraft.world.World) PathEntity(net.minecraft.pathfinding.PathEntity) PathPoint(net.minecraft.pathfinding.PathPoint) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)204 ItemStack (net.minecraft.item.ItemStack)52 IIcon (net.minecraft.util.IIcon)17 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)17 Vec3dCube (uk.co.qmunity.lib.vec.Vec3dCube)13 Block (net.minecraft.block.Block)12 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 TileEntity (net.minecraft.tileentity.TileEntity)10 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)9 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)8 ArrayList (java.util.ArrayList)8 Rotation (uk.co.qmunity.lib.transform.Rotation)8 AMParticle (am2.particles.AMParticle)6 IconFlipped (net.minecraft.client.renderer.IconFlipped)6 ItemBlock (net.minecraft.item.ItemBlock)6 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 GuiScreen (net.minecraft.client.gui.GuiScreen)4 RenderHelper (uk.co.qmunity.lib.client.render.RenderHelper)4