SleepyTrousers / EnderZoo

Creative Commons Zero v1.0 Universal
28 stars 28 forks source link

[1.9.4] Khndrel Keght spawning from Slimy Grass #138

Closed Mohron closed 7 years ago

Mohron commented 8 years ago

Version: EnderZoo-1.9.4-1.2.2.40 Tinkers': TConstruct-1.9.4-2.3.1.jenkins229.jar

Honestly not 100% sure what mod the problem lies in here but a Khndrel Keght can spawn from TiC Slimy Grass even when harvested with a shovel. In my tests, this does not occur with TiC slimey dirt, vanilla dirt or grass.

FYI @SlimeKnights

HenryLoenwind commented 8 years ago

It seems Slimy Grass is a kind of Grass (which makes sense) but the shovel doesn't recognize it as such (we ask the item if it can be used on the block). I'll have a look into the vanilla shovel code tonight.

Update: This changed in 1.8 or 1.9, now we need to ask the block about the tool.

Mohron commented 8 years ago

I our tests, we tried both Minecraft and TiC shovels. Both spawned the lovely slimes of death :)

HenryLoenwind commented 8 years ago

Yes, that's a bug in Tinkers. The BlockSlimeGrass doesn't have any harvest level set, so no tool is effective on it. And on the other hand it extends BlockGrass, so our code detects it as a kind of dirt. SlimeDirt on the other hand is not a kind of dirt (why? please!).

All it needs is setHarvestLevel("shovel", 0); in its constructor.

Mohron commented 8 years ago

Well Boni acted just like I've come to expect... Any other way to fix this without his help?

bonii-xx commented 8 years ago

(why? please!)

Grass has logic. Dirt doesn't.

HenryLoenwind commented 8 years ago

Maybe

if (block instanceof BlockSlimeGrass) {
    event.setCanceled(true);
    ChatHelper.toPlayer(event.getPlayer(), "Use an effective tool to break this!");
}

would help?

(just kidding, I'm not that evil...)

Mohron commented 8 years ago

It just makes slime islands especially dangerous places with EnderZoo installed. I guess something has to protect the coveted Kightslime material...

HenryLoenwind commented 8 years ago

Actually it's no problem. As those blocks have no effective tool anyway, they break as fast using your bare hands. And bare hands don't spawn Khndrel Keght.

Mohron commented 8 years ago

In my experience it certainly does... the version I'm using here does. Breaking dirt with you hand is scary.

HenryLoenwind commented 8 years ago

Then that's a bug. One that I'll stomp now.

Mohron commented 8 years ago

Honestly I thought that was a feature. After all, it forces you to use the proper tool (if such a thing exists)!

HenryLoenwind commented 8 years ago

It's a safeguard. If you'd manage to fall into a hole with no shovel on you, you'd be dead.

However, I just tried in a clean dev environment and nothing's spawning. So it may be a mod interaction. Any idea with which mod?

Mohron commented 8 years ago

Only dirt does it, not grass. if it's another mod, that would take a lot of testing to drill down. We found this issue while test our modpack Rebel Uprising.

Mohron commented 8 years ago

And if it makes any difference, I also experienced the hand-breaking=spawning behavior in 1.7.10

HenryLoenwind commented 8 years ago

No, doesn't happen with dirt here either. And it's a really funny thing because the only time either dirt or grass in mentioned in our code is:

    if (!(event.getState().getBlock() instanceof BlockDirt || event.getState().getBlock() instanceof BlockGrass)) {
      return;
    }    
HenryLoenwind commented 8 years ago

Can I send you a test version with some debug statements in it? That'd be the fasted way to find out what's happening...

Mohron commented 8 years ago

I think my friend just figured out what we've been doing wrong. We would start with a bare hand but after 1 piece of dirt, it was not longer bare... So it's my mistake, that works as intended.

Mohron commented 8 years ago

Anyway you can blacklist spawning on the slime blocks though, because telling players to not use a shovel on grass blocks isn't really a solution.

HenryLoenwind commented 8 years ago

Oops, that'd do it. That actually happened to me during my testing, too. I just dismissed it because it was so obvious...

HenryLoenwind commented 8 years ago

I'm a bit torn. On the one hand people don't expect it, on the other hand the slime grass has no effective tool on purpose. And then we'd have another list of modded blocks we'd have to maintain (major pain in Ender IO...).

Let me think about it for a day or so. Feel free to nag me on Monday if I forget. (commenting here will notify me)

Mohron commented 8 years ago

I already have a regrettable fix, because I don't want to be any trouble. It should have gotten changed on the TiC side imo. I can just disable Khndrel Keghts in my mod pack to remove the unwanted behavior.

Mohron commented 8 years ago

Instead of you having to maintain the blacklist, could a block blacklist be supported by the SpawnConfig_xxx.xml files?

HenryLoenwind commented 8 years ago

Doesn't make much difference whether it's in the xml, the config or hardcoded...

Mohron commented 8 years ago

I'm only asking for the capability. no default blacklist. Users/mod pack designers will be responsible for adding blocks if necessary. Ultimately, I don't want you feeling like I need you to add a feature that's not (easily) maintainable. I don't want that and neither do you.

HenryLoenwind commented 8 years ago

I think I found a better solution. As we are only working on dirt and grass blocks, we can just assume any shovel is effective, no matter what the block says. In fact, I would have implemented it that way instead of using the isEffective() check, but in 1.7.10 that call went to the tool which then checked if it wanted to be considered a shovel.

Mohron commented 8 years ago

I love it! Virtual High five to you :+1: