Search in sources :

Example 86 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project Engine by VoltzEngine-Project.

the class BlockTile method getIcon.

@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess access, int x, int y, int z, int side) {
    Tile tile = inject(access, x, y, z);
    IIcon value = tile.getIcon(side, access.getBlockMetadata(x, y, z));
    eject();
    return value;
}
Also used : IIcon(net.minecraft.util.IIcon) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 87 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project Engine by VoltzEngine-Project.

the class PlayerKeyHandler method mouseHandler.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void mouseHandler(MouseEvent e) {
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    ItemStack stack = player.getCurrentEquippedItem();
    if (stack != null) {
        final Item item = stack.getItem();
        if (item instanceof IModeItem.IModeScrollItem) {
            if (player.isSneaking() && e.dwheel != 0) {
                int newMode = ((IModeItem.IModeScrollItem) stack.getItem()).cycleMode(stack, player, e.dwheel / 120);
                if (newMode != ((IModeItem.IModeScrollItem) stack.getItem()).getMode(stack)) {
                    Engine.instance.packetHandler.sendToServer(new PacketPlayerItemMode(player.inventory.currentItem, newMode));
                }
                e.setCanceled(true);
            }
        } else if (item instanceof IMouseButtonHandler && e.button != -1) {
            Engine.instance.packetHandler.sendToServer(new PacketMouseClick(player.inventory.currentItem, e.button, e.buttonstate));
            ((IMouseButtonHandler) item).mouseClick(stack, player, e.button, e.buttonstate);
            if (((IMouseButtonHandler) item).shouldCancelMouseEvent(stack, player, e.button, e.buttonstate)) {
                e.setCanceled(true);
            }
        }
    }
}
Also used : IModeItem(com.builtbroken.mc.api.items.tools.IModeItem) Item(net.minecraft.item.Item) PacketPlayerItemMode(com.builtbroken.mc.core.network.packet.user.PacketPlayerItemMode) PacketMouseClick(com.builtbroken.mc.core.network.packet.user.PacketMouseClick) IModeItem(com.builtbroken.mc.api.items.tools.IModeItem) IMouseButtonHandler(com.builtbroken.mc.api.items.IMouseButtonHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 88 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project Engine by VoltzEngine-Project.

the class PacketBlast method decodeInto.

@Override
@SideOnly(Side.CLIENT)
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
    type = BlastPacketType.values()[buffer.readInt()];
    x = buffer.readDouble();
    y = buffer.readDouble();
    z = buffer.readDouble();
    size = buffer.readDouble();
    String id = ByteBufUtils.readUTF8String(buffer);
    handler = ExplosiveRegistry.get(id);
    if (handler == null) {
        Engine.logger().error("Failed to load handler[" + id + "] from packet data");
    }
    NBTTagCompound save = ByteBufUtils.readTag(buffer);
    blast = (Blast) handler.createBlastForTrigger(Minecraft.getMinecraft().theWorld, x, y, z, TriggerCauseRegistry.rebuild(save.getCompoundTag("trigger"), Minecraft.getMinecraft().theWorld), size, save.getCompoundTag("explosiveData"));
    if (type == BlastPacketType.EDIT_DISPLAY) {
        edit = new BlockEdit(save.getCompoundTag("edit"));
    }
    blast.readBytes(buffer);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BlockEdit(com.builtbroken.mc.lib.world.edit.BlockEdit) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 89 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project Engine by VoltzEngine-Project.

the class ItemDevData method getSubItems.

@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
    list.add(new ItemStack(item, 1, 0));
    list.add(new ItemStack(item, 1, 1));
}
Also used : ItemStack(net.minecraft.item.ItemStack) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 90 with SideOnly

use of cpw.mods.fml.relauncher.SideOnly in project BetterStorage by copygirl.

the class ItemBucketSlime method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
    String id = getSlimeId(stack);
    Handler handler = getHandler(id);
    String name = StackUtils.get(stack, (String) null, "Slime", "name");
    if ((name != null) || advancedTooltips)
        list.add("Contains: " + ((name != null) ? ("\"" + name + "\"" + (advancedTooltips ? " (" + id + ")" : "")) : id));
    NBTTagList effectList = (NBTTagList) StackUtils.getTag(stack, "Effects");
    if ((effectList != null) && (handler != null)) {
        int max = ((advancedTooltips || GuiScreen.isShiftKeyDown()) ? 6 : 3);
        for (int i = 0; i < Math.min(effectList.tagCount(), max); i++) {
            PotionEffect effect = PotionEffect.readCustomPotionEffectFromNBT(effectList.getCompoundTagAt(i));
            Potion potion = Potion.potionTypes[effect.getPotionID()];
            int duration = (int) (effect.getDuration() * handler.durationMultiplier());
            StringBuilder str = new StringBuilder().append(potion.isBadEffect() ? EnumChatFormatting.RED : EnumChatFormatting.GRAY).append(StatCollector.translateToLocal(effect.getEffectName()));
            if (effect.getAmplifier() > 0)
                str.append(" ").append(StatCollector.translateToLocal("potion.potency." + effect.getAmplifier()));
            str.append(" (").append(StringUtils.ticksToElapsedTime(duration)).append(")");
            list.add(str.toString());
        }
        int more = (effectList.tagCount() - max);
        if (more > 0)
            list.add(EnumChatFormatting.DARK_GRAY.toString() + EnumChatFormatting.ITALIC + LanguageUtils.translateTooltip("bucketSlime.more." + ((more == 1) ? "1" : "x"), "%X%", Integer.toString(more)));
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) PotionEffect(net.minecraft.potion.PotionEffect) Potion(net.minecraft.potion.Potion) 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