Jump to content

mirk

Members
  • Posts

    37
  • Joined

  • Last visited

Posts posted by mirk

  1. Yeah, I just refined it a bit and I'm coming back to report that it's a success!

     

    Here's the refined code for anyone looking to do a similar thing:

    Spoiler
    
    @SubscribeEvent
    public static void AddPettingAITask(LivingSpawnEvent event)
    {
        EntityLivingBase livingBase = event.getEntityLiving();
    
        if(livingBase instanceof EntityAnimal)
        {
          	EntityAnimal animalEntity = (EntityAnimal)livingBase;
    
          	boolean addPettingTask = true;
          	for(EntityAITasks.EntityAITaskEntry task : animalEntity.tasks.taskEntries)
          	{
          		if(task.action instanceof EntityAIPet)
          		{
          			addPettingTask = false;
          			break;
          		}
    		}
    
            if(addPettingTask)
            {
            	animalEntity.tasks.addTask(10, new EntityAIPet(animalEntity));
            }
    	}
    }

     

    Sorry if the formatting is a bit off, it's not cooperating with me.

  2. Hello again!

    I'm wondering what the best way to add a custom EntityAI thing to all EntityAnimals would be? I'm currently doing it on LivingSpawnEvent, but that feels a bit hacky, and I don't know how to check if the EntityAnimals already have the task. Would the best way to do this be at registration?

     

    Here's where I'm doing it:

    Spoiler
    
    @SubscribeEvent
    public static void AddPettingAITask(LivingSpawnEvent event)
    {
      EntityLivingBase livingBase = event.getEntityLiving();
    
      if(livingBase instanceof EntityAnimal)
      {
        EntityAnimal animalEntity = (EntityAnimal)livingBase;
        animalEntity.tasks.addTask(10, new EntityAIPet(animalEntity));
      }
    }

     

     

    The EntityAIPet class is basically an AI task that allows the player to pet the animal for a small amount of XP every now and then. I can post the code if need be.

  3. 16 hours ago, Laike_Endaril said:

    I have potion recipes working quite well...my code correctly targets any thick potion (normal thick, splash thick, lingering thick) and outputs the correct result; you could even put one of each of these in the slots and get a normal, splash, and lingering of whatever your output is.  It also correctly does *not* work with any non-thick potion.

     

    Btw, we both seem to have had the same idea, using thick potions as a base

     

    Code is here:
    https://github.com/Laike-Endaril/Dynamic-Stealth/tree/1.12.2/src/main/java/com/fantasticsource/dynamicstealth/common/potions/recipes

     

    Thanks for this! That worked perfectly.

  4. Just a quick bump. Been sick for a while, so was away from the forums. Sorry about that.

     

    So I've implemented net.minecraftforge.common.brewing.BrewingRecipe instead of IBrewingRecipe, and it's having the same behaviour, where it replaces all potions in the brewing stand, regardless of what they are. Is there a way to stop this?

     

    The code for the custom recipe is very simple, as below.

     

    Spoiler
    
    public class BrewingEnderSlime extends net.minecraftforge.common.brewing.BrewingRecipe
    {
        public BrewingEnderSlime()
        {
            super(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.THICK), new ItemStack(Blocks.PUMPKIN), new ItemStack(ModItems.ENDER_SLIME));
        }
    }

     

     

  5. Ah, excellent advice. Thank you again!

    I'm going to go about changing all my stuff to better fit this pattern.

     

    Is there a list of all of this advice somewhere?

    If not, there should be! I'd love to read it all. Who knows how many mistakes I'm making, just picking up bad habits from other modders who have tried to make my life easier.

  6. Thanks for the info Cadiboo! I'm currently implementing this into my mod, as I realise I'm quite guilty of this.

     

    Just a quick question: does the class being registered have to have a default constructor?

    I have ItemBase and BlockBase classes, which take their names from their constructors and have no default constructor, how would I go about fitting these into the @ObjectHolder standard?

  7. 3 hours ago, deerangle said:

    Try implementing and registering net.minecraftforge.common.brewing.BrewingRecipe instead. It supports input, ingredient and output as item stacks. 

    Well, that helped fix the second recipe that I was registering, so thank you! However, I still get the bug where Thick Potion > Ender Slime changes all other potion types in the brewing stand, for some reason. I just can't figure it out.

     

    How does vanilla Minecraft compare potions?

  8. I've now got my Ender Pearls brewing away quite happily! It's actually the step before it that isn't so happy. Basically, it should go Water Bottle > Thick Potion > Ender Slime, but when I'm brewing the Ender Slime, it also overwrites all of the other potions in the brewing stand!

     

    For reference, I'm writing my own IBrewingRecipe handler (and it has to be a single class, because adding more than one recipe apparently doesn't work on the Forge version I'm on, which is 1.12.2-14.23.5.2768) I've gone back to the IBrewingRecipe and I'm hoping for the best, and I've tried checking against Item and PotionType.

     

    Admittedly, I know very little about potions, so I'm kind of out of my depth here. How does one compare potions?

     

    EDIT: Changing back to the separate IBrewingRecipes actually completely broke whatever recipe I decide to register second. Not sure what's happening there. Nothing in the logs about it.

  9. Maybe I'm just trying to stretch Minecraft too far, but I'm trying to make it so you can brew Ender Pearls using a custom ingredient, and a custom item (not a potion bottle, just an empty Ender Pearl, which is an Item).

     

    Now, I've tried registering the recipe using these items, but it won't let me put the empty Ender Pearls into the brewing stand. I believe it should be letting me do this, because they're valid input (as specified in ContainerBrewingStand#isValidInput), as I've registered the brewing recipe, but for some reason they're just not going in.

     

    Is what I want to do not possible, or do I just need to work a little harder?

     

    Any help is appreciated!

  10. I'm wondering if anyone can help me: I'm trying to @Override the BlockCrops#getGrowthChance function, but IntelliJ and Gradle keep complaining that there's nothing to override, even when I literally copy and paste the entire function into the new class.

    What's going on here?

    Here's the new class' overridden version, just for reference.

    @Override
    protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos)
    {
        return 0.3F;
    }

     

  11. I've been guessing at this for a few days now, so I'm coming for some help. Is there a reference for all of the oreDict stuff somewhere that I'm missing?

    Anyway, I'm looking to make a recipe that uses any log, and I just can't for the life of me find the oreDict entry for it. I've tried blockWood, blockLog and some other less obvious ones that I don't think were correct, now that I look over the docs.

     

    Can someone help me out, please?

    Thanks in advance!

  12. 1 minute ago, Animefan8888 said:

    PlayerEvent.Clone should be there I have forge version 1.12.2-14.23.4.2732 and it is still there. It is even on the forge github, so it hasn't been removed. It sounds like there is a problem with your workspace.

    Now I'm very confused. Here's my PlayerEvent.java. It's much shorter.

    It looks like there is something wrong with my workspace, and I don't know why. I followed the relatively easy instructions.

     

    Oh well, thank you for the assist! I'll re-install Forge yet again.

  13. So I'm trying to have my player mana capability carry over on death, I'm following a fairly standard tutorial, and I've gotten to a part where it asks you to use PlayerEvent.Clone.

    The only problem is, that it appears to be missing from Forge entirely. Was it removed recently or something? Am I just dumb?

    I've checked the source code for PlayerEvent, and it does indeed seem to be missing from there.

     

    I get the feeling it might have been split into PlayerRespawnEvent and PlayerChangedDimensionEvent, but that's just a hunch.

     

    I'm using the latest recommended version for 1.12.2, by the way, Forge version 1.12.2-14.23.4.2705.

  14. 1 minute ago, Animefan8888 said:

    This isn't completely true. The server may have less mods than the client, the only requirement is that the client has all the mods the server does.

    I know, I'm just assuming he's trying to play with all of his mods. Maybe that's a wrong assumption, so I apologise for that.

  15. 16 minutes ago, Animefan8888 said:

    No problem, glad I could help. Also it will look weird if you model protrudes outside of a 1 block space into another blocks, so you may wanna shrink it a little.

    Yeah, I'm going to scale it down a bit, it's a bit extra at the moment. I think the missing texture is actually a problem in Blender, because I have no idea how to use it properly.

     

    8 minutes ago, Draco18s said:

    And change the block type to not be a full, opaque cube so it doesn't create holes in the world.

    Yes, that too! I was following a tutorial that was teaching about opaque cubes and stuff, so I just left it in like a dingus.

×
×
  • Create New...

Important Information

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