Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

darkgreenminer

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

darkgreenminer's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Distinct Soul, Thanks for sharing your code for your event handler, it was very useful as a reference for me. Cheers
  2. IEntityLivingData was part of the onInitialSpawn code that I copied to try. Here's the code now: public class Stish extends EntityLiving { private Object canPickUpLoot; private boolean canEquipItem; private EntityAIBase aiAttackOnCollide; private Object inventory; public Stish(World worldIn) { super(worldIn); this.setSize(width, height); } private NonNullList<ItemStack> list = NonNullList.withSize(2, ItemStack.EMPTY); private Object difficultyManager; @Override protected void initEntityAI() { //this.tasks.addTask(2, new EntityAIWander(this, 1.25D, 5)); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F)); this.tasks.addTask(1, new EntityAILeapAtTarget(this, 0.6F)); //this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.75D, true)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.canEquipItem = true; //this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); //this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0])); // //note some tasks commented out due to extended class or not wanting entity to be hostile } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.2001D); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(6.0D); } protected SoundEvent getAmbientSound() { return SoundsHandler.ENTITY_STISH_AMBIENT; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundsHandler.ENTITY_STISH_HURT; } protected SoundEvent getDeathSound() { return SoundsHandler.ENTITY_STISH_DEATH; } @Override @Nullable public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); this.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.STONE_PICKAXE)); return livingdata; } /** @Override public ItemStack getHeldItemMainhand() { return getHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.STONE_PICKAXE)); } */ /** private ItemStack getHeldItem(EnumHand mainHand, ItemStack itemStack) { // TODO Auto-generated method stub return null; } */ protected ResourceLocation getLootTable() { return LootTableList.ENTITIES_VILLAGER; } public boolean isSpectator() { // TODO Auto-generated method stub return false; } public boolean isCreative() { // TODO Auto-generated method stub return false; } }
  3. Thanks for your reply. You're absolutely right, I don't really understand how to equip the entity, and haven't found any guidance on it. The bits of code are from what others have shared in their mods. I've re-activated the onInitialSpawn code and removed the other bit above but it's still not working. I'm extending EntityAgeable, and when I tried to extend EntityLiving it seems to be very limited (as TurtyWurty discusses briefly in his entity tutorial (https://www.youtube.com/watch?v=N4uTqY_FU_8). Am I extending the right base class for the IEntityLivingData bit to work? Thanks again.
  4. Hello, I've been on a steep learning curve in creating my own mod which includes custom entities. I've been searching and trying different ways to equip them with armour, weapons and/or tools, but so far, nothing I've tried has worked. I've also been hesitant to ask for help, because I've seen so many replies of, 'You need to learn java'. I've bought and read three books on java, have watched numerous tutorials (which is why my mod is mostly working), but I've found there is very little documentation or tutorials to learn how to do different things that I want to do. I'm using Eclipse to build my mod for 1.12.2. Here's a custom entity class that works, but that I can't equip. Can anyone tell me how to do it? I want this entity to look like a player, wander around the structure he'll be found in and have some equipment on. I'm going to paste my mess of an entity class directly on here: public class Stish extends EntityAgeable { private Object canPickUpLoot; private boolean canEquipItem; private EntityAIBase aiAttackOnCollide; private Object inventory; public Stish(World worldIn) { super(worldIn); this.setSize(width, height); } private NonNullList<ItemStack> list = NonNullList.withSize(2, ItemStack.EMPTY); private Object difficultyManager; @Override protected void initEntityAI() { this.tasks.addTask(2, new EntityAIWander(this, 1.25D, 5)); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F)); this.tasks.addTask(1, new EntityAILeapAtTarget(this, 0.6F)); this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.75D, true)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.canEquipItem = true; this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0])); //I don't want him to be hostile to players //this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.2001D); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(6.0D); } /** @Override @Nullable public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) { livingdata = super.onInitialSpawn(difficulty, livingdata); this.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.STONE_PICKAXE)); return livingdata; } */ @Override public ItemStack getHeldItemMainhand() { return getHeldItem(EnumHand.MAIN_HAND, new ItemStack(Items.STONE_PICKAXE)); } private ItemStack getHeldItem(EnumHand mainHand, ItemStack itemStack) { // TODO Auto-generated method stub return null; } protected ResourceLocation getLootTable() { return LootTableList.ENTITIES_VILLAGER; } public boolean isSpectator() { // TODO Auto-generated method stub return false; } public boolean isCreative() { // TODO Auto-generated method stub return false; } @Override public EntityAgeable createChild(EntityAgeable ageable) { // TODO Auto-generated method stub return null; } }
  5. Someone else had that same problem of their mod only spawning the last structure added to WorldGenCustomStructures, and I remembered that the solution I found was what a commentor named Redstone Tim mentioned, that in WorldGenStructure you have to remove 'static'. I'm happy to email my version of these two classes to you if you want to have a look. It took me hours and hours to get them working. I have no idea what might cause the cascading gen lag, but fixing the multiple structure problem might help.
  6. Great. It's so frustrating when it's not working and I'm trying different things. Let me know if yours is still buggy and I'll send a copy of my WorldGenCustomStructures class. Have you seen Harry Talks' tutorial? It's here at https://www.youtube.com/watch?v=cq1wNwuGxu4&t=860s and one early error I had was importing Scala arrays instead of java.util (described in a couple of the comments). If you want to try out my mod (still in beta), it's here https://www.curseforge.com/minecraft/mc-mods/skulls-and-monkeys. It's the result of me following a few tutorials to put some fun things into the game for 1.12, recreating some of my favourite old 1.7.10 mods partially and playing around with monkeys. I've striven for game-balance, as that's how I like to play on modded survival worlds. What sort of mod are you developing, if I may ask?
  7. Hey mate, wish I could help you, but I can't even get my custom mobs to be equipped with weapons etc. Is there a tutorial or bit of code you could share? From the little info I've been able to find, there is something about 'main hand'. Is there a way of setting what part of a model is the main hand? If there is, maybe you could set a different part of the model to it to change the location. I have no idea how that would work though. Cheers
  8. Hi Merthew and VoidWa1k3r, I'm having the same issue where I want multiple structures to be generated, but only the last one is. I'm trying to learn Java but there are very few resources on Eclipse / Forge, especially for specific issues. My WorldGenCustomStructures class looks nearly identical to the one you shared above on Github. How did you fix your problem??? I removed 'static' from my 'public static final WorldGenStructure MYSTRUCTURE = new WorldGenStructure("mystructure")' with another entry for the second one and both generateStructure statements in the overworld (case 0), but it still didn't work properly. What am I not getting? Thanks so much if you get this and can help, Darkgreenminer
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.