Add IO Config Widget #108

Merged
dphaldes merged 31 commits from dev/io-config into dev/1.19.x 2023-04-21 19:35:14 +00:00
dphaldes commented 2023-02-16 12:28:48 +00:00 (Migrated from github.com)

Description

Adds a widget to let you configure IO sides for machine blocks

Todo

  • Change icon
  • Add widget to every block
  • Display Selected Side state
  • Hide Neighbor button

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
# Description Adds a widget to let you configure IO sides for machine blocks # Todo <!-- Remove this section if you're submitting an already-complete PR --> - [x] Change icon - [x] Add widget to every block - [x] Display Selected Side state - [x] Hide Neighbor button # 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
ferriarnus (Migrated from github.com) reviewed 2023-02-16 12:28:48 +00:00
pupnewfster (Migrated from github.com) reviewed 2023-04-04 14:39:15 +00:00
@ -0,0 +1,421 @@
package com.enderio.machines.client.gui.widget.ioconfig;
pupnewfster (Migrated from github.com) commented 2023-04-04 14:37:33 +00:00

This could be:

selection = opt.map(closest -> new SelectedFace(closest.getValue(), closest.getKey().getDirection()));
This could be: ```java selection = opt.map(closest -> new SelectedFace(closest.getValue(), closest.getKey().getDirection())); ```
dphaldes (Migrated from github.com) reviewed 2023-04-04 14:51:19 +00:00
@ -0,0 +1,421 @@
package com.enderio.machines.client.gui.widget.ioconfig;
dphaldes (Migrated from github.com) commented 2023-04-04 14:51:18 +00:00

oh I did not know Optional.map takes care of empty. I will replace it

oh I did not know Optional.map takes care of empty. I will replace it
justliliandev (Migrated from github.com) requested changes 2023-04-04 21:05:58 +00:00
justliliandev (Migrated from github.com) left a comment

Impressive, well done!

Impressive, well done!
@ -101,6 +101,13 @@ public abstract class EIOScreen<T extends AbstractContainerMenu> extends Abstrac
return super.mouseClicked(pMouseX, pMouseY, pButton);
justliliandev (Migrated from github.com) commented 2023-04-04 19:51:42 +00:00

send the dragging only to the currently focused GuiEventListener using getFocused. if the return value of that dragging is true, return true, otherwise return super mouseDragged

send the dragging only to the currently focused GuiEventListener using getFocused. if the return value of that dragging is true, return true, otherwise return super mouseDragged
justliliandev (Migrated from github.com) commented 2023-04-04 20:03:21 +00:00

send mouseMoved only to hovered widgets, determine the GuiEventListener using getChildAt(pMouseX, pMouseY)
this will do the visibility and active checks for you

send mouseMoved only to hovered widgets, determine the GuiEventListener using getChildAt(pMouseX, pMouseY) this will do the visibility and active checks for you
justliliandev (Migrated from github.com) commented 2023-04-04 21:05:37 +00:00

it also doesn't look like this would be needed at all, there are no widgets that use mouseMoved

it also doesn't look like this would be needed at all, there are no widgets that use mouseMoved
@ -12,8 +12,8 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
justliliandev (Migrated from github.com) commented 2023-04-04 20:04:40 +00:00

restore original formatting

    @Nullable
    private final T blockEntity;
restore original formatting ```suggestion @Nullable private final T blockEntity; ```
@ -0,0 +1,421 @@
package com.enderio.machines.client.gui.widget.ioconfig;
justliliandev (Migrated from github.com) commented 2023-04-04 20:38:02 +00:00

client config?

client config?
justliliandev (Migrated from github.com) commented 2023-04-04 20:39:12 +00:00

remove @NotNull and add a package-info.java to mark everything as not null by defaul

remove @NotNull and add a package-info.java to mark everything as not null by defaul
justliliandev (Migrated from github.com) commented 2023-04-04 20:39:45 +00:00

remove notNull

remove notNull
justliliandev (Migrated from github.com) commented 2023-04-04 20:43:05 +00:00

also check if loc is already in neighbours, some multiconfigurable configuration could result in adding the same position multiple times

also check if loc is already in neighbours, some multiconfigurable configuration could result in adding the same position multiple times
justliliandev (Migrated from github.com) commented 2023-04-04 20:44:17 +00:00

use pos.relative(dir)

use pos.relative(dir)
justliliandev (Migrated from github.com) commented 2023-04-04 20:48:26 +00:00

rename to vec3Origin or something similar, no _ in the beginning

rename to vec3Origin or something similar, no _ in the beginning
justliliandev (Migrated from github.com) commented 2023-04-04 20:48:41 +00:00

remove code comment

remove code comment
justliliandev (Migrated from github.com) commented 2023-04-04 20:53:09 +00:00

use Comparator.comparingDouble(entry -> entry.getValue().distToCenterSqr(vec3Origin)) instead of the manual substraction

use Comparator.comparingDouble(entry -> entry.getValue().distToCenterSqr(vec3Origin)) instead of the manual substraction
justliliandev (Migrated from github.com) commented 2023-04-04 20:55:05 +00:00

directly map the optional and store it in selection, you don't need to assign the optional in opt

directly map the optional and store it in selection, you don't need to assign the optional in opt
justliliandev (Migrated from github.com) commented 2023-04-04 20:59:37 +00:00

always render the block model and blockentityrenderer, you probably will not render the book on enchanting tables at the moment or the fluid in fluid tanks

always render the block model and blockentityrenderer, you probably will not render the book on enchanting tables at the moment or the fluid in fluid tanks
justliliandev (Migrated from github.com) commented 2023-04-04 21:00:18 +00:00

rename rt -> renderType

rename rt -> renderType
justliliandev (Migrated from github.com) commented 2023-04-04 21:03:20 +00:00

remove notnull annotation

remove notnull annotation
justliliandev (Migrated from github.com) commented 2023-04-04 21:03:50 +00:00

make constructor private

make constructor private
justliliandev (Migrated from github.com) commented 2023-04-04 21:04:38 +00:00
                },
                () -> {
```suggestion }, () -> { ```
dphaldes (Migrated from github.com) reviewed 2023-04-05 08:12:19 +00:00
@ -101,6 +101,13 @@ public abstract class EIOScreen<T extends AbstractContainerMenu> extends Abstrac
return super.mouseClicked(pMouseX, pMouseY, pButton);
dphaldes (Migrated from github.com) commented 2023-04-05 08:12:18 +00:00

This breaks since the new widget doesn't actually get focus

This breaks since the new widget doesn't actually get focus
justliliandev (Migrated from github.com) reviewed 2023-04-05 09:18:28 +00:00
@ -101,6 +101,13 @@ public abstract class EIOScreen<T extends AbstractContainerMenu> extends Abstrac
return super.mouseClicked(pMouseX, pMouseY, pButton);
justliliandev (Migrated from github.com) commented 2023-04-05 09:18:27 +00:00

okay, maybe still change it so that it returns true on the first widget returning true, meaning it handled the dragging? So no slotdragging would occur or similar

okay, maybe still change it so that it returns true on the first widget returning true, meaning it handled the dragging? So no slotdragging would occur or similar
dphaldes (Migrated from github.com) reviewed 2023-04-05 09:59:39 +00:00
@ -0,0 +1,421 @@
package com.enderio.machines.client.gui.widget.ioconfig;
dphaldes (Migrated from github.com) commented 2023-04-05 09:59:39 +00:00

Is it required ? I don't think it will be useful and we will then need to make sure the custom code works for all values

Is it required ? I don't think it will be useful and we will then need to make sure the custom code works for all values
dphaldes (Migrated from github.com) reviewed 2023-04-05 14:58:51 +00:00
@ -0,0 +1,421 @@
package com.enderio.machines.client.gui.widget.ioconfig;
dphaldes (Migrated from github.com) commented 2023-04-05 14:58:51 +00:00

I have added the config. I am not able to test it

I have added the config. I am not able to test it
ferriarnus (Migrated from github.com) reviewed 2023-04-05 15:25:45 +00:00
ferriarnus (Migrated from github.com) commented 2023-02-24 09:56:20 +00:00

While there' nothing wrong with doing it this way, can it be made cleaner? Also this seems to be useful in other render things we have right now? I think maybe conduits or the fluid tank?

While there' nothing wrong with doing it this way, can it be made cleaner? Also this seems to be useful in other render things we have right now? I think maybe conduits or the fluid tank?
@ -0,0 +388,4 @@
}
}
private static class GhostRenderLayer extends RenderType {
ferriarnus (Migrated from github.com) commented 2023-04-05 15:23:52 +00:00

We should put a reference to patchouli in the class and methods.

We should put a reference to patchouli in the class and methods.
@ -6,8 +6,13 @@ public class MachinesClientConfig {
ferriarnus (Migrated from github.com) commented 2023-04-05 15:24:53 +00:00

machineParticles seems the wrong string for this no?

machineParticles seems the wrong string for this no?
dphaldes (Migrated from github.com) reviewed 2023-04-05 15:29:28 +00:00
@ -6,8 +6,13 @@ public class MachinesClientConfig {
dphaldes (Migrated from github.com) commented 2023-04-05 15:29:28 +00:00

Yep, that is a mistake. (shouldnt blindly copy paste)

Yep, that is a mistake. (shouldnt blindly copy paste)
dphaldes (Migrated from github.com) reviewed 2023-04-05 15:32:39 +00:00
dphaldes (Migrated from github.com) commented 2023-04-05 15:32:39 +00:00

I don't use that function for anything (tried it for a small duration and then switched back to custom impl).

I don't use that function for anything (tried it for a small duration and then switched back to custom impl).
justliliandev (Migrated from github.com) reviewed 2023-04-05 15:32:55 +00:00
justliliandev (Migrated from github.com) commented 2023-04-05 15:32:55 +00:00

It's not helpful for conduit rendering

It's not helpful for conduit rendering
ferriarnus (Migrated from github.com) reviewed 2023-04-05 15:33:33 +00:00
ferriarnus (Migrated from github.com) commented 2023-04-05 15:33:33 +00:00

Yeah this seems to be a very old review comment that I didn't remove

Yeah this seems to be a very old review comment that I didn't remove
justliliandev (Migrated from github.com) reviewed 2023-04-05 15:35:09 +00:00
@ -102,2 +102,4 @@
}
@Override
public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) {
justliliandev (Migrated from github.com) commented 2023-04-05 15:35:08 +00:00

return true here

return true here
justliliandev (Migrated from github.com) reviewed 2023-04-05 15:37:25 +00:00
@ -0,0 +369,4 @@
screenFont.draw(poseStack, map.getComponent(), x + 4, y + height - 2 - screenFont.lineHeight, 0xFFFFFFFF);
poseStack.popPose();
}
}
justliliandev (Migrated from github.com) commented 2023-04-05 15:37:25 +00:00

remove NotNull from direction

remove NotNull from direction
ferriarnus commented 2023-04-08 09:49:05 +00:00 (Migrated from github.com)

I think the Soul binder also needs the config screen. (It might not work a 100% right now since it meanly uses fluids and isn't really something you automate, but it should have it).

I think the Soul binder also needs the config screen. (It might not work a 100% right now since it meanly uses fluids and isn't really something you automate, but it should have it).
dphaldes commented 2023-04-09 07:02:52 +00:00 (Migrated from github.com)

@ferriarnus the soulbinder uses fixed IOConfig in Pull mode. I have added the widget but it does nothing right now. Should I revert or do we keep it as is until we figure out fluid support ?

@ferriarnus the soulbinder uses fixed IOConfig in Pull mode. I have added the widget but it does nothing right now. Should I revert or do we keep it as is until we figure out fluid support ?
ferriarnus commented 2023-04-09 07:43:44 +00:00 (Migrated from github.com)

The soul binder doesn't need to be fixed anymore. I needed for testing, since a fluid is needed for the recipe. But now with the io config widget, you can easily set a side to pull and it will work. We will indeed rewrite some stuff for fluid support, but the current io config is good enough to handel it I think?

The soul binder doesn't need to be fixed anymore. I needed for testing, since a fluid is needed for the recipe. But now with the io config widget, you can easily set a side to pull and it will work. We will indeed rewrite some stuff for fluid support, but the current io config is good enough to handel it I think?
dphaldes commented 2023-04-09 07:48:54 +00:00 (Migrated from github.com)

Ok I will change soul binder config and keep the widget

Ok I will change soul binder config and keep the widget
justliliandev (Migrated from github.com) requested changes 2023-04-16 13:44:06 +00:00
justliliandev (Migrated from github.com) left a comment

last tiny nitpick with code
feature works as intended, well done

last tiny nitpick with code feature works as intended, well done
@ -101,6 +101,13 @@ public abstract class EIOScreen<T extends AbstractContainerMenu> extends Abstrac
return super.mouseClicked(pMouseX, pMouseY, pButton);
}
justliliandev (Migrated from github.com) commented 2023-04-16 12:10:35 +00:00
            return abstractWidget.mouseDragged(pMouseX, pMouseY, pButton, pDragX, pDragY);
```suggestion return abstractWidget.mouseDragged(pMouseX, pMouseY, pButton, pDragX, pDragY); ```
justliliandev (Migrated from github.com) approved these changes 2023-04-21 19:35:02 +00:00
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#108
No description provided.