• 0

    posted a message on MMORPG MOD - Tibia Minecraft MOD - Pre-Alpha! MC 1.10-1.8

    Yes i plan to!

    Posted in: WIP Mods
  • 0

    posted a message on Potion icons not rendering

    I try to make a potion effect but for some reason no potion effects appears in the inventory (no texture).


    Do somebody knows whats wrong i got no error logs.



    import javax.annotation.Nullable;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.texture.ITextureObject;
    import net.minecraft.potion.Potion;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    import com.Strychi.TibiaMCMOD.References.Reference;
    
    
    public class Potion_base extends Potion {
    
    	public static ResourceLocation ICON = new ResourceLocation(Reference.MOD_ID, "textures/gui/status/effects/status_effects.png".substring(1));
    	private boolean NEGATIVE;
    	
    	public Potion_base(boolean neg, int amp) {
    		super(neg, amp);
    		this.NEGATIVE = neg;
    	}
    	
    
    	public Potion setIconIndex(int x, int y) {
    	super.setIconIndex(x, y);
    	return (Potion) this;
    	
    	}
    		
    	
    	@Override
    	@SideOnly(Side.CLIENT)
    	public int getStatusIconIndex() {
    		ITextureObject texture = Minecraft.getMinecraft().renderEngine.getTexture(ICON);
    		Minecraft.getMinecraft().renderEngine.bindTexture(ICON);
    		
    		return super.getStatusIconIndex();
    	}
    	
    	public boolean isBadEffect() {
    		return this.NEGATIVE;
    	}
    	
    	
    }



     

    Posted in: Modification Development
  • 0

    posted a message on Help Creative Tabs - Loading in assets/mod_id

    Hi


    I was wondering if there is a way to set te recource location of creative tabs in you assets/mod_id folder instand of the assets/minecraft folder.


    i know .Setbackgroundimage gets its image from here.

    this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));


    But i would like to try to make a new recource location that gets the image from the assets/mod_id folder.

    Like new ResourceLocation(MOD_ID, "textures/gui/container/image.png"


    Do some people have experience with this and is this hardcoded or not?

    Posted in: Modification Development
  • 0

    posted a message on Tibia Minecraft MOD Pre-Alpha Release

    thx problem solved al long time ago in newer versions

    Posted in: WIP Mods
  • 0

    posted a message on get current player level

    Ofcourse and the best way to learn java is to play with the code :)

    Posted in: Modification Development
  • 0

    posted a message on get current player level

    I found the problem i just need to remove the "()" from playerIn.experienceLevel();

    Posted in: Modification Development
  • 0

    posted a message on get current player level
    Quote from Choonster»

    The EntityPlayer#experienceLevel field contains the player's current XP level.



    i tryed that before and it gives an error with no correction for it, i don't know how tot use it correctly it also says
    The method experienceLevel() is undefined for the type EntityPlayer

    if (EntityPlayer.experienceLevel() == 1){

    }


    add if i trigger it like this below


    if (playerIn.experienceLevel() == 0){

    }


    it says to add a cast that cast it to an object. but gives an other error

    Posted in: Modification Development
  • 0

    posted a message on get current player level

    Hi,


    I wanne get the current player level/experince to check if there a high enough level to use some items.

    i don't know how to get the current player level and i cant realy find it out in the vanila minecraft files like how an anvil checks the player level

    can somebody link me a tutorial, or a vanila class where i can find this? thank you

    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags

    Found a solution on my own by writing it my own way and it works fine and doest disapear on player dead.



    here is the code that works so other can use it for saving booleans or integers without removal on player dead :)


    take a look at the mod i developing with this code was for
    http://www.planetminecraft.com/mod/mmorpg-mod---tibia-minecraft-mod---pre-alpha-mc-110-18/

    public static final String Spell_2 = "x";
    	
    
    
        @Override
        public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
    		
    		
        	if (!worldIn.isRemote) {
    			if (itemStackIn.getItem() == (RegisterItemSet_Magic.adana_ani)) {
    								
    
    				learned = playerIn.getEntityData().getCompoundTag(playerIn.PERSISTED_NBT_TAG).getCompoundTag("Spells").getBoolean(Spell_2);
    	
    				if (!learned == true) {
    					playerIn.getEntityData().setTag(playerIn.PERSISTED_NBT_TAG, new NBTTagCompound());
    					playerIn.getEntityData().getCompoundTag(playerIn.PERSISTED_NBT_TAG).setTag("Spells", new NBTTagCompound());
    					playerIn.getEntityData().getCompoundTag(playerIn.PERSISTED_NBT_TAG).getCompoundTag("Spells").setBoolean(Spell_2, true);
    
    					--itemStackIn.stackSize;  
    					learned = true;
    					playerIn.addStat(AchievementList.OPEN_INVENTORY, 1); 
    					playerIn.addChatMessage(new TextComponentString("You Learned a New Spell " + TextFormatting.GREEN + Spell_2 + TextFormatting.WHITE + "."));}
    				else if (learned == true) { 
    					playerIn.addChatMessage(new TextComponentString("You Already Learned " + TextFormatting.YELLOW + Spell_2 + TextFormatting.WHITE + "."));}
    				}	
        		}
        	
        	return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand);
        	    }
        
    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags

    can you show me the correct order? on my code?

    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags

    Nobody that can help me to make an interger that i can load and save succesfully? without removing it by player death?

    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags

    can somebody help me with this problem Please?

    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags
    Quote from UpcraftLP»

    could you post your full updated code? I think your issue might still be related to an incorrect order. Regarding the code above you're not saving anything that's not an empty tag.



    package com.Strychi.TibiaMCMOD.Items.ItemMagic;
    
    import java.util.List;
    
    import com.Strychi.TibiaMCMOD.TibiaMCMOD;
    import com.Strychi.TibiaMCMOD.Items.RegisterItems.RegisterItemSet_Magic;
    import com.Strychi.TibiaMCMOD.Items.RegisterItems.RegisterItemSet_Tools;
    import com.Strychi.TibiaMCMOD.WORK.var;
    import com.Strychi.TibiaMCMOD.WORK.Gui.Inventory;
    
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.stats.AchievementList;
    import net.minecraft.util.ActionResult;
    import net.minecraft.util.EnumHand;
    import net.minecraft.util.text.ITextComponent;
    import net.minecraft.util.text.TextComponentString;
    import net.minecraft.util.text.TextFormatting;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.event.entity.living.LivingEvent;
    import net.minecraftforge.fml.common.eventhandler.Event;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class ItemLearnSpell extends Item {
    
    	
    
    	public ItemLearnSpell() {
    		super();
    	}
    	
    	public static final String Spell_1 = "test";
    	public static final String Spell_2 = "test4";
    	public static final String Spell_3 = "test";
    	public static final String Spell_4 = "test";
    	public static final String Spell_5 = "test";
    	public static final String Spell_6 = "test";
    	public static final String Spell_7 = "test";
    	public static final String Spell_8 = "test";
    	public static final String Spell_9 = "test";
    	public static final String Spell_10 = "test";
    	public static final String Spell_11 = "test";
    
    	
       
    	
    
    
    	@SubscribeEvent
        @Override
        public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
        	if (!worldIn.isRemote) {
        			            
    			if (itemStackIn.getItem() == (RegisterItemSet_Magic.adana_ani)) {
    				
    	            NBTTagCompound persistTag = null;
                    if (playerIn.getEntityData().hasKey(playerIn.PERSISTED_NBT_TAG)) {
                        persistTag = playerIn.getEntityData().getCompoundTag(playerIn.PERSISTED_NBT_TAG);
                    } else {
                        persistTag = new NBTTagCompound();
                        playerIn.getEntityData().setTag(playerIn.PERSISTED_NBT_TAG, persistTag);
                    }
    
                    NBTTagCompound modTag = null;
                    if (playerIn.getEntityData().hasKey("Spells")) {
                        modTag = persistTag.getCompoundTag("Spells");
                        persistTag.setTag("Spells", modTag);
                    } else {
                        modTag = new NBTTagCompound();
                        persistTag.setTag("Spells", modTag);
                    } 
                    System.err.println("Check " + modTag.getInteger(Spell_2));
    				
    
    				persistTag = playerIn.getEntityData().getCompoundTag(playerIn.PERSISTED_NBT_TAG);
    				modTag = persistTag.getCompoundTag("Spells");
    				int integer = modTag.getInteger(Spell_2);
    				System.err.println("Check " + integer);
    				if (/*!modTag.hasKey(Spell_2) || */ integer == 0) {
    					--itemStackIn.stackSize;  
    					System.err.println("Check " + integer);
    					integer = 1;
    					System.err.println("Check " + integer);
    					persistTag.setTag("Spells", modTag);
    					modTag.setInteger(Spell_2, integer); 
    					
    					System.err.println("Check " + integer);
    					playerIn.addStat(AchievementList.OPEN_INVENTORY, 1); 
    					playerIn.addChatMessage(new TextComponentString("You Learned a New Spell " + TextFormatting.GREEN + Spell_2 + TextFormatting.WHITE + "."));}
    				else if (/*modTag.hasKey(Spell_2) || */integer == 1) { //modTag.setBoolean(Spell_2, false);
    					playerIn.addChatMessage(new TextComponentString("You Already Learned " + TextFormatting.YELLOW + Spell_2 + TextFormatting.WHITE + "."));}
    				}	
        		}
        	
        	return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand);
        	    }




    here you go sir, And thank you for your help/time :)

    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags

    i Think the problem is modTag.getInteger(Spell_2); is not working it automaticly set its back to 0?

    Posted in: Modification Development
  • 0

    posted a message on Problems Loading/Setting Intergers With NBT Tags

    That did't work UpcraftLP :/ same situation and i set it in

     NBTTagCompound modTag = null;
    if (playerIn.getEntityData().hasKey("Spells")) {
    modTag = persistTag.getCompoundTag("Spells");
    } else {
    modTag = new NBTTagCompound();
    persistTag.setTag("Spells", modTag);
    }
    Posted in: Modification Development
  • To post a comment, please or register a new account.