Feature/travel staff #18
No reviewers
Labels
No labels
Area-Assets
Area-Backend
Area-Conduits
Area-Datapacks
Area-Lang
Area-Mod Compat
Area-Parity
Area-Rendering
Good first issue
MC-1.19.2
MC-1.20.1
MC-1.20.4
MC-1.20.6
MC-1.21
MC-1.21.1
Modtoberfest
P-0-High
P-1-Medium
P-2-Low
Status-Awaiting Response
Status-Behind-Flag
Status-Blocked
Status-Cannot Reproduce
Status-Duplicate
Status-Help Wanted
Status-Incomplete Report
Status-Invalid
Status-Needs LTS Backport
Status-Needs Updating
Status-Stale
Status-To Implement
Status-Triage
Status-Wontfix
Status-Wontmerge
Type-Backport
Type-Bug
Type-Documentation
Type-Enhancement
Type-Question
Type-RFC
Type-Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Team-EnderIO/EnderIO#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/travel_staff"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Added Staff of Travelling
Added TeleportationTargetSystem using WorldSavedData (can be moved to capability, if wanted, but WorldSavedData is imo the better approach for this)
Marked as a Draft, because I wanted opinions on:
API-Annotation
TravelRegistry allowing Mods to add their own TravelTargets without a dependency on machines
Usage of IMC vs API anotated methods/class vs API package
Every Travel Target defines how it renders
Todo
Checklist:
I would rename addParticles and getColor to something like 'addTravelParticles' etc
Depending on much ends up being in this class I would even consider moving the travel stuff into a sperate class compleletly. The way it is it could be pretty hard to find where this functionality is implemented
@ -0,0 +25,4 @@Vec3 projectedView = mainCamera.getPosition();poseStack.translate(-projectedView.x, -projectedView.y, -projectedView.z);//TODO: Scale, View Bobbing, (FOV/Creative Flight offset stuff)Sure, this stuff was pretty complex to get looking the way I wanted from memory. Was the scaling based on screen pos etc not done in the ported mod?
@ -0,0 +1,156 @@package com.enderio.base.common.handler.travel;Using this method is the sound played to other people close to the player? You are also playing the sound even if the teleport doesn't happen.
You add the player eye height above but then just use target.below() for the ground check. This will work in most cases but it is probably more correct to subtract eye height again
I would rename this to isTelportPositionClear or something. The name sounds like it is testing if the target pos is actual 'ground', not just checking for empty space. On initial reading I though you couldn't teleport to a position in mid air.
@ -0,0 +38,4 @@return true;if (stack.getItem() instanceof IDarkSteelItem darkSteelItem) {//TODO: Check for upgrade;}Are we going to allow this to be extensible by other mods? I am not fussed if we don't bother with this for now.
We could add an ITraveltem interface (the pair of ITravelTarget). This would need a method like 'isAvailable' to handle whether an upgrade is available or not.
This method also doesn't consider if you have enough energy in the item to teleport but I am guessing that is the correct
@ -0,0 +37,4 @@@Overridepublic InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand usedHand) {ItemStack stack = player.getItemInHand(usedHand);if (getActivationStatus(stack).isAir()) {Both 'use' and 'useOn' should be able to do both teleport types. Most of the time you wish to travel to a block you will right click the air which will come through this method.
@ -0,0 +47,4 @@}@Overridepublic InteractionResult useOn(UseOnContext context) {So you need to make sure the block you are right clicking on hasn't 'consumed' the right click before doing the teleport? Can't remember how this works.
@ -0,0 +23,4 @@public TravelAnchorBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) {super(pType, pWorldPosition, pBlockState);add2WayDataSlot(new StringDataSlot(this::getName, this::setName, SyncMode.GUI));We probably shouldn't be using a number in the middle of a method name like this
@ -0,0 +47,4 @@}@Overridepublic InteractionResult useOn(UseOnContext context) {the method is only called if the block hasn't consumed the right click
@ -0,0 +23,4 @@public TravelAnchorBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) {super(pType, pWorldPosition, pBlockState);add2WayDataSlot(new StringDataSlot(this::getName, this::setName, SyncMode.GUI));do you have a better name for it?
@ -0,0 +38,4 @@return true;if (stack.getItem() instanceof IDarkSteelItem darkSteelItem) {//TODO: Check for upgrade;}The ITravelTarget interface can be used as an optional dependency, because it doesn't need to be implemented on minecraft exposed registry objects like item and blocks. Forcing an interface on Items or Blocks (what ctm is doing rn), would make our mod to be a required dependency. This method is only called for particle rendering and other clients can add their own particles or use our addParticleMethod, if we make it public
@ -0,0 +25,4 @@Vec3 projectedView = mainCamera.getPosition();poseStack.translate(-projectedView.x, -projectedView.y, -projectedView.z);//TODO: Scale, View Bobbing, (FOV/Creative Flight offset stuff)it wasn't as they use a BlockEntityRenderer for some things, which wouldn't work for us, because we have the big teleporter with infinite range. Also I wanted to get the logic done first, so the Draft would be cleaner
I've put it there, because I would need another TeleportHandler class just for the client stuff, because of classloading issues. Can extract that to another class called TeleportClientHandler but the code is really seperate anyway, so I don't see a big benefit for extracting it out
@ -0,0 +23,4 @@public TravelAnchorBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) {super(pType, pWorldPosition, pBlockState);add2WayDataSlot(new StringDataSlot(this::getName, this::setName, SyncMode.GUI));addTwoWayDataSlot
@ -0,0 +23,4 @@public TravelAnchorBlockEntity(BlockEntityType<?> pType, BlockPos pWorldPosition, BlockState pBlockState) {super(pType, pWorldPosition, pBlockState);add2WayDataSlot(new StringDataSlot(this::getName, this::setName, SyncMode.GUI));Yep
@ -0,0 +38,4 @@return true;if (stack.getItem() instanceof IDarkSteelItem darkSteelItem) {//TODO: Check for upgrade;}Sounds good
The only value I see is that all the teleport functionality would then be in a single package. Someone looking at the teleport code for the first time might have a hard time finding this functionality.
Just a suggestion though, I am happy for it to stay where it is.
@ -0,0 +1,156 @@package com.enderio.base.common.handler.travel;it isn't played to other players, should other players nearby hear it?
moved it
Closing in favor of #103
Pull request closed