Jump to content

Recommended Posts

Posted (edited)

 

Started with 

 

Moving on from there

 

Going to create some entities!

Spoiler

References thus far:

A lot of reading the EntitySheep.class and seeing where it's referenced inside forgedSrc
TheXFactor117 's Forge 1.7 Modding Tutorials

 

-new Package goat with class Entity_Goat

-new Startup Classes StartupDedicatedServer, StartupClientOnly, StartupCommon

-each with their respective 

public static void preInit<classname>()		{ }
public static void init<classname>()		{ }
public static void postInit<classname>()	{ }

 

Going to base a most of this code on EntitySheep

 

-Entity_Goat is going to extend EntityAnimal

Spoiler

requires


import net.minecraft.entity.passive.EntityAnimal;

which requires constructor, auto generated as


	public Entity_Goat(World worldIn) 
    {	super(worldIn);		}

and override function createChild, auto generated as


	@Override
	public EntityAgeable createChild(EntityAgeable ageable) 
	{	return null;	}

 

which require


import net.minecraft.entity.EntityAgeable;
import net.minecraft.world.World;

 

 

-create constructor with World input parameter and setSize of Entity_Goat

	public Entity_Goat(World worldIn) 
	{
		super(worldIn);
		this.setSize(1.2F, 1.7F);
	}

 

-give Entity_Goat ability to createChild which we can use to pass variable from parent to child later on

	@Override
	public Entity_Goat createChild(EntityAgeable ageable) 
	{
		Entity_Goat entitygoat1 = new Entity_Goat(this.world);
		return entitygoat1;
	}

 

-give Entity_Goat attributes, an initialization function and an on first spawn function

    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(14.0D);
        this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.3D);
    }

    protected void entityInit()
    {
        super.entityInit();
    }    
	@Nullable
    public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
    {
        livingdata = super.onInitialSpawn(difficulty, livingdata);
        return livingdata;
    }

 

Spoiler

attributes from SharedMonsterAttributes.class


 private static final Logger LOGGER = LogManager.getLogger();
    public static final IAttribute MAX_HEALTH = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, Float.MIN_VALUE, 1024.0D)).setDescription("Max Health").setShouldWatch(true); // Forge: set smallest max-health value to fix MC-119183. This gets rounded to float so we use the smallest positive float value.
    public static final IAttribute FOLLOW_RANGE = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).setDescription("Follow Range");
    public static final IAttribute KNOCKBACK_RESISTANCE = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).setDescription("Knockback Resistance");
    public static final IAttribute MOVEMENT_SPEED = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true);
    public static final IAttribute FLYING_SPEED = (new RangedAttribute((IAttribute)null, "generic.flyingSpeed", 0.4000000059604645D, 0.0D, 1024.0D)).setDescription("Flying Speed").setShouldWatch(true);
    public static final IAttribute ATTACK_DAMAGE = new RangedAttribute((IAttribute)null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D);
    public static final IAttribute ATTACK_SPEED = (new RangedAttribute((IAttribute)null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).setShouldWatch(true);
    public static final IAttribute ARMOR = (new RangedAttribute((IAttribute)null, "generic.armor", 0.0D, 0.0D, 30.0D)).setShouldWatch(true);
    public static final IAttribute ARMOR_TOUGHNESS = (new RangedAttribute((IAttribute)null, "generic.armorToughness", 0.0D, 0.0D, 20.0D)).setShouldWatch(true);
    public static final IAttribute LUCK = (new RangedAttribute((IAttribute)null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).setShouldWatch(true);

 

which we need to include


import javax.annotation.Nullable;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;

 

 

-set up register functions for entity in main mod class

	public static int startEntityID;
    public static int i;

	public static void registerModEntity(Class<? extends Entity> entityClass, String name) {
		EntityRegistry.registerModEntity(new ResourceLocation("class:resources"), entityClass, name, ++startEntityID, Ascension.instance, 80, 3, false);
      //Unsure about new ResourceLocation("class:resources") -Gotlyfe
		logger.info("Registering mod entity " + name + " with ID = " + startEntityID);
	}

	public static void registerModEntityEgg(Class<? extends Entity> entityClass, String name, int primary, int secondary) {
		registerModEntity(entityClass, name);

		if (i == 0) {
			registerSpawnEgg(name, primary, secondary);
			++i;
		}
	}

	public static void registerSpawnEgg(String name, int primary, int secondary) {

	}

	public static int getUniqueEntityId() {
		do {
			startEntityID++;
		} while (EntityList.getClassFromID(startEntityID) != null);
      //EntityList.getStringFromID() No longer exists but .getClassFromID() functions similarly in this case - Gotlyfe

		return startEntityID;
	}
Spoiler

This code is directly from 
TheXFactor117 's Forge 1.7 Modding Tutorials  15a

they require 


import net.minecraft.entity.EntityList;
import net.minecraftforge.fml.common.registry.EntityRegistry;

 

 

 

Edited by Gotlyfe

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Here is the end of the log. it was way too big to put in pastebin, but I started from when I was online and everything was fine. Error should be in here: https://pastebin.com/Sdhdq593
    • Update: I stand corrected as I was able to dig up a relevant log from my earlier testing which highlights the overall issue but does not explain how to solve it. See, Diagnostic Logs for pack.mcmeta not found: https://pastebin.com/LXS8Rtna
    • Which mod was this? What are all the mods that were in use? It will help if enough information to replicate the problem is available.
    • I have been attempting to create a supplementary resource pack with Patchouli in order to add back the guidebook for Better End but unfortunately in every prototype I have made pack.mcmeta and my resource pack are not recognized. I have tested both zipped and unzipped and either way curseforge does not recognize my resource pack as existing. For testing I stripped my pack down to just the pack.mcmeta file and two empty folders labelled data and assets and I know the data folder is not the problem as firstly my first attempts just had an assets folder following Patchouli instructions and data came later in my flailing attempts to make anything in my pack work. The mcmeta file is not recognized whether or not I use this:  { "pack": { "pack_format": 15, "description": "A replacement for the BetterEnd Guide Book." } "language": { "en_US": { "name": "English", "region": "United States" } } } ,or this:  { "pack": { "pack_format": 15, "description": "A replacement for the BetterEnd Guide Book." } } I have made sure to only use lowercase and the pack folder is named better-end-guide. Is this some magic nonsense from me doing this manually instead of using an IDE or similar tool? Could it be because my files are by default in UTF-8 even though ANSI gives the same results? Is there a specific community secret tool I am supposed to use for zipping or specific settings? I am pulling my hair in distress. Unfortunately as there are no errors involved I lack logs to offer, if that disqualifies this thread please do not be harsh and instead if you can then please direct me to a forum with different rules and sufficiently respectful but knowledgeable as to be of assistance. Most of my experience with the programming community has been poor and so naturally I find myself wary.
    • I never picked up a tier 0 dragon skull to my knowledge. One of my other skulls must have bugged out and randomly became one. I was confused on what the heck it was and tried placing it, now the game will only crash because it can't render in whatever the heck the tier 0 skull is. This is on a server and it crashes anyone within render distance.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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