Search in sources :

Example 81 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class ItemLostJournal method getSubItems.

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
    super.getSubItems(item, par2CreativeTabs, par3List);
    int sCount = 0;
    for (Story s : StoryManager.INSTANCE.allStories()) {
        int meta = sCount << 16;
        for (short i = 0; i < s.getNumParts(); ++i) {
            meta = sCount + i;
            ItemStack stack = new ItemStack(item, 1, meta);
            stack.stackTagCompound = new NBTTagCompound();
            s.WritePartToNBT(stack.stackTagCompound, i);
            stack.stackTagCompound.setString("title", s.getTitle());
            par3List.add(stack);
        }
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) Story(am2.lore.Story) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 82 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class CompendiumEntryRitual method getCompendiumGui.

@Override
@SideOnly(Side.CLIENT)
protected GuiArcaneCompendium getCompendiumGui(String searchID, int meta) {
    if (this.ritualShape != null) {
        try {
            Field f = RitualShapeHelper.class.getField(ritualShape);
            MultiblockStructureDefinition def = (MultiblockStructureDefinition) f.get(RitualShapeHelper.instance);
            ISkillTreeEntry entry = SkillManager.instance.getSkill(ritualController);
            if (entry instanceof IRitualInteraction) {
                IRitualInteraction controller = (IRitualInteraction) entry;
                return new GuiArcaneCompendium(searchID, def, controller);
            }
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return new GuiArcaneCompendium(searchID);
}
Also used : Field(java.lang.reflect.Field) GuiArcaneCompendium(am2.guis.GuiArcaneCompendium) ISkillTreeEntry(am2.api.spell.component.interfaces.ISkillTreeEntry) IRitualInteraction(am2.api.spell.component.interfaces.IRitualInteraction) MultiblockStructureDefinition(am2.api.blocks.MultiblockStructureDefinition) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 83 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class AMClientEventHandler method onPlayerRender.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerRender(RenderPlayerEvent.Pre event) {
    ItemStack chestPlate = event.entityPlayer.inventory.armorInventory[2];
    ModelBiped mainModel = ReflectionHelper.getPrivateValue(RenderPlayer.class, event.renderer, "field_77109_a", "modelBipedMain");
    boolean holdingItem = false;
    if (event.entityPlayer.getCurrentEquippedItem() != null)
        holdingItem = true;
    if (!AMCore.proxy.playerTracker.hasCLS(event.entityPlayer.getUniqueID().toString())) {
        if (chestPlate != null && chestPlate.getItem() == ItemsCommonProxy.earthGuardianArmor) {
            if (mainModel != null) {
                mainModel.bipedLeftArm.isHidden = true;
                mainModel.bipedRightArm.isHidden = !holdingItem;
            }
        } else {
            if (mainModel != null) {
                mainModel.bipedLeftArm.isHidden = false;
                mainModel.bipedRightArm.isHidden = false;
            }
        }
    }
    double dX = AMCore.proxy.getLocalPlayer().posX - event.entityPlayer.posX;
    double dY = AMCore.proxy.getLocalPlayer().posY - event.entityPlayer.posY;
    double dZ = AMCore.proxy.getLocalPlayer().posZ - event.entityPlayer.posZ;
    double dpX = AMCore.proxy.getLocalPlayer().prevPosX - event.entityPlayer.prevPosX;
    double dpY = AMCore.proxy.getLocalPlayer().prevPosY - event.entityPlayer.prevPosY;
    double dpZ = AMCore.proxy.getLocalPlayer().prevPosZ - event.entityPlayer.prevPosZ;
    double transX = dpX + (dX - dpX) * event.partialRenderTick;
    double transY = dpY + (dY - dpY) * event.partialRenderTick;
    double transZ = dpZ + (dZ - dpZ) * event.partialRenderTick;
    if (ExtendedProperties.For(event.entityPlayer).getFlipRotation() > 0) {
        GL11.glPushMatrix();
        GL11.glTranslated(-transX, -transY, -transZ);
        GL11.glRotatef(ExtendedProperties.For(event.entityPlayer).getFlipRotation(), 0, 0, 1.0f);
        GL11.glTranslated(transX, transY, transZ);
        float offset = event.entityPlayer.height * (ExtendedProperties.For(event.entityPlayer).getFlipRotation() / 180.0f);
        GL11.glTranslatef(0, -offset, 0);
    }
    float shrink = ExtendedProperties.For(event.entityPlayer).getShrinkPct();
    if (shrink > 0) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0, 0 - 0.5f * shrink, 0);
        GL11.glScalef(1 - 0.5f * shrink, 1 - 0.5f * shrink, 1 - 0.5f * shrink);
    }
}
Also used : ModelBiped(net.minecraft.client.model.ModelBiped) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 84 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class AMClientEventHandler method onPlayerRender.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPlayerRender(RenderPlayerEvent.Post event) {
    ModelBiped mainModel = ReflectionHelper.getPrivateValue(RenderPlayer.class, event.renderer, "field_77109_a", "modelBipedMain");
    if (mainModel != null) {
        mainModel.bipedLeftArm.isHidden = false;
        mainModel.bipedRightArm.isHidden = false;
    }
    if (ExtendedProperties.For(event.entityPlayer).getFlipRotation() > 0) {
        GL11.glPopMatrix();
    }
    if (ExtendedProperties.For(event.entityPlayer).getShrinkPct() > 0) {
        GL11.glPopMatrix();
    }
    CloakUtils.renderCloakModel(event.entityPlayer, mainModel, event.partialRenderTick);
    if (event.entityPlayer == AMCore.proxy.getLocalPlayer()) {
        if (AMCore.proxy.getLocalPlayer().isPotionActive(BuffList.trueSight.id)) {
            if (AMGuiHelper.instance.playerRunesAlpha < 1)
                AMGuiHelper.instance.playerRunesAlpha += 0.01f;
        } else {
            if (AMGuiHelper.instance.playerRunesAlpha > 0)
                AMGuiHelper.instance.playerRunesAlpha -= 0.01f;
        }
        if (AMGuiHelper.instance.playerRunesAlpha > 0) {
            int runeCombo = EntityUtilities.getRuneCombo(event.entityPlayer);
            int numRunes = 0;
            for (int i = 0; i <= 16; ++i) {
                int bit = 1 << i;
                if ((runeCombo & bit) == bit) {
                    numRunes++;
                }
            }
            double step = 0.25f;
            double xOffset = -(numRunes / 2.0f) * step + ((numRunes % 2 == 0) ? step / 2f : 0);
            for (int i = 0; i <= 16; ++i) {
                int bit = 1 << i;
                if ((runeCombo & bit) == bit) {
                    RenderUtilities.DrawIconInWorldAtOffset(ItemsCommonProxy.rune.getIconFromDamage(i), xOffset, 0.5f, 0, 0.25f, 0.25f);
                    xOffset += step;
                }
            }
        }
    }
}
Also used : ModelBiped(net.minecraft.client.model.ModelBiped) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 85 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project ArsMagica2 by Mithion.

the class AMNetHandler method requestAuras.

@SideOnly(Side.CLIENT)
public void requestAuras(EntityPlayer player) {
    AMDataWriter writer = new AMDataWriter();
    EntityPlayer localPlayer = Minecraft.getMinecraft().thePlayer;
    if (localPlayer == null)
        return;
    writer.add(localPlayer.getEntityId());
    writer.add(player.getEntityId());
    sendPacketToServer(AMPacketIDs.REQUEST_BETA_PARTICLES, writer.generate());
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) 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