Jump to content

Opengbil

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by Opengbil

  1. I am trying to get the horse armor item that is currently on the horse entity.

     

    	@EventBusSubscriber(modid = Reference.MODID)
    public class DamageHorseArmor {
    	    @SubscribeEvent
        public static void DamageWoodArmor(LivingAttackEvent event){
            
            World world = event.getEntity().getEntityWorld();
            Entity victim = event.getEntity();
            
            if(!world.isRemote){
                if(victim instanceof EntityHorse){
                    if(((EntityHorse)victim).getHorseArmorType() == MaterialReference.WOOD){
                        
                    }
                }
            }
            
        }
    }
    	

     

    The line of code:

    ((EntityHorse)victim).getHorseArmorType()

     

    Only returns the material type, but not the item itself which I need.

  2. 19 hours ago, Draco18s said:

    Take a look at the methods ItemTool and ItemSword override and look for words like "durability"

    I couldn't find any methods or variables with words like durability in ItemTool nor in ItemSword sadly.
    What Method can help me to deal damage to an item?

  3. 6 hours ago, V0idWa1k3r said:

    As I've said

    Your file isn't horse_armor_wood. It's horse_armor_wood.png(I presume anyway since you have file extensions hidden it may be any other image extension - and it has an image extension because it has an image thumbnail).

     

    Finally Worked!
    Screenshot_6.png.a219e17af97c5dd27000b042533cae0f.png

     

    The texture is all screwed up tho xd.
    Thank you so much!

  4. 2 hours ago, Opengbil said:

    I tried to put a specific file path.
    I even tried to put the png directly to the modid folder but it didn't work .

    Are you sure there is no ctx associated with this type of textures?

    "Minecraft identifies resources using ResourceLocations. A ResourceLocation contains two parts: a namespace and a path. It generally points to the resource at assets/<namespace>/<ctx>/<path>, where ctx is a context-specific path fragment that depends on how the ResourceLocation is being used."

     

    public class MaterialReference {
        
        public static final HorseArmorType WOOD = EnumHelper.addHorseArmor(Reference.MODID + ":" + "wood", Reference.MODID + ":" + "horse_armor_wood", 2);
        
    }

     

    public class WoodHorseArmor extends Item{
        
        public WoodHorseArmor(){
            
            setCreativeTab(CreativeTabs.COMBAT);
            setUnlocalizedName(Reference.MODID + ":" + "wood_horse_armor");
            setRegistryName("wood_horse_armor");
        }
        
        @Override
        public HorseArmorType getHorseArmorType(ItemStack stack){
            
            return MaterialReference.WOOD;
        }
    }

     

    Screenshot_5.png.365b14130181c51b72087693327dba56.png

  5. On 5/31/2019 at 12:03 AM, V0idWa1k3r said:

    With the current parameters you are passing to the method the game would look for your textures in assets/modid/horse_armor_wood.

    Pass an actual texture path to your second parameter.

    I tried to put a specific file path.
    I even tried to put the png directly to the modid folder but it didn't work .

    Are you sure there is no ctx associated with this type of textures?

  6. I am trying to add a new type of horse armor.
    I have managed to register the item and it shows up.

    But whenever I put it on a horse is turns white.

    public class MaterialReference {
        
        public static final HorseArmorType WOOD = EnumHelper.addHorseArmor(Reference.MODID + ":" + "wood", Reference.MODID + ":" + "horse_armor_wood", 500);
        
    }

     

    public class WoodHorseArmor extends Item{
        
        public WoodHorseArmor(){
            
            setCreativeTab(CreativeTabs.COMBAT);
            setUnlocalizedName(Reference.MODID + "." + "woodhorsearmor");
            setRegistryName("woodhorsearmor");
        }
        
        @Override
        public HorseArmorType getHorseArmorType(ItemStack stack){
            
            return MaterialReference.WOOD;
        }
    }

     

    Screenshot_4.png.fbf1662a137e829ec16cce8f7c0ae24f.png

     

    Where should I put the texture file for the model it self (the change of horse texture when I put the armor)?

  7.  

    public class WoodHorseArmor extends Item{
    	
        public static final HorseArmorType HORSECRAFT_HORSEARMOR = EnumHelper.addHorseArmor("WOOD", Reference.MODID + ":" + "items/woodhorsearmor", 500);
        
        public WoodHorseArmor(){
            
            setCreativeTab(CreativeTabs.COMBAT);
            setUnlocalizedName(Reference.MODID + "." + "woodhorsearmor");
            setRegistryName("woodhorsearmor");
        }
        
        @Override
        public HorseArmorType getHorseArmorType(ItemStack stack){
            
            return HorseArmorType.WOOD;
        }
    }

     

  8. On 5/21/2019 at 9:30 PM, V0idWa1k3r said:

    There is a HorseArmorType enum you could extend using EnumHelper.

    Then your Item would override Item#getHorseArmorType to return your extended enum.

    I override but when I am unable to add my custon armor to the HorseArmorType enum.

     

    This is the line that should add to the enum:
    public static final HorseArmorType HORSECRAFT_HORSEARMOR = EnumHelper.addHorseArmor(Reference.MODID + ":" + "horsecraft_horsearmor", Reference.MODID + ":" + "horsecraft", 500);

     

    What am I missing here?

  9. 4 minutes ago, diesieben07 said:

    No. Either post a Github repo or post the relevant code (based on the crash report) in some accessible manner. Not as a download.

    I'll post the code on Github.

    How should I know wich part of the code is relevent to my crash.

    Where can I find information about how to read the crash file?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.