DevotedMC / RealisticBiomes

Minecraft plugin that limits plant growth and animal reproduction to their naturally occuring biomes, or reasonable ones for plants that do not occur naturally. Built for Spigot 1.10
http://www.devotedmc.com
1 stars 5 forks source link

Cacti and Sugarcane dupe #8

Open iNko97 opened 6 years ago

iNko97 commented 6 years ago

How to reproduce:

Note: Persistence is enabled on columns blocks

ProgrammerDan commented 6 years ago

That's a good one. I'm assuming if persistence is off, the problem is gone? If you have no way to test that, no worries.

On Tue, May 22, 2018, 10:55 iNko97 notifications@github.com wrote:

How to reproduce:

  • Plant sugarcane or cacti
  • Place a block to disallow the 3rd stage growth
  • Let it grow to the second stage.
  • Destroy the 2nd stage block
  • Right click the crop with a stick to make it regrow istantly, break and repeat

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DevotedMC/RealisticBiomes/issues/8, or mute the thread https://github.com/notifications/unsubscribe-auth/AAY-jrpLsAfscUY93El1Ac9plkWDzUlVks5t1CbhgaJpZM4UI0Jt .

iNko97 commented 6 years ago

Correct. With persistence off the problem is gone.

iNko97 commented 6 years ago

When it is called on the single block SugarCane that got setup in that way, the debug states the following (There is one additional log line I inserted for info). I think what happens is that the plugin does not know that the second stage sugar cane has been broken, so every time it gets checked forces it to grow another one?

[12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3} and is naturalGrowEvent? false
[12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 0.71510994
[12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINE] BlockGrower.growColumn(): stage 0
[12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINE] BlockGrower.growColumn(): block above is already SUGAR_CANE_BLOCK
[12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502542 growth: 0.71510994 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3} and is naturalGrowEvent? false
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 0.7151551
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINE] BlockGrower.growColumn(): stage 0
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502543 growth: 0.7151551 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate for sugar cane block at block CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3} is 4.520576131687244E-5
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate adjusted to 6.144742831133363
[12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): plant growth is: 0.7151551

Per comparison here is the log when called on a normal single plant that just got broke from the 3rd stage:


[12:15:18] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15} and is naturalGrowEvent? false
[12:15:18] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 8.3333335E-4
[12:15:18] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502518 growth: 8.3333335E-4 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null
[12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15} and is naturalGrowEvent? false
[12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 9.7222225E-4
[12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502519 growth: 9.7222225E-4 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null
[12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate for sugar cane block at block CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15} is 1.388888888888889E-4
[12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate adjusted to 2.0
[12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): plant growth is: 9.7222225E-4 ```
ProgrammerDan commented 6 years ago

Peak over at cropcontrol for why RB's handling here is doomed to fail. The upper parts are probably breaking via physics, which does some weird stuff for short periods of time. The net resolution is async, and this means RB's optimistically deterministic approach, if I recall correctly, won't work in all cases. Like this one.

I keep hoping I'll have motivation to tackle these and other issues. It will return someday, I know.

On Mon, May 28, 2018, 06:46 iNko97 notifications@github.com wrote:

When it is called on the single block SugarCane that got setup in that way, the logs state the following (There is one additional log line I inserted for info). What is weird is that growColumn reads the block above as sugar cane, but there should be none?

[12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3} and is naturalGrowEvent? false [12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 0.71510994 [12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINE] BlockGrower.growColumn(): stage 0 [12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINE] BlockGrower.growColumn(): block above is already SUGAR_CANE_BLOCK [12:15:42] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502542 growth: 0.71510994 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3} and is naturalGrowEvent? false [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 0.7151551 [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINE] BlockGrower.growColumn(): stage 0 [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502543 growth: 0.7151551 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate for sugar cane block at block CraftBlock{chunk=CraftChunk{x=-362z=341},x=-5781,y=63,z=5459,type=SUGAR_CANE_BLOCK,data=3} is 4.520576131687244E-5 [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate adjusted to 6.144742831133363 [12:15:43] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): plant growth is: 0.7151551 `

Per comparison here is the log when called on a normal single plant that just got broke from the 3rd stage:

[12:15:18] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15} and is naturalGrowEvent? false [12:15:18] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 8.3333335E-4 [12:15:18] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502518 growth: 8.3333335E-4 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null [12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] RealisticBiomes:growAndPersistBlock() called for block: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15} and is naturalGrowEvent? false [12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] BlockGrower.growColumn(): 9.7222225E-4 [12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] growAndPersistBlock chiamato con pianta: <Plant lastUpdateTime: 1527502519 growth: 9.7222225E-4 fruit: -1.0> Blocco: CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15}GrowthConfig: GrowthConfig.sugar cane block FruitBlockToIgnore: null DropGrouper: null [12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate for sugar cane block at block CraftBlock{chunk=CraftChunk{x=-362z=340},x=-5784,y=63,z=5454,type=SUGAR_CANE_BLOCK,data=15} is 1.388888888888889E-4 [12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): rate adjusted to 2.0 [12:15:19] [Server thread/INFO]: [RealisticBiomes] [FINER] PlayerListener.onPlayerInteractEvent(): plant growth is: 9.7222225E-4

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DevotedMC/RealisticBiomes/issues/8#issuecomment-392490917, or mute the thread https://github.com/notifications/unsubscribe-auth/AAY-jnt9IIQwrtGQrHfXR2Prd2tBNpkCks5t29WRgaJpZM4UI0Jt .

iNko97 commented 6 years ago

For future reference: what I think happens: 1) Column block at 1/2 maturation time grows to second stage (Either naturally or forcefully) 2) If a player breaks the second column block before the third has grown, RB does not do anything about it (onBlockBreak event is fired but it does not change maturation time) 3) Column block is actually broken and maturation time for sugarcane is not reset (or subtracted .5 the whole duration). 5) Calling with a stick the growAndPersist method makes it grow to the second stage, since the timer is beyond 1/2 duration but not 3rd stage yet. 6) As soon as the column reaches third stage, the dupe is no longer possible with this plant. Must replant and wait for stage 1).

I fixed it temporarily by making the whole thing grow directly to the third stage, skipping any growcolumn events before the whole plant is grown. Not the best approach by not the best developer with not the best amount of time