Jump to content

the_infamous_1

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by the_infamous_1

  1. Now I've run into this crazy bug. If I make the entity's width small, and then try to grow it on the axis that is larger, then the world gets corrupted somehow as mobs cannot move / start floating on collision and leaves decay rapidly. If I make it big, and instead shrink it on the axis that is smaller, then it's ok. The small-then-grow approach makes the suffocation hitbox correct, while the large-then-shrink approach makes it not.
  2. The thing is, I need the entity width to be a large number so that the entity is wide enough on the X-axis, but it needs to be drastically thinner on the Z-axis (I'm talking 6.0F wide on X, 1.0F wide on Z). Entity width is used for both the X-axis width and Z-axis width, so it's not like I can make them separate. This is why I have to override getBoundingBox and shrink the bounding box along the Z-axis. I will look into eye height, though, thanks for that tip.
  3. For clarification, when I am talking about the hitboxes and their colors, I mean the ones that show up after pressing F3+B in-game. I have a mob that is drastically wider on the X-axis than it is on the Z-axis, so I've been overriding Entity#getBoundingBox to return one that is shrunk on the z-axis, which does work for the general hitbox of the mob (the one with a white outline). However, the suffocation hitbox (the thin red hitbox that determines if a mob should be suffocating from being inside a block) still uses the same X/Z dimensions. I can't seem to find a method to override in Entity/LivingEntity that allows me to change the suffocation hitbox, if there even is one. As a work-around, I've overridden LivingEntity#isEntityInsideOpaqueBlock but of course the displayed suffocation hitbox is still the same.
  4. That's correct. I do try to check to see if the mob was already armed by the vanilla onInitialSpawn function and then re-arm them, but I don't know if that's actually working because I can still get mobs spawning in with vanilla equipment. I imagine I can just run an additional check to see if the mob currently has vanilla armor/weapons, and then run them through the re-arming process an additional time, but that seems wasteful.
  5. Okay, found a workaround! (I think) public DifficultyInstance getDifficultyAtPosition(World world, BlockPos pos) { long inhabitedTime = 0L; float moonPhaseFactor = 0.0F; //HardSteel.logger.info("Inhabited Time is " + inhabitedTime); //HardSteel.logger.info("Current Moon Phase Factor is " + moonPhaseFactor); if (world.isBlockLoaded(pos)) { //HardSteel.logger.info("Inside isBlockLoaded check"); moonPhaseFactor = world.getCurrentMoonPhaseFactor(); //HardSteel.logger.info("Current Moon Phase Factor is " + moonPhaseFactor); // world.getChunkAt(pos) // returns this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); // which means it gets the chunk at (X / 2^4), (Z / 2^4) if(world.getChunkProvider().chunkExists(pos.getX() >> 4, pos.getZ() >> 4)){ HardSteel.logger.info("Chunk Exists"); Chunk chunk = world.getChunkAt(pos); inhabitedTime = chunk.getInhabitedTime(); //HardSteel.logger.info("Inhabited Time is " + inhabitedTime); } } //HardSteel.logger.info("Done with isBlockLoaded check"); //HardSteel.logger.info("Inhabited Time is " + inhabitedTime); //HardSteel.logger.info("Current Moon Phase Factor is " + moonPhaseFactor); return new DifficultyInstance(world.getDifficulty(), world.getDayTime(), inhabitedTime, moonPhaseFactor); } As long as I check for the chunk actually existing at the position before I try to get it, everything works fine and I don't get caught in that infinite loop I would get caught in previously.
  6. Alright. I assume this is the case for 1.15.2 as well?
  7. Finally got my Github to work, here's my capability stuff: https://github.com/Thelnfamous1/HardSteel/tree/master/src/main/java/com/infamous/hard_steel/capabilities https://github.com/Thelnfamous1/HardSteel/tree/master/src/main/java/com/infamous/hard_steel/events Note that I committed this with LivingSpawnEvent.SpecialSpawn instead of EntityJoinWorldEvent.
  8. I created a new world just now using LivingSpawnEvent.SpecialSpawn handling instead of EntityJoinWorldEvent. I went into the Nether, and every single Zombie Pigman and Wither Skeleton spawned with the vanilla swords instead of modded ones. The only time they ever spawn with modded swords are when they are spawned with a spawn egg and when they teleport to the Overworld via Nether Portal. Overworld mobs do spawn naturally with modded stuff.
  9. I want to (re-)arm mobs with my modded armors and weapons instead of vanilla armors and weapons. I'm attempting to achieve this by recreating almost exactly how vanilla arms mobs, by using difficulty instances. I can do this just fine by using LivingEntitySpawn.SpecialSpawn (which also works for old worlds), but then I cannot get the Nether mobs (zombie pigmen and wither skeleton) to naturally spawn with modded stuff, so I am forced to use EntityJoinWorldEvent instead.
  10. I've been having issues with trying to get the DifficultyInstance in the event's position in the world during EntityJoinWorldEvent. I've recreated the method getDifficultyForLocation below and started debugging it by using it my event handler instead of the original method: public DifficultyInstance getDifficultyAtPosition(World world, BlockPos pos) { long inhabitedTime = 0L; float moonPhaseFactor = 0.0F; HardSteel.logger.info("Inhabited Time is " + inhabitedTime); HardSteel.logger.info("Current Moon Phase Factor is " + moonPhaseFactor); if (world.isBlockLoaded(pos)) { HardSteel.logger.info("Inside isBlockLoaded check"); moonPhaseFactor = world.getCurrentMoonPhaseFactor(); HardSteel.logger.info("Current Moon Phase Factor is " + moonPhaseFactor); // world.getChunkAt(pos) // returns this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); // which means it gets the chunk at (X / 2^4), (Z / 2^4) Chunk chunk = world.getChunkAt(pos); inhabitedTime = chunk.getInhabitedTime(); HardSteel.logger.info("Inhabited Time is " + inhabitedTime); } HardSteel.logger.info("Done with isBlockLoaded check"); HardSteel.logger.info("Inhabited Time is " + inhabitedTime); HardSteel.logger.info("Current Moon Phase Factor is " + moonPhaseFactor); return new DifficultyInstance(world.getDifficulty(), world.getDayTime(), inhabitedTime, moonPhaseFactor); } I notice that when opening an old world - meaning, a world that was created before I started ever handling EntityJoinWorldEvent - I can't get past "Chunk chunk = world.getChunkAt(pos)" during world load, causing the world loading process to never finish even though it says "100%" on the screen. Is there a work around I can use, or someway I can account for not being able to get the chunk? I do notice that isBlockLoaded is a deprecated method, but I don't know how to replace it if it's necessary.
  11. So what I've noticed is that if you spawn too many mobs in a rapid succession (like I usually do during testing) and then save/quit/reload, most of them won't have their capabilities preserved. If their spawning is done normally or slowly, then it will work as expected.
  12. Okay, I shifted setting the "isReArmed" capability to true into the if (World.isBlockLoaded(entity.getPosition) statements during MobEquipEvent (it was outside before). I also add a logger to detect if "isReArmed" is ever set to true before those if statements and it turns out, they are, so I am successfully setting the isReArmed capability of a mob to true. In-game, sometimes entities have their armor and weapons preserved when exiting and reloading, but sometimes they don't. Something about saving and quitting too quickly after a mob has spawned causes it to not get its capability saved to disk I imagine. Here's the updated MobEquipEvent class: https://pastebin.com/w9Z9ArWK
  13. Have technical issues with Github at the moment, sorry. ReArmerStorage: https://pastebin.com/379GBsq7 ReArmer: https://pastebin.com/yNQ9Wz0g IReArmer: https://pastebin.com/fu5HJFrA
  14. Great. Bad news, however. Mobs are still re-arming themselves when reloading into a world. Do I need to make sure in AttachCapability that a mob doesn't already have a capability? It seems like when I set a mob's isReArmed capability to true, either it doesn't actually save or each mob keeps getting a new capability with a default value of false.
  15. Yup, that did it. I feel like a fool for not catching that, I don't even use static in my other two event handlers so I have no clue why I put that. I know about the biomes thing, I had originally left it there so a fellow modder would be able to prevent my ore generation automatically and load the equivalent ores for his mod - if I'm using DWQ then he can't do that and the user would have to disable and enable via config. But, if it's that bad, I'll fix it. Anything else you spot that I should fix while we're at it?
  16. I am trying to add Capabilities to certain Entities so that once I have run them through my mod's re-arming process (just changing their armors and weapons to modded ones) during EntityJoinWorldEvent, the mobs get tagged as being re-armed and no longer are subjected to the process when exiting and then rejoining the world. When I load a world, I get a bunch of IllegalStateExceptions in the log as they are thrown in EntityJoinWorldEvent when the capability is not successfully gotten at each getCapability line in the class handling EntityJoinWorldEvent. Here is my ReArmerProvider class: https://pastebin.com/pTb42dFJ Here is my MobEquipEvent class where EntityJoinWorldEvent is handled: https://pastebin.com/icDh8mYp Here is my CapabilityHandler class: https://pastebin.com/QufN6Czb Here is my main class, where I assume I am properly registering CapabilityHandler (look for "<=== RIGHT HERE"): https://pastebin.com/xB2jZQzR Do let me know if you need to see any other of my capability-related classes.
  17. So, disabling anything in my event class involving local difficulty lets the world actually load, and mobs do spawn with at least their new modded weapons (including Pigmen & Wither Skeletons!). So I guess I have to re-implement the arming system to work without difficulty as I just ripped it right out of vanilla code, vanilla code is very finnicky.
  18. Okay so logging zombie.toString (event.getEntity.toString) works logging event.getWorld.toString works logging event.getWorld.getDifficultyForLocation(zombie.getPosition).toString does not work it seems
  19. So I noticed this when debugging and attempting to load a world and failing to do so (before, when I said it was letting me load in, I didn't actually change SpecialSpawn to EntityJoinWorldEvent yet...yeah lol): I can print to the logger zombie.toString() and get the ZombieEntity from the EntityJoinWorldEvent. I then try to print to the logger event.getWorld().getDifficultyForLocation(zombie.getPosition()).toString(), followed by a print to logger statement of ("Got past the previous line). Neither of those lines print while the world is initially trying to load. I assume that I should not be messing with getting the world or the difficulty if the actual world hasn't even been loaded?
  20. I don't exactly know how to do that. Would you mind pointing me in the right direction, if not outright giving me an example?
  21. So while debugging I actually ran a previously created world and actually loaded in (maybe I'm just impatient?) but yeah the for loops were executing constantly and I can see why it would slow down world loading. When you say an Entity loaded from disk will have it's equipment changed, you mean when I go back into an old world, mobs with modded armor will go through the arming process again? If that's the case then should I just check to see if a mob is at least wearing a single Armor item that is from my mod (so, just check if the boots are modded since that seems to appear for all armored mobs). Likewise, for the Wither Skeletons and Pigmen, just check to see if their mainhand is already modded.
  22. Gonna give it try, but quick question: Would all those for loops I have to clear a mob's equipment in the event class potentially cause runtime issues due to having to run the loop for each spawned mob?
  23. I hate to sound like a noob but how do I run with a breakpoint set (I know how to set one at least) to see what is happening? I'm in IntelliJ
  24. I figured that was the case. If I use EntityJoinWorldEvent while keeping everything the same, while it does work 100% for new worlds, I can't load old worlds (stuck at 100% loading screen) and I believe I also can't load back into the new worlds that were just created with EntityJoinWorldEvent (same stuck at 100% issue).
×
×
  • Create New...

Important Information

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