IC2 Classic

IC2 Classic

2M Downloads

Mining Laser causes problems with Reasonable Realism Hard Ores

Erik3003 opened this issue ยท 17 comments

commented

I've been toying around with Reasonable Realism and found out that you can get infinite ores by shooting hard ores with a mining laser. When shot, the ore drops the expected amount of ore (if you would fully mine it) but doesn't break or "lose value". It eventually breaks completely or loses value if you shoot it from certain angles, shoot it long enough or when it has a certain value. The laser beam doesn't pass threw the block.
It's one of the most inconsistent bugs I have ever seen and therefore must rely on multiple problems.
Reasonable Realism: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2451299-reasonable-realism-its-a-pack-its-a-mod-it-makes
CustomOreGen (requirement for RR): http://minecraft.curseforge.com/projects/customoregen/files/2264037
COG fix for IC2 Classic (you have to apply this fix manually, its just a change to the config file in the mod jar): lawremi/CustomOreGen#100

commented

hmmmm well i am in a weird situation here.
1: IC2 Classic is now in the middle of the update to 1.9
2: My dev invioment is partly not usable anymore (for 1.7.10 but that is not a problem)
3: I actually do not know what is causing that.
4: And i do not know how to fix that...
I checked the unreadable sourcecode of the mod and i am not sure how they handle that.
IC2 Has a miningLaser API. Maybe that would help solving the problem with harder ores.
(Not saying that i do not want fix that bug but i am unsure how and how crictical it is, only that i think that maybe he can fix that bug easier then i can do... Unless you give me a way of fixing it easy and fast (because all that time goes away from the update to 1.9)

commented

I maybe have a workaround: Just check if the block you are about to break has been broken in the last collision (by storing the coordinates after triggering the break event and comparing the stored data to the data of the block about to break before the break event) and if it has, don't break it, just replace it with air (you might need to check if the block is breakable, that bedrock doesn't get destroyed).
This isn't the proper way to do it, but it's easy to implement and will work (if the laser works how I think it does...)

commented

@Erik3003 well thats the thing its setting the block to air and also its fireing the BlockBreak event from forge to validate its actions. If the modowner wants to cancel that the block can be mined from a mininglaser then it will not mine it. It will even stop the laser at that point...
So the system you request is already there. Its asking the block: Hey can i break you? if yes then its asking the fired event: Hey do this drop throw drops? Yes. Then it will call DropItems and after that it will set the block to air.
The thing here is: I can not check that data what you suggest. Could you inivte the mod dev of it?
He could prevent with the laser event that the mininglaser will mine it or drop its content or whatever of it.

commented

I checked on the RR wiki and it states, that it added support for the IC2 mining laser. Therfore the bug can't really be on your side, it's probatly because your and IC2 exps laser apis differ.

commented

@Erik3003 well its using the LaserAPI from IC2Exp. Its just weird... We will see...

commented

I have been linked to this issue.
It's been a LONG time since I wrote the code to handle the mining laser and at the time things worked fine. It actually was quite a pain getting around the "set block to air, then fire the break event" problem, but what's supposed to happen is that the API-laser-event is supposed to eat power off the laser pulse equivalent to a number of breaks and then drop the resulting number of ore chunks.

Here's the readable event handler, with some comments. http://pastebin.com/BVi8TtqT

commented

@Draco18s well you forgot 1 thing: Just set this thing to false and your block will be not tuched by the Mining laser (it could happen that it will get hit more then once keep that in mind (unless it runs out of power))
removeBlock = false
then it will skip the dropping and setBlockToAir logic completly just remove the blocks to destroy count goes down.
Edit i missed that you did that already.
1 thing you really should do is no matter what dissable the drops from the laser because that gets called when the laser is strong enough to go through the block... and remove all metadata

commented

It can't get touched more than once by the same laser: either all the power gets used trying to break it (while loop on 218-219) or it gets broken (220). In the first case, the last had no remaining power and dies (no more hits) in the second, my block is removed (no more hits).

removeBlock = false on line 225 is correct: not enough power to completely mine the block, note that the meta value is set to the decremented value.

So, again, what is wrong, because it wasn't that. I tested the hell out of this event when I wrote it, I tested it against lines on my block at various meta values and all the laser settings.

commented

@Draco18s you did not see my edit: Dissable the drops and it should be fixed. Because if the laser is strong enough to get through the block it will still call dropItems... And i think thats causing it
Also you need to make sure that 1 Power call stays because after the event is called he is draining power for once and then delete the block (if the power is bigger then 0)...
I think that could cause it...

commented

I did not see the edit. Will be able to dip this on the morning.

commented

ok no problem. I try to assist

commented

RC build, let me know if you notice a problem in the next couple hours.
https://dl.dropboxusercontent.com/u/7950499/1.7.10-ReasonableRealism-13.24.0aaaaa.jar

commented

@Erik3003 i think thats your turn to test it fast. I will try it tomorrow.

commented

Sure thing. One only knows their own mod best.
I've got another problem I'll try and fix up today as well, its a larger issue that I've been putting off.

commented

I tested and it's fixed! Ores now work as expected and give the proper amount of ore.
Thanks Speiger and Draco for the quick fix (and your awesome mods).

commented

@Erik3003 i did nothing on that one. All Thanks to @Draco18s

commented

Cool. The other issue I had was much more elusive, so look for an official release soon.