Search in sources :

Example 6 with IMiscCapability

use of com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability in project Wizardry by TeamWizardry.

the class ModCapabilities method onRespawn.

@SubscribeEvent
public static void onRespawn(PlayerEvent.PlayerRespawnEvent event) {
    if (event.player.world.isRemote)
        return;
    IManaCapability manaCap = ManaCapabilityProvider.getCap(event.player);
    if (manaCap != null)
        manaCap.dataChanged(event.player);
    IMiscCapability miscCap = MiscCapabilityProvider.getCap(event.player);
    if (miscCap != null)
        miscCap.dataChanged(event.player);
}
Also used : IMiscCapability(com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability) IManaCapability(com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 7 with IMiscCapability

use of com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability in project Wizardry by TeamWizardry.

the class ModCapabilities method onDimChange.

@SubscribeEvent
public static void onDimChange(PlayerEvent.PlayerChangedDimensionEvent event) {
    if (event.player.world.isRemote)
        return;
    IManaCapability manaCap = ManaCapabilityProvider.getCap(event.player);
    if (manaCap != null)
        manaCap.dataChanged(event.player);
    IMiscCapability miscCap = MiscCapabilityProvider.getCap(event.player);
    if (miscCap != null)
        miscCap.dataChanged(event.player);
}
Also used : IMiscCapability(com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability) IManaCapability(com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 8 with IMiscCapability

use of com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability in project Wizardry by TeamWizardry.

the class ItemFairyBell method onScroll.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onScroll(MouseEvent event) {
    EntityPlayer player = Minecraft.getMinecraft().player;
    if (player == null)
        return;
    if (Keyboard.isCreated() && event.getDwheel() != 0) {
        for (EnumHand hand : EnumHand.values()) {
            ItemStack stack = player.getHeldItem(hand);
            if (stack.getItem() != ModItems.FAIRY_BELL)
                continue;
            IMiscCapability cap = MiscCapabilityProvider.getCap(Minecraft.getMinecraft().player);
            if (cap == null)
                continue;
            cap.setSelectedFairy(null);
            PacketHandler.NETWORK.sendToServer(new PacketUpdateMiscCapToServer(cap.serializeNBT()));
        }
    }
}
Also used : IMiscCapability(com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) PacketUpdateMiscCapToServer(com.teamwizardry.wizardry.common.network.capability.PacketUpdateMiscCapToServer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 9 with IMiscCapability

use of com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability in project Wizardry by TeamWizardry.

the class PacketUpdateMiscCapToClient method handle.

@Override
public void handle(@Nonnull MessageContext ctx) {
    if (ctx.side.isServer())
        return;
    EntityPlayer player = LibrarianLib.PROXY.getClientPlayer();
    IMiscCapability cap = MiscCapabilityProvider.getCap(player);
    if (cap != null) {
        cap.deserializeNBT(tags);
    }
}
Also used : IMiscCapability(com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 10 with IMiscCapability

use of com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability in project Wizardry by TeamWizardry.

the class PacketUpdateMiscCapToServer method reply.

@Nullable
@Override
public PacketBase reply(@NotNull MessageContext ctx) {
    EntityPlayer player = ctx.getServerHandler().player;
    IMiscCapability cap = MiscCapabilityProvider.getCap(player);
    if (cap != null) {
        cap.deserializeNBT(tags);
    }
    return new PacketUpdateMiscCapToClient(tags);
}
Also used : IMiscCapability(com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

IMiscCapability (com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability)10 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)5 EntityFairy (com.teamwizardry.wizardry.common.entity.EntityFairy)4 ItemStack (net.minecraft.item.ItemStack)4 IManaCapability (com.teamwizardry.wizardry.api.capability.player.mana.IManaCapability)3 FairyData (com.teamwizardry.wizardry.api.entity.fairy.FairyData)3 UUID (java.util.UUID)3 Entity (net.minecraft.entity.Entity)3 Vec3d (net.minecraft.util.math.Vec3d)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 PacketUpdateMiscCapToServer (com.teamwizardry.wizardry.common.network.capability.PacketUpdateMiscCapToServer)2 List (java.util.List)2 IBlockState (net.minecraft.block.state.IBlockState)2 BlockPos (net.minecraft.util.math.BlockPos)2 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)2 World (net.minecraft.world.World)2 NotNull (org.jetbrains.annotations.NotNull)2 LibrarianLib (com.teamwizardry.librarianlib.core.LibrarianLib)1 ItemMod (com.teamwizardry.librarianlib.features.base.item.ItemMod)1