Add Travel Anchor and Staff of Travelling #103

Merged
dphaldes merged 36 commits from dev/travel-staff into dev/1.20.1 2023-08-11 00:12:32 +00:00
dphaldes commented 2023-01-16 15:55:07 +00:00 (Migrated from github.com)

Co-authored-by: agnor99 36055315+agnor99@users.noreply.github.com

Description

Supersedes #18

Added Staff of Travelling
Added TeleportationTargetSystem using WorldSavedData (can be moved to capability, if wanted, but WorldSavedData is imo the better approach for this)
TravelRegistry allowing Mods to add their own TravelTargets without a dependency on machines
Every Travel Target defines how it renders

Todo

  • GUI of Travel Anchor
  • Security System will be implemented in a future PR
  • Rendering for TravelTarget
  • expose teleport calls to API
  • fix staff rf issues
  • check config values
  • refactor names

Checklist:

  • My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
Co-authored-by: agnor99 <36055315+agnor99@users.noreply.github.com> # Description Supersedes #18 > Added Staff of Travelling > Added TeleportationTargetSystem using WorldSavedData (can be moved to capability, if wanted, but WorldSavedData is imo the better approach for this) > TravelRegistry allowing Mods to add their own TravelTargets without a dependency on machines > Every Travel Target defines how it renders > # Todo - [x] GUI of Travel Anchor - [x] ~~Security System~~ will be implemented in a future PR - [x] Rendering for TravelTarget - [x] expose teleport calls to API - [x] fix staff rf issues - [x] check config values - [x] refactor names # Checklist: - [x] My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you) - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation
justliliandev (Migrated from github.com) reviewed 2023-01-16 15:55:07 +00:00
Rover656 commented 2023-03-31 13:31:53 +00:00 (Migrated from github.com)

Do you reckon you will manage to finish this before the 1.19.4 merge? I know you're currently occupied by #108. If not I'd be happy to help you bring this back up to speed once #116 is merged :)

Do you reckon you will manage to finish this before the 1.19.4 merge? I know you're currently occupied by #108. If not I'd be happy to help you bring this back up to speed once #116 is merged :)
justliliandev (Migrated from github.com) reviewed 2023-08-09 00:07:45 +00:00
@ -0,0 +1,21 @@
package com.enderio.api.travel;
justliliandev (Migrated from github.com) commented 2023-08-08 22:45:44 +00:00

tbh, not really needed, api is still in alpha and we will probably go over it all before we release a beta

tbh, not really needed, api is still in alpha and we will probably go over it all before we release a beta
@ -0,0 +1,62 @@
package com.enderio.machines.common.block;
justliliandev (Migrated from github.com) commented 2023-08-08 23:06:01 +00:00

is this todo still accurate?

is this todo still accurate?
justliliandev (Migrated from github.com) commented 2023-08-08 23:06:11 +00:00

is this todo still accurate

is this todo still accurate
justliliandev (Migrated from github.com) commented 2023-08-08 23:07:12 +00:00

a helper for this sneakcache to hide the complexity of the condition behind a nice method name would be nice

a helper for this sneakcache to hide the complexity of the condition behind a nice method name would be nice
justliliandev (Migrated from github.com) commented 2023-08-08 23:08:06 +00:00

don't set the field type to weakhashmap, impl detail isn't important here, maybe have a better record instead of this pair would be nice for better documentation of what both fields do

don't set the field type to weakhashmap, impl detail isn't important here, maybe have a better record instead of this pair would be nice for better documentation of what both fields do
@ -0,0 +1,131 @@
package com.enderio.machines.common.blockentity;
justliliandev (Migrated from github.com) commented 2023-08-08 23:12:08 +00:00

is this visibility correct?

is this visibility correct?
justliliandev (Migrated from github.com) commented 2023-08-08 23:17:33 +00:00

don't inline this one method call, this shouldn't have to be called from TravelAnchorBlock#onRemove, as both will do that

don't inline this one method call, this shouldn't have to be called from TravelAnchorBlock#onRemove, as both will do that
@ -0,0 +1,116 @@
package com.enderio.machines.common.travel;
justliliandev (Migrated from github.com) commented 2023-08-08 23:37:04 +00:00

use CoreNBTKeys and other static final String fields so you don't repeat the same Strings everywhere

use CoreNBTKeys and other static final String fields so you don't repeat the same Strings everywhere
@ -7,2 +7,3 @@
"core": "enderio:block/vacuum_portal"
"core": "enderio:block/vacuum_portal",
"particle": "enderio:block/machine_side"
},
justliliandev (Migrated from github.com) commented 2023-08-08 23:38:08 +00:00

fix spacing

fix spacing
@ -70,2 +68,4 @@
// event.register(EIOItems.DARK_STEEL_AXE.get(), EnergyBarDecorator.INSTANCE);
// event.register(EIOItems.DARK_STEEL_PICKAXE.get(), EnergyBarDecorator.INSTANCE);
// Register all glass blocks
justliliandev (Migrated from github.com) commented 2023-08-08 23:39:26 +00:00

remove these lines all together if you want to change them

remove these lines all together if you want to change them
@ -0,0 +1,50 @@
package com.enderio.base.client.renderer.travel;
justliliandev (Migrated from github.com) commented 2023-08-08 23:49:01 +00:00

make 25 a public static final field and call it something like MIN_TELEPORTATION_DISTANCE_SQUARED in TravelHandler

make 25 a public static final field and call it something like MIN_TELEPORTATION_DISTANCE_SQUARED in TravelHandler
justliliandev (Migrated from github.com) commented 2023-08-08 23:52:33 +00:00

maybe make this field nullable, and resolve the optional with orElse(null), so comparisons later are nicer

maybe make this field nullable, and resolve the optional with orElse(null), so comparisons later are nicer
@ -0,0 +1,64 @@
package com.enderio.base.client.renderer.travel;
justliliandev (Migrated from github.com) commented 2023-08-08 23:55:58 +00:00

reorder checks so that TravelHandler#canItemTeleport is called last as that might be the slowest operation

reorder checks so that TravelHandler#canItemTeleport is called last as that might be the slowest operation
justliliandev (Migrated from github.com) commented 2023-08-08 23:56:37 +00:00

directly call ifPresent on this optional

directly call ifPresent on this optional
@ -0,0 +1,169 @@
package com.enderio.base.common.handler;
justliliandev (Migrated from github.com) commented 2023-08-08 23:58:35 +00:00

this one should be private

this one should be private
justliliandev (Migrated from github.com) commented 2023-08-08 23:59:59 +00:00

make the 25 a public static final field and use it in the RenderTravelTargets, as soon as you do this, remove comment as then it becomes obvious

make the 25 a public static final field and use it in the RenderTravelTargets, as soon as you do this, remove comment as then it becomes obvious
@ -128,3 +128,3 @@
public static final ItemEntry<MaterialItem> POWDERED_GOLD = materialItem("powdered_gold").tag(EIOTags.Items.DUSTS_GOLD).register();
public static final ItemEntry<MaterialItem> POWDERED_COPPER = materialItem("powdered_copper").tag(EIOTags.Items.DUSTS_COPPER).register();
public static final ItemEntry<MaterialItem> POWDERED_TIN = materialItem("powdered_tin").tag(EIOTags.Items.DUSTS_TIN).register(); // TODO: hide if tin isn't present
public static final ItemEntry<MaterialItem> POWDERED_TIN = materialItem("powdered_tin")
justliliandev (Migrated from github.com) commented 2023-08-09 00:04:11 +00:00

undo this massive formatting change

undo this massive formatting change
@ -22,6 +23,7 @@ public class EmpoweredUpgrade extends TieredUpgrade<EmpoweredUpgradeTier> {
justliliandev (Migrated from github.com) commented 2023-08-09 00:04:50 +00:00

nullable on line before the field declaration

nullable on line before the field declaration
justliliandev commented 2023-08-09 12:58:16 +00:00 (Migrated from github.com)

functional wise this works, once the requested changes have been made this can be merged

functional wise this works, once the requested changes have been made this can be merged
dphaldes (Migrated from github.com) reviewed 2023-08-09 13:12:58 +00:00
@ -0,0 +1,62 @@
package com.enderio.machines.common.block;
dphaldes (Migrated from github.com) commented 2023-08-09 13:12:58 +00:00

I don't remember why I added that. Removing it

I don't remember why I added that. Removing it
dphaldes (Migrated from github.com) reviewed 2023-08-09 14:14:42 +00:00
@ -0,0 +1,62 @@
package com.enderio.machines.common.block;
dphaldes (Migrated from github.com) commented 2023-08-09 14:14:42 +00:00

Correct me if I am wrong (since this is not my code, carried over from your old PR), This piece of code maintains a sneak cache to ensure that teleport only happens on button down (not on pressed/released). Right ?

Correct me if I am wrong (since this is not my code, carried over from your old PR), This piece of code maintains a sneak cache to ensure that teleport only happens on button down (not on pressed/released). Right ?
dphaldes (Migrated from github.com) reviewed 2023-08-09 14:25:53 +00:00
@ -7,2 +7,3 @@
"core": "enderio:block/vacuum_portal"
"core": "enderio:block/vacuum_portal",
"particle": "enderio:block/machine_side"
},
dphaldes (Migrated from github.com) commented 2023-08-09 14:25:52 +00:00

That looks like a github issue. the file on my side/branch looks fine to me

That looks like a github issue. the file on my side/branch looks fine to me
justliliandev (Migrated from github.com) reviewed 2023-08-09 14:31:28 +00:00
@ -0,0 +1,62 @@
package com.enderio.machines.common.block;
justliliandev (Migrated from github.com) commented 2023-08-09 14:31:27 +00:00

it's stores the last time the player was found above a travel anchor and if the player was sneaking and this ensures, that the teleport happens on sneak down, not when continously sneaking or when teleporting from a travel anchor to another travelanchor, so that the second anchor doesn't try to teleport again

it's stores the last time the player was found above a travel anchor and if the player was sneaking and this ensures, that the teleport happens on sneak down, not when continously sneaking or when teleporting from a travel anchor to another travelanchor, so that the second anchor doesn't try to teleport again
dphaldes (Migrated from github.com) reviewed 2023-08-09 14:39:39 +00:00
@ -22,6 +23,7 @@ public class EmpoweredUpgrade extends TieredUpgrade<EmpoweredUpgradeTier> {
dphaldes (Migrated from github.com) commented 2023-08-09 14:39:39 +00:00

This file is not a part of my PR. I have not touched it at all. The field is nullable on my side. Probably a residue of so many Merges

This file is not a part of my PR. I have not touched it at all. The field is nullable on my side. Probably a residue of so many Merges
dphaldes (Migrated from github.com) reviewed 2023-08-09 14:42:41 +00:00
@ -22,6 +23,7 @@ public class EmpoweredUpgrade extends TieredUpgrade<EmpoweredUpgradeTier> {
dphaldes (Migrated from github.com) commented 2023-08-09 14:42:40 +00:00

Nevermind. I don't remember editing that file ever but it does have changes from my side (its a change from 7 months ago lol ). I will make the required changes

Nevermind. I don't remember editing that file ever but it does have changes from my side (its a change from 7 months ago lol ). I will make the required changes
justliliandev (Migrated from github.com) reviewed 2023-08-09 14:50:41 +00:00
@ -31,4 +31,12 @@ public class CoreNBTKeys {
public static final String SYNC_DATA = "Data";
justliliandev (Migrated from github.com) commented 2023-08-09 14:50:41 +00:00

you don't really need a new name for BlockPositions, just use BLOCK_POS

you don't really need a new name for BlockPositions, just use BLOCK_POS
Rover656 (Migrated from github.com) approved these changes 2023-08-10 22:40:36 +00:00
Rover656 (Migrated from github.com) left a comment

Happy for this to go in, ignoring the formatting changes :)

Happy for this to go in, ignoring the formatting changes :)
Rover656 commented 2023-08-11 00:12:28 +00:00 (Migrated from github.com)

Lookin good chonky, thanks for all of you hard work getting this to the finish line!
And sorry agnor for the re-requested review. I butterfingered it 😅

Lookin good chonky, thanks for all of you hard work getting this to the finish line! And sorry agnor for the re-requested review. I butterfingered it 😅
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Team-EnderIO/EnderIO#103
No description provided.