• 0

    posted a message on Make Set of Tools & Armor Repairable via Anvil and Crafting

    Yes it worked perfectly. Thank you for your help 😊

    Posted in: Modification Development
  • 0

    posted a message on Make Set of Tools & Armor Repairable via Anvil and Crafting

    Ok, I’m just a little bit of an idiot lol


    I did it just for the armor for testing purposes, and I tested a Carbon Fiber sword...

    Posted in: Modification Development
  • 0

    posted a message on Make Set of Tools & Armor Repairable via Anvil and Crafting

    Hmmm...that isn't working either. Am I doing this right? I'll provide the code I've added so far. I'll show my Carbon Fiber armor for an example.


    Armor Material


    public static final ArmorMaterial ARMOR_MATERIAL_CARBON_FIBER = EnumHelper.addArmorMaterial("armor_material_carbon_fiber", Reference.MOD_ID + ":carbon_fiber", 16, new int[] {3, 7, 9, 3}, 10, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN, 0.0F).setRepairItem(new ItemStack(ModItems.CARBON_FIBER_SHEET));


    ArmorCarbonFiber class


    @Override
    	public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
        {
            if (repair.getItem().equals(ModItems.CARBON_FIBER_SHEET))
            {
            	return true;
            }
            else
            {
            	return false;
            }
        }


    And each piece of armor declared in the init class references ArmorCarbonFiber, where that override is. I am extending ItemArmor.

    Posted in: Modification Development
  • 0

    posted a message on Make Set of Tools & Armor Repairable via Anvil and Crafting

    Are you talking about setRepairItem? If so, I tried that, and it didn’t do anything. So it looked like this: EnumHelper.addArmorMaterial(<values>).setRepairItem(ItemStack(<repair item>));

    I literally made no other changes except for adding those values tho.


    I probably should’ve mentioned that I’m using 1.12.2. Sorry 😐


    Is there any other code I should be adding?

    Posted in: Modification Development
  • 0

    posted a message on Make Set of Tools & Armor Repairable via Anvil and Crafting

    In vanilla MC, you can put two of the same tool/armor piece together in a crafting table and it would combine the two into one, but it would have more durability. For an anvil, you can put a tool in, add its respective material, and it would repair the tool a bit.


    I would like to do this with my modded tools and armor. I don’t know how to do it, so does anyone else know? If you need me to provide any code, I will happily do so. Thanks

    Posted in: Modification Development
  • 0

    posted a message on Just released v1.0 of my first mod!

    I just released the first version of my mod on CurseForge, here’s a link: https://www.curseforge.com/minecraft/mc-mods/minecraft-vanilla-expansion . Feedback would be much appreciated. I hope you all enjoy it!

    Posted in: Minecraft Mods
  • 0

    posted a message on Minecraft Expansion out now!

    I just released the first version of my mod on CurseForge, here’s a link: https://www.curseforge.com/minecraft/mc-mods/minecraft-vanilla-expansion . Feedback would be much appreciated. I hope you all enjoy it!

    Posted in: WIP Mods
  • 0

    posted a message on Spawn Eggs in Custom Creative Tabs - Forge 1.12.2

    I'm trying to put a spawn egg for a custom entity I made into a custom creative tab. I register the entities with this method, which creates a spawn egg for them as well:


    public static void registerEntity(String name, Class<? extends Entity> entity, int id, int range, int color1, int color2)
    	{
    		EntityRegistry.registerModEntity(new ResourceLocation(Reference.MOD_ID + ":" + name), entity, name, id, Main.instance, range, 1, true, color1, color2);
    	}
    Posted in: Modification Development
  • 0

    posted a message on Loot Tables for Dropping Cooked Meat when Burned

    It still does the same thing. Is there something else I could be doing wrong?


    {
        "pools": [
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:raw_turkey_breast",
                        "weight": 100,
                        "functions": [
                            {
                                "function": "set_count",
                                "count": 1
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ],
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": false
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:cooked_turkey_breast",
                        "weight": 100,
                        "functions": [
                            {
                                "function": "set_count",
                                "count": 1
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ],
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": true
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:raw_turkey_drumstick",
                        "weight": 100,
                        "functions": [
                            {
                                "function": "set_count",
                                "count": {
                                    "min": 0,
                                    "max": 2
                                }
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ],
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": false
                                }
                            }
                        ]
                    }
                ]
            },
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:cooked_turkey_drumstick",
                        "weight": 100,
                        "functions": [
                            {
                                "function": "set_count",
                                "count": {
                                    "min": 0,
                                    "max": 2
                                }
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ],
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": true
                                }
                            }
                        ]
                    }
                ]
            }
        ]
    }
    Posted in: Modification Development
  • 0

    posted a message on Textures Help for Mod

    I am making a mod called the More Things Mod. It just adds many different items to the game whilst feeling like it isn’t modded. I am having trouble with certain textures. I have been able to get by with taking some vanilla things, changing the color scheme, and calling it a day. But I’ve run into some issues doing that, and I am not good at making textures. I need someone who is willing to make textures for me. If you provide some textures for me, I will credit you in the mod. The two items I am needing are a cabbage crop and a greens crop (like how it looks when it’s planted and when it’s in your inventory). I already have the harvest item, I just need the seeds item and crop textures. You can choose how many stages it has, I’d only ask that it’s at least 3. Thanks

    Posted in: Modification Development
  • 0

    posted a message on Loot Tables for Dropping Cooked Meat when Burned

    Am I doing this right? I've tried to make my own loot table JSON file based on the cow one you provided. Here it is:

    {
        "pools": [
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:raw_turkey_breast",
                        "weight": 100,
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": false
                                }
                            }
                        ],
                        "functions": [
                            {
                                "function": "set_count",
                                "count": 1
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ]
                    }
                ]
            }
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:cooked_turkey_breast",
                        "weight": 100,
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": true
                                }
                            }
                        ],
                        "functions": [
                            {
                                "function": "set_count",
                                "count": 1
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ]
                    }
                ]
            }
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:raw_turkey_drumstick",
                        "weight": 100,
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": false
                                }
                            }
                        ],
                        "functions": [
                            {
                                "function": "set_count",
                                "count": {
                                    "min": 0,
                                    "max": 2
                                }
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ]
                    }
                ]
            }
            {
                "rolls": 1,
                "entries": [
                    {
                        "type": "item",
                        "name": "mtm:cooked_turkey_drumstick",
                        "weight": 100,
                        "conditions":[
                            {
                                "condition": "entity_properties",
                                "entity": "this",
                                "properties": {
                                    "on_fire": true
                                }
                            }
                        ],
                        "functions": [
                            {
                                "function": "set_count",
                                "count": {
                                    "min": 0,
                                    "max": 2
                                }
                            },
                            {
                                "function": "looting_enchant",
                                "count": {
                                    "min": 0,
                                    "max": 1
                                }
                            }
                        ]
                    }
                ]
            }
        ]
    }

    I want one breast and 0-2 drumsticks to drop 100% of the time. This file is saved under assets.mtm.loot_tables as turkey.json. Here is my loot table handler class:

    public class LootTableHandler
    {
    	public static final ResourceLocation TURKEY = LootTableList.register(new ResourceLocation(Reference.MOD_ID, "turkey"));
    }

    And I have this in my EntityTurkey class:

    @Nullable
        protected ResourceLocation getLootTable()
        {
            return LootTableHandler.TURKEY;
        }

    And the turkey doesn't drop anything when I kill it, whether it is on fire or not.

    Posted in: Modification Development
  • 0

    posted a message on Loot Tables for Dropping Cooked Meat when Burned

    Thank you for the JSON files, I’ll try those out. I tried getSource(), but it said it only gave an Entity. I saw that Zombies use it to see if a Creeper killed them, and if so, to drop the Zombie Head. I don’t think it works for burning to death.

    Posted in: Modification Development
  • 0

    posted a message on Loot Tables for Dropping Cooked Meat when Burned

    I made a loot table through a class, code is here:

    package com.dmh10s.morethingsmod.events;
    
    import java.util.Random;
    
    import com.dmh10s.morethingsmod.entity.EntityTurkey;
    import com.dmh10s.morethingsmod.init.ModItems;
    
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.DamageSource;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    
    public class LootTableEvent
    {
    	@SubscribeEvent
    	public void customLootTableDrop(LivingDropsEvent event)
    	{
    		Random rand = new Random();
    		if(event.getEntityLiving() instanceof EntityTurkey)
    		{
    			event.getEntityLiving().entityDropItem(new ItemStack(ModItems.RAW_TURKEY_BREAST), 0.0F);
    			event.getEntityLiving().entityDropItem(new ItemStack(ModItems.RAW_TURKEY_DRUMSTICK, rand.nextInt(3)), 0.0F);
    		}
    	}
    }
    

    I tried to make a JSON file, but it didn't work. I made sure to follow the tutorial step by step, but it must be outdated. What I want to do is, when a turkey burns to death, I would like the drops to switch to cooked turkey breast and cooked turkey drumsticks. I tried to import a DamageSource variable, but it said a @SubscribeEvent can only import one variable, so I couldn't do that. I am working on Forge 1.12.2. Thanks

    Posted in: Modification Development
  • 0

    posted a message on Need Ideas for Mod

    I’ve been working on a mod called the More Things Mod. It just adds a hodgepodge of things to Minecraft in the most Minecraft-esque way possible. You can just give suggestions, and I’ll do all the dirty work. I’ll try my best to make it happen. The only thing I’d ask is that it is kept simple, because Minecraft is a simple game. I will consider every single reply to this post. Thanks

    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on Mob Attacking Issues - Minecraft Modding 1.12.2

    I am working on a boar in Minecraft, and it was all going smoothly until I tried to code it to attack when it was attacked. I've spent about 6 hours of browsing the Internet and just toying with the tasks and AI to get something working, and nothing happened besides crashes when I summoned it, it not summoning at all, or it being summoned, but just as a passive mob. The Model and Render classes work just fine, the entity showed up in the game and worked fine up to the point when I added the walking and head animations. So, I will link the EntityBoar file only, unless you need to see the Model and Render classes. With this code in particular, the game continues to run even after attempting to summon the Boar, but Boar won't summon. I am working on Forge 1.12.2. Thanks


    package com.dmh10s.morethingsmod.entity;
    
    import java.util.Set;
    import java.util.UUID;
    
    import javax.annotation.Nullable;
    
    import com.dmh10s.morethingsmod.init.ModItems;
    import com.google.common.collect.Sets;
    
    import net.minecraft.block.Block;
    import net.minecraft.enchantment.EnchantmentHelper;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityAgeable;
    import net.minecraft.entity.EntityCreature;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.EntityAIAttackMelee;
    import net.minecraft.entity.ai.EntityAIFollow;
    import net.minecraft.entity.ai.EntityAIFollowParent;
    import net.minecraft.entity.ai.EntityAIHurtByTarget;
    import net.minecraft.entity.ai.EntityAILookIdle;
    import net.minecraft.entity.ai.EntityAIMate;
    import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
    import net.minecraft.entity.ai.EntityAIPanic;
    import net.minecraft.entity.ai.EntityAISwimming;
    import net.minecraft.entity.ai.EntityAITarget;
    import net.minecraft.entity.ai.EntityAITempt;
    import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
    import net.minecraft.entity.ai.EntityAIWatchClosest;
    import net.minecraft.entity.ai.attributes.AttributeModifier;
    import net.minecraft.entity.ai.attributes.IAttributeInstance;
    import net.minecraft.entity.effect.EntityLightningBolt;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.entity.monster.EntityPigZombie;
    import net.minecraft.entity.monster.EntityZombie;
    import net.minecraft.entity.passive.EntityAnimal;
    import net.minecraft.entity.passive.EntityPig;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Items;
    import net.minecraft.init.SoundEvents;
    import net.minecraft.inventory.EntityEquipmentSlot;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.datasync.DataParameter;
    import net.minecraft.network.datasync.DataSerializers;
    import net.minecraft.network.datasync.EntityDataManager;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.EnumHand;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.util.SoundEvent;
    import net.minecraft.util.datafix.DataFixer;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.util.math.MathHelper;
    import net.minecraft.world.EnumDifficulty;
    import net.minecraft.world.World;
    import net.minecraft.world.storage.loot.LootTableList;
    
    public class EntityBoar extends EntityAnimal
    
    {
        private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(ModItems.CABBAGE, Items.CHICKEN, ModItems.RAW_TURKEY_BREAST);
        private EntityLivingBase attackTarget;
        boolean callInReinforcements = false;
    
        public EntityBoar(World worldIn)
        {
            super(worldIn);
            this.setSize(0.9F, 0.9F);
            this.stepHeight = 1.0F;
        }
        
        protected void initEntityAI()
        {
            this.tasks.addTask(5, new EntityAISwimming(this));
            this.tasks.addTask(2, new EntityAITempt(this, 1.2D, false, TEMPTATION_ITEMS));
            this.tasks.addTask(3, new EntityAIWanderAvoidWater(this, 1.0D));
            this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
            this.tasks.addTask(6, new EntityAILookIdle(this));
        }
    
        protected void applyEntityAttributes()
        {
            super.applyEntityAttributes();
            this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(14.0D);
            this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.2D);
            this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0D);
            this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(25.0D);
        }
    
        public static void registerFixesBoar(DataFixer fixer)
        {
            EntityLiving.registerFixesMob(fixer, EntityBoar.class);
        }
        
        public boolean attackEntityFrom(DamageSource source, float amount)
        {
            if (super.attackEntityFrom(source, amount))
            {
                EntityLivingBase entitylivingbase = this.getAttackTarget();
    
                if (entitylivingbase == null && source.getTrueSource() instanceof EntityLivingBase)
                {
                    entitylivingbase = (EntityLivingBase)source.getTrueSource();
                }
                
                this.setAttackTarget(entitylivingbase);
    
                return true;
            }
            else
            {
                return false;
            }
        }
        
        @Override
        public boolean attackEntityAsMob(Entity entityIn)
        {
            float f = (float)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
            int i = 0;
    
            if (entityIn instanceof EntityLivingBase)
            {
                f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase)entityIn).getCreatureAttribute());
                i += EnchantmentHelper.getKnockbackModifier(this);
            }
    
            boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);
    
            if (flag)
            {
                if (i > 0 && entityIn instanceof EntityLivingBase)
                {
                    ((EntityLivingBase)entityIn).knockBack(this, (float)i * 0.5F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
                    this.motionX *= 0.6D;
                    this.motionZ *= 0.6D;
                }
    
                int j = EnchantmentHelper.getFireAspectModifier(this);
    
                if (j > 0)
                {
                    entityIn.setFire(j * 4);
                }
    
                if (entityIn instanceof EntityPlayer)
                {
                    EntityPlayer entityplayer = (EntityPlayer)entityIn;
                    ItemStack itemstack = this.getHeldItemMainhand();
                    ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : ItemStack.EMPTY;
    
                    if (!itemstack.isEmpty() && !itemstack1.isEmpty() && itemstack.getItem().canDisableShield(itemstack, itemstack1, entityplayer, this) && itemstack1.getItem().isShield(itemstack1, entityplayer))
                    {
                        float f1 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
    
                        if (this.rand.nextFloat() < f1)
                        {
                            entityplayer.getCooldownTracker().setCooldown(itemstack1.getItem(), 100);
                            this.world.setEntityState(entityplayer, (byte)30);
                        }
                    }
                }
    
                this.applyEnchantments(this, entityIn);
            }
    		return flag;
        }
    
        protected SoundEvent getAmbientSound()
        {
            return SoundEvents.ENTITY_PIG_AMBIENT;
        }
    
        protected SoundEvent getHurtSound(DamageSource damageSourceIn)
        {
            return SoundEvents.ENTITY_PIG_HURT;
        }
    
        protected SoundEvent getDeathSound()
        {
            return SoundEvents.ENTITY_PIG_DEATH;
        }
    
        protected void playStepSound(BlockPos pos, Block blockIn)
        {
            this.playSound(SoundEvents.ENTITY_PIG_STEP, 0.15F, 1.0F);
        }
    
        public boolean processInteract(EntityPlayer player, EnumHand hand)
        {
            if (!super.processInteract(player, hand))
            {
                ItemStack itemstack = player.getHeldItem(hand);
    
                if (itemstack.getItem() == Items.NAME_TAG)
                {
                    itemstack.interactWithEntity(player, this, hand);
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return true;
            }
        }
    
        /**
         * Called when the mob's health reaches 0.
         */
        public void onDeath(DamageSource cause)
        {
            super.onDeath(cause);
        }
    
        @Nullable
        protected ResourceLocation getLootTable()
        {
            return null; //YOU NEED TO MAKE CUSTOM LOOT TABLES FOR THE BOAR
        }
    
        public EntityBoar createChild(EntityAgeable ageable)
        {
            return new EntityBoar(this.world);
        }
    
        public boolean isBreedingItem(ItemStack stack)
        {
            return TEMPTATION_ITEMS.contains(stack.getItem());
        }
        
        public float getEyeHeight()
        {
        	return 0.7F;
        }
    }
    
    Posted in: Modification Development
  • To post a comment, please or register a new account.