Jump to content

MrChoke

Members
  • Posts

    86
  • Joined

  • Last visited

Everything posted by MrChoke

  1. This is a limitation with Forge that I am seeing. The "canEntitySpawn" hook has not been placed when entities are summoned via command or when the spawn egg is used. This means that we cannot apply changes to the entities for these types of spawns. Do I need to purse a pull request to fix this or am I missing something on how this is used?
  2. My next thing to learn/do is to see if I can alter mobs ability to break doors. immediately I find a horrible Mojang bug that I can't believe stayed out there for 3 releases: https://bugs.mojang.com/browse/MC-102896 Sure enough between 1.9 and right now, 1.12.x, mobs will not go through doors to pursue the player. And that also means they won't break them either. In 1.13 it is fixed. Not that that helps me now. One thing I am struggling with is understanding why it's not working. I have determined this: 1) EntityAIBreakDoors:shouldExecute always returns false (I was able to add this task to all zombies not just the 5%). It returns false each time because of a check in its parent: EntityAIDoorInteract.shouldExecute(): if (!this.entity.collidedHorizontally) { return false; } This very important variable, collidedHorizontally, used all over the place is FALSE every time this executes. And what I find even more interesting is how another child AI of EntityAIDoorInteract, EntityAIOpenDoor works!! That is used by the villages to open and close doors. That same super.shouldExecute() check comes back TRUE for them and the AI works. Also, blowing my mind even more is if I spawn a villager in a building and spawn zombies outside, they have no trouble at all pathfinding through the door and killing the villager! NOTE, they still won't break closed doors though (for that AI collideHorizontal is still false) Lastly, when I am in creative mode and I let zombies walk around, they do seem to move through doors occasionally. So I don't get it. I started diving into move code, collisonBox code, path finding code. My head hurts. I know Forge has some event handlers that I'd like to use if I could. Most encouraging is GetCollisonBoxesEvent. But how can I use them if I don't understand what Mojang did wrong that broke this in the first place?
  3. OMG, it was that easy! Why did I not think to rename the exact zombie filenames in vanilla???? assets\minecraft\sounds\mob\zombie\hurt1.ogg and hurt2.ogg It works as a a pack and directly in my mod. Thanks for your help.
  4. I would love to use simply a resource pack. I could not get it to work. As simply a pack file I put in run/resourcepacks for my mod, it does work in that it appends my sounds to the default ones. It does not overwrite. When trying to add my sounds and a sounds.json file directly into the mod, I couldn't get anything to work. Ok, I agree, adding an event for playSound will probably work and long term I will probably do that, fine. But please, if you think simply using .ogg files and sounds.json can work, please let me know.... I think you will find at best you append sounds, not replace.
  5. UPDATE: I got it to work! I used reflection and changed the domain of the default sounds to my mod: Collection<SoundEvent> coll = reg.getValuesCollection(); Iterator<SoundEvent> iter = coll.iterator(); while(iter.hasNext()) { SoundEvent se = iter.next(); if(se.getSoundName().toString().equals("minecraft:entity.zombie.hurt")) { Field fld = SoundEvent.class.getDeclaredField("soundName"); fld.setAccessible(true); ResourceLocation resLoc = (ResourceLocation) fld.get(se); Field fld2 = ResourceLocation.class.getDeclaredField("resourceDomain"); fld2.setAccessible(true); fld2.set(resLoc, TestMod1.MODID); } }
  6. I tried this at first and I couldn't get it to work. I was able to create an actual resource pack and put it in run/resourcepacks. That ended up working the exact same as what I am seeing now. The new sounds were added to the existing ones. If you aware of a way I can override them with a resource pack that would be great.
  7. So I was going to look into that after I give up on this. However, is my understanding correct in that this is a way to override the sound being played right before it is actually played? Meaning the initial load of the default sounds is still there. And this override logic executes for every sound. Seems like that is not an ideal approach... Hence my forming opinion for Forge... But I will admit, I am very new to it still.
  8. What I mean is the default "zombie hurt" sound effects. So I added two of my own but the two that come with the game also play. I assume it chooses one of the four randomly each time it plays. I have been deep diving into the forge stuff so much to figure this out. Number 1) We are not allowed to remove entries from a ForgeRegistry (I even tried hacking it by using reflection but it just blew up later complaining about missing keys). So I cannot remove the initial two sounds. My next attempt now is a long shot and that is to somehow override the contents of the default ones with my own. But I am lost in trying to understand how the SoundEvent is processed right now. My overall opinion of Forge so far is this: It is great for adding new content. It is not good at all for overriding default behaviors.
  9. Ok, I figured it out. I behaves like a resource pack though in that the new sounds are added to the default ones. Is there a way to only get the new ones?
  10. What I want to do seems so simple to me but I cannot get it to work. All I want to do is override some of the default zombie sounds with a few of my own. As usual I find tons of examples on how to create custom sounds and play them with playSound() or attach to a new custom entity. But I want to override a default sound. Can't this easily be done? Example, in the vanilla sounds.json, it has this: "entity.zombie.hurt": { "sounds": [ "mob/zombie/hurt1", "mob/zombie/hurt2" ], "subtitle": "subtitles.entity.zombie.hurt" }, I have my sounds.json file in my mod folder (or outside, I've tried many things). And my .ogg files of those names in a "sounds" subdirectory. { "entity.zombie.hurt": { "sounds": [ "dumbhurt1", "dumbhurt2" ], "subtitle": "subtitles.entity.zombie.hurt" } } The closest I get to anything working are these messages in the console: 19:18:52] [main/WARN] [minecraft/SoundHandler]: File minecraft:sounds/dumbhurt1.ogg does not exist, cannot add it to event testmod1:entity.zombie.hurt [19:18:52] [main/WARN] [minecraft/SoundHandler]: File minecraft:sounds/dumbhurt2.ogg does not exist, cannot add it to event testmod1:entity.zombie.hurt So I don't get it. Can someone help me do this?
  11. Ok, I finally did this right. I have a pull request for 1.12 with my change: https://github.com/MinecraftForge/MinecraftForge/pull/5150 Does anybody know what comes next? I assume it needs to get approved?
  12. Oh. I guess that makes sense since I was getting much further with 1.12. I thought since there is a 1.13-pre that people can start submitting changes to it. I'll go back to 1.12x and go from there. Thanks.
  13. OK... I completely started over. I realized everything I was doing was off of the 1.12 default branch which I don't want. I want 1.13.-pre. I wiped everything related to this off my PC. I went into GIT and even blew away my repo there as well. I followed the readme line-by-line this time, starting with re-doing the fork to my own repo (and choosing 1.13-pre as the default for it this time). Then cloning to a brand new folder on my PC. I followed the IntelliJ section, yes the text and got to where I opened "build.gradle" as a project. It started to build and failed. It didn't get as far as last time when I was going off of 1.12x. I got this exception when it was trying to configure the project: Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find any version that matches net.minecraftforge.gradle:ForgeGradle:3.+. I attached a screenshot. I changed nothing. I pulled whatever was in 1.13-pre branch.
  14. Well going back, looks like I missed the link to the video for IntelliJ that would have helped. I need to take a Gradle/Git tutorial or something as well.
  15. I do have an IDE, IntelliJ. And I did not execute "gradlew setupForge". Why? Because the readme you told me to read had that step under the ECLIPSE section, not the IntelliJ section. Maybe you have been living and breathing Forge and Gradle for years but I haven't. If the doco is not correct, guess what? I start asking questions. After running that command with IntelliJ, yes I have the forge sub-project now and it has "net.minecraft" in it.
  16. Ok, I did read this. Can you explain what that means? If I am looking at the pulled code for Forge in my IDE (IntelliJ), where is the "net.minecraft" source? I am missing this.... Thanks
  17. I followed that and have the workspace installed on my machine. Do you? Do you notice that the only source in it is "net.minecraftforge"? Where is "net.minecraft" at????
  18. UPDATE: So I did a pull request for this issue. However github would not let me create one for 1.13pre!! I don't know why. My pull request says I want to pull 1.13 into 1.12x. SIgh. https://github.com/MinecraftForge/MinecraftForge/pull/5148 UPDATE 2: I got git and github desktop installed, forked and pulled the 1.12x Forge codebase. OK but this does nothing to fix the bug. What I got is the "net.minecraftforge" source but the bug is in Forge's hook placement in "net.minecraft.entity.EntityLiving". Modification of this code is required. How do I get that?
  19. That's for the reply. YES, that is the exact issue I am reporting here. I realize that I can modify idleTime to slow or stop despawning (within 128 blocks anyway) but its the distances in the default code that we do not get to control. So I can re-activate that issue or create a new one but I see in the current one only the original poster and you replied. Are you on the Forge team? The fix is easy, simply remove this check: (this.idleTime & 0x1F) == 0x1F I agree it was done for performance to allow slow complicated despawn handlers to run and not kill the game that much. But more important is allowing the ability to truly override the default behavior, which it is not doing. So IMO it's a bug. Anyway I'll create an issue and see what happens. Thanks.
  20. idleTIme can and will increase unless something resets it, like the mob getting attacked for example. And of course if you return DENY when the event handler is called. I get that but what if I wanted to modify the behavior coming from the exact line you specify if (this.canDespawn() && d3 > 16384.0D) That's the the 128 blocks away rule. If I try to return DENY for a greater distance to keep the mob around, I can't. As soon ans the default code executes it will despawn. The rule I hate more is this one: if (this.idleTime > 600 && this.rand.nextInt(800) == 0 && d3 > 1024.0D && this.canDespawn()) What if I wanted the despawn check to start after 60 seconds instead of the 30 seconds this line above has? Again, as soon as I try to extend this with my every 32nd tick, DENY, the default code will despawn him anyway. What is a "PULL REQUEST"? Can you explain?
  21. The 1st line you copied, in the forge-event section, called when it returns ALLOW or DENY doesn't matter. You showing part of the default-behavior ELSE is also missing the point. The forge-event itself AND the handling after is only called on the 32nd tick. If we want to override the default behavior with an event handler then we need to handle it on EVERY TICK. Again, this is the line that has the issue: else if ((this.idleTime & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) You know Java well right? You understand that ONLY if the below evaluates to TRUE: (this.idleTime & 0x1F) == 0x1F Will it ever call the forge event handler. An "&&" doesn't even evaluate the 2nd argument once the 1st is FALSE. And that's it. That's all that matters. The above condition is a logical AND. It's only true on the 32nd tick of any group of 32 ticks. Can someone else please comment on this post? We need another person to deny or agree with the behavior I am saying. And I still have this question: If forge itself has a bug (like above), how can I report it? Thanks.
  22. No, I am sorry but you are not correct. EntityLiving#despawnEntity() is called every tick. And the code below is such that the default spawn behavior (the ELSE) is called for every tick except the 32nd one and only then is the forge event called: if (this.persistenceRequired) { this.idleTime = 0; } else if ((this.idleTime & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) { if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) { this.idleTime = 0; } else { this.setDead(); } } else { Entity entity = this.world.getClosestPlayerToEntity(this, -1.0D); if (entity != null) { double d0 = entity.posX - this.posX; double d1 = entity.posY - this.posY; double d2 = entity.posZ - this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (this.canDespawn() && d3 > 16384.0D) { this.setDead(); } if (this.idleTime > 600 && this.rand.nextInt(800) == 0 && d3 > 1024.0D && this.canDespawn()) { this.setDead(); } else if (d3 < 1024.0D) { this.idleTime = 0; } } } The forge event is not called enough to be useful in anyway. In addition, I didn't check the non-forge vanilla minecraft code yet but if Mojang's intent was to have despawning occur every 32nd tick, then Forge created a bug here where despawning can happen ALL but every 32nd tick. Who is Forge? Is there a group or bug report I can make? They really need to fix this for 1.13.
  23. Well, one of the main things I want to do with learning forge is see if I can override the default spawning behavior. Namely how far away a mob is before it despawns for example. I can't find a way to do it. And no handling a "LivingSpawnEvent.AllowDespawn" does not do it. And here is why: Class: net.minecraft.EntityLiving, line 791: else if ((this.idleTime & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT) As you can see the forge event handler is only called every 32nd tick. I can't modify how long a mob can stay around if all the rest of the ticks will fall into the default behavior!!!! The placement of this forge event is a failure. Is there another way to do this?
  24. Whenever I set a break point someplace in the code and it pauses for more than X number of seconds the client disconnects from the server. Note, I am running a local integrated server. Is there any way I can stop this or increase the time out? Thanks.
×
×
  • Create New...

Important Information

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