Gas Lift ignores restrictions when breaking blocks
TeamSpen210 opened this issue · 13 comments
Minecraft Version
1.12.2
Forge Version
14.23.2.2618
Mod Version
1.12.2-0.4.1-142
Describe your problem, including steps to reproduce it
When the Gas Lift extends, it breaks blocks before adding a pipe. Despite TileEntityGasLift.isUnbreakable()
being called (I don't think any hardnesses are actually < 0
?), any block will be broken (although it never drops anything). Specifically I tested:
minecraft:end_portal
(The portal itself)minecraft:end_gateway
(Newish portals which teleport you to the outer End islands).minecraft:end_portal_frame
(The ring frames around the stronghold portals)minecraft:portal
(Nether portals, this causes a crash)minecraft:bedrock
All of these of course should be indestructible by normal means. I do think it shouldn't be breaking blocks anyway - it's just a pipe. It might make more sense to restrict it to only liquid blocks, air, and "replaceable" blocks like tall grass.
Interesting. Block#setBlockUnbreakable()
actually does set the hardness of the block to -1 (and Block#isUnbreakable()
just tests if the hardness is < 0, but it's a private method).
I'll do some testing when I get a chance and see what's actually happening. You're right that those blocks should not be breakable. However, it's always been intended behaviour that the gas lift pipe drills its way downward, breaking blocks on the way.
Vanilla sets them to 18,000,000. It probably shouldn't break high-strength stuff like obsidian either, considering it's made of just pipes, compressed iron and glass. Another use of it off the top of my head is tunneling through ocean monuments, bypassing the mining fatigue effect. (Although most quarries would do that too, but those are rather more expensive.)
Nope, vanilla definitely sets the hardness of unbreakable blocks to -1 (hardness and blast resistance are two different things). Anyway, I've found the problem - nothing to do with the hardness; just had an arithmetic error which meant it was checking the block above instead.
As for stuff like obsidian, I had a thought on that: right now, breaking any block costs 100 air from the Gas Lift's pressure. How about if that were changed to 66 * block.getBlockHardness()
, based on stone having a hardness of 1.5. So stone would be about the same cost to dig, soft blocks like sand/gravel/dirt would be cheaper, but obsidian would cost 3300 air to break.
Note that the Gas Lift only has 3000 air 3000*pressure air by default, so breaking obsidian would need either a Volume Upgrade, or...
The Gas Lift could also allow the use of Advanced Pressure Tubes, which would halve the pressure cost (obsidian would "only" cost 1650). Nice trade-off for more expensive tubes?
As for ocean monuments, I guess we could blacklist the various prismarine blocks (probably via a config setting?)
As an alternative/in addition to that, maybe you could make it only permit blocks Iron Pickaxes can mine? That would cover most things you'd find in the way, while blocking 'stronger' materials. I'm not really sure if anything should be even done about prismarine; is it your intent to make this useful for drilling holes, or primarily for just getting liquids?
The primary intention is for pumping liquids; drilling holes is mostly a side-effect (but it's still part of the behaviour of the block). I'm not sure being able to break obsidian is really a problem; the obsidian isn't dropped, so it's not a "cheap" way of getting obsidian (there are far cheaper ways with mods to do it - most block breakers, for example).
I've pushed a couple of changes:
- Gas lift can no longer break unbreakable blocks (GUI also reports this)
- Gas lift air usage when breaking blocks is proportional to block hardness (stone is same as before, dirt/sand/gravel is cheaper, obsidian is much more expensive)
- Advanced pressure tubes can also be used, and require half the air to break blocks
A couple of other things sprung to mind (which I haven't added yet):
- Gas lift should possibly not break tile entities by default (configurable?)
- Gas lift should respect block protection when breaking blocks (grief prevention) - can fire a
BlockEvent.BreakEvent
but need a fake player for that
You can test this out with build 155+ from http://jenkins.k-4u.nl/job/PneumaticCraft-Repressurized/
Whether or not the Gas Lift should break blocks is mainly a gameplay vs realism compromise: Yes, it is realistic not to break any blocks, but the whole point is to easily retrieve oil from the deeper parts of the world after having located it with the Seismic Sensor. Having to dig the hole manually would be a nuisance. Therefore we lean towards the better gameplay option.
The Gas Lift not dropping the blocks is an intentional balancing mechanic in this. I don't mind it breaking any blocks like obsidian, as that is not an exploit as far as I can see. The breaking of unbreakable stuff obviously is nót good :P
Maybe, when drilling the pipes could be placed camoflaged with the block that was formerly present - making it look like it's drilling through the center. Then retracting would reverse that. It might be a good idea to set a flag in the pipes so breaking them doesn't drop the blocks, just setting the state to the original block. That would solve any sorts of exploits, since then you just get back the original state. If the block isn't eligable for camo (non-cubic etc) just break it.
I discussed this with @MineMaarten and we agreed that isn't something we really want to be adding; it just doesn't really feel necessary, sorry.