-
-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow flexible teleporter frames up to 10x10. #6938
Conversation
The teleport block must be on a side, not a corner and all blocks inside the frame must not be solid, opaque or impaasible.
And does the teleportation work? |
Please switch to using our multiblock system rather than have it implement its own structure validation. Sidenote: your usage of |
Also by solid blocks I presume things like rails still work fine inside of them? |
I'll check it out. I hadn't looked that far into the codebase. I was just working from what was already there.
Yep. For entities, mobs, players, players on horses, players in minecarts, minecarts alone. I don't think my changes affected that.
Yes. It's possible I've made it too restrictive, the old code didn't care what was inside the frame at all. It may be better to allow users more flexibility and if there are blocks in the frame, don't worry about it. I'd still avoid allowing teleporter blocks/teleporter frame blocks inside as nested teleporters could lead to confusing behaviour.
Ah. My day job's code style is to generally avoid nulls. |
Ya we have a pretty decent/expansive system for multiblocks now in V10 (though I am not sure if some parts of it will need to be adjusted for purposes of the teleporter as it is 2D and in theory the frames can be shared). The main reason we didn't bother switching to it before when we wrote the new system and unified the rest of our multiblock formation code is it seemed a bit overkill for such a small and rigid structure as the teleporter used to be confined to.
That is a good point and one thing I didn't realize would be an issue with this, though I think in theory it shouldn't be that hard in the multiblock validation to blacklist frames/teleporter blocks as invalid "inner" multiblocks. |
…mes. Outstanding issues: - Teleporters work now, but at least in my save, existing ones need to be completely rebuilt. - The frame blocks consistently trigger the multiblock validation, but the teleporter blocks themselves don't always trigger it... - Shared frames do not work. - Multiple teleporter blocks can be added to one frame. - I needed to change Structure.java to allow for flat structures and I'm not sure what affect that will have on other uses of the class. It seems like it will just mean that precheck in CuboidStructureValidator will get called more often.
I got to the point where teleporters do something again. There are a bunch of rough edges still. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't review everything but left a couple comments. I also am not sure if the way this changes it breaks frames being able to be part of multiple teleporters (for example two both vertical ones that are perpendicular to each other). It may be worth making the frames structural and adjusting or just making another multiblock validator that isn't Cuboid not sure. A good part of me also hopes aidan will be able to way in here some as he knows the logic behind the multiblock system a lot better so may be able to better say when parts are breaking things entirely.
public static final VoxelCuboid MIN_BOUNDS = new VoxelCuboid(1, 1, 1); | ||
public static final VoxelCuboid MAX_BOUNDS = new VoxelCuboid(17, 18, 17); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these bounds are correct at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Those were just copied from elsewhere and adjusted while I tried to get it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I think a new validator that isn't directly a CuboidValidator may be better/more effective as realistically we want a VoxelPlane not a VoxelCuboid and there isn't a great way to specify the min bounds for a flat thing using the cuboid system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I found the structure concept a bit hard to follow so I was trying to get to a working state again before I explored something more fit to purpose.
if (minorPlane.hasFrame() && minorPlane.length() >= 2 && minorPlane.height() >= 2) { | ||
// the plane has a frame and is at least two by two | ||
if (minorPlane.hasFrame()) { | ||
// the plane has a frame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change has some significant implications and in fact may entirely invalidate the point/efficiency of having two plane types (though @aidancbrady can probably say better).
Edit: Thinking about it further, this definitely probably should not be done, as a complete teleporter frame I believe should just be a "single" major plane if I remember how the planes system works (though I only have a rudimentary understanding of it).
* | ||
* @return found cuboid, or null if it doesn't exist | ||
*/ | ||
public static VoxelCuboid fetchCuboid(Structure structure, VoxelCuboid minBounds, VoxelCuboid maxBounds) { | ||
public static VoxelCuboid fetchCuboid(Structure structure, VoxelCuboid minBounds, VoxelCuboid maxBounds, boolean filled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should not be used for this purpose as the entire point is for if it is all sides, the other method is much better used for cases like this as it was designed for non rectangular multiblocks and multiblocks that are not "full" for each face such as the thermal evaporation tower.
@@ -317,8 +318,14 @@ private MekanismBlockTypes() { | |||
.withEnergyConfig(() -> TELEPORTER_USAGE, MekanismConfig.storage.teleporter) | |||
.withSupportedUpgrades(EnumSet.of(Upgrade.ANCHOR)) | |||
.without(AttributeStateActive.class, AttributeStateFacing.class, AttributeParticleFX.class) | |||
.with(new AttributeSecurity(), new AttributeMultiblock()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should rebase as I made changes earlier today to make it so that these attributes only ever have one instance created to save slightly on memory.
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use wildcard imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh. IntelliJ kept doing that. :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the code formatting stylesheet we use with IntelliJ https://github.com/mekanism/Mekanism/blob/1.16.x/docs/GoogleStyle4Indents.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will certainly help.
Is there an example of this already? A regression in the shared teleporter frames would be ugly. |
Structural glass is one, take a look at |
…rter frames." This reverts commit c68c432
I've rolled by the WIP commit. If I get time to look at it again, I'll make another attempt. |
any updates on this? |
Welp, we didn't got what we wanted, i dont know why |
This change extends the frame detection of teleporters to allow frames up to 10x10, in all directions and orientations.
Additionally, it prevents teleporters with solid blocks inside the frame from working.
https://i.imgur.com/gkoKxQJ.jpg