Posted June 17, 201510 yr Hi! I am making a mythical horses mod, and have made all of the mobs. Now, I am trying hard to make them rideable (by right clicking, no saddle), but I just can't seem to do it! I can't get the mob class up right now (sorry :-/), but I will be able to in a day or so. If anyone knows how to make a rideable mob, can you post an example class? I know this is asking a lot :-/ but it would be incredibly helpful if you could! I. Am. A. Noob. Noobs.
June 17, 201510 yr What are you subclassing from? If you're creating a type of horse, then I would have thought simply subclassing EntityHorse and adding whatever extra things you need would be easiest - all of the code pertaining to riding behavior is already done for you. Geek girl and professional code wrangler, but new to Forge.
June 17, 201510 yr Author What are you subclassing from? If you're creating a type of horse, then I would have thought simply subclassing EntityHorse and adding whatever extra things you need would be easiest - all of the code pertaining to riding behavior is already done for you. The very sad part is: ... it's very sad... I can't find the EntityHorse Class. I. Am. A. Noob. Noobs.
June 17, 201510 yr net.minecraft.entity.passive.EntityHorse 1.7.10 is no longer supported by forge, you are on your own.
June 17, 201510 yr Author What if I didn't want a saddle or horse GUI- just right click and I'm riding? I. Am. A. Noob. Noobs.
June 17, 201510 yr I would imagine you just override isHorseSaddled to always return true : public boolean isHorseSaddled() { return true; } I haven't tried that though, YMMV. I'm also new to Forge and finding that taking a look through the Minecraft/Forge source helps immensely. Geek girl and professional code wrangler, but new to Forge.
June 17, 201510 yr Author It didn't work... but so far, here is my class:package com.camp.entity; import com.camp.item.ItemManager; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.world.World; public class UnicornMob extends EntityHorse { public boolean stationary; public UnicornMob(World worldIn) { super(worldIn); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3d); } @Override public void dropFewItems(boolean recentlyHit, int lootLevel) { int quantity = this.rand.nextInt(4) + 1; for (int i = 0; i < quantity; i++) { if (this.isBurning()) { this.dropItem(ItemManager.unicornHorn, 1); } else { this.dropItem(ItemManager.unicornHorn, 1); } } } public boolean isAIEnabled() { return true; } } I. Am. A. Noob. Noobs.
June 17, 201510 yr Err, i don't see that you've put the override in anywhere? Like this: import com.camp.item.ItemManager; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.world.World; public class UnicornMob extends EntityHorse { public boolean stationary; public UnicornMob(World worldIn) { super(worldIn); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWander(this, 1.0D)); } @Override public boolean isHorseSaddled() { return true; } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3d); } @Override public void dropFewItems(boolean recentlyHit, int lootLevel) { int quantity = this.rand.nextInt(4) + 1; for (int i = 0; i < quantity; i++) { if (this.isBurning()) { this.dropItem(ItemManager.unicornHorn, 1); } else { this.dropItem(ItemManager.unicornHorn, 1); } } } public boolean isAIEnabled() { return true; } } Geek girl and professional code wrangler, but new to Forge.
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.