Skip to content
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

[7.2] Full Conduit Rework/Revisit #958

Draft
wants to merge 23 commits into
base: dev/1.21.1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2d04263
feat: Initial conduit bundle block rewrite pass.
Rover656 Jan 3, 2025
e8bd8fd
chore: spotlessApply
Rover656 Jan 3, 2025
580b532
chore: bump to 7.2
Rover656 Jan 3, 2025
7104b2d
chore: Lots of changes, see commit description
Rover656 Jan 5, 2025
5fdd6f1
feat: Jade plugin to show the conduit name and fully hide a facaded b…
Rover656 Jan 5, 2025
ce089bf
chore: Remove conduit upgrades
Rover656 Jan 5, 2025
4c4c9c7
chore: Save a large amount of work
Rover656 Jan 8, 2025
ec87cd0
chore: misc work on connections
Rover656 Jan 8, 2025
b10dc60
chore: Strongly-typed connections in Conduit class and rewritten tickers
Rover656 Jan 8, 2025
2cfdb69
chore: lots of work around menus and wrenches. Remove old conduit cla…
Rover656 Jan 9, 2025
2b5f273
feat: more item conduit UI and add redstone conduit strong signals
Rover656 Jan 11, 2025
c30f607
chore: Re-add client facades map and use highlight event instead of t…
Rover656 Jan 11, 2025
fb242f6
fix: Some conduit disconnect issues and redstone bugs
Rover656 Jan 11, 2025
32925d2
fix: Redstone conduits removed from world when loading
Rover656 Jan 11, 2025
d8821eb
chore: Lots of work on polishing conduit block behaviour and sync
Rover656 Jan 12, 2025
79eaf13
chore: spotlessApply
Rover656 Jan 12, 2025
4d40b39
feat: Conduit switch buttons in the GUI
Rover656 Jan 12, 2025
e258e7a
chore: More work on porting to the new screen system.
Rover656 Jan 12, 2025
4b107c7
chore: more sensible conduit connection checks
Rover656 Jan 12, 2025
c5c3fd1
chore: spotlessApply
Rover656 Jan 12, 2025
4e3aeff
fix: Fluid conduits not connecting
Rover656 Jan 12, 2025
cc5fbad
fix: Transparent facades not rendering correctly.
Rover656 Jan 12, 2025
dc8de3c
feat: Allow conduits to opt-out of having a menu
Rover656 Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ subprojects {
encoding("UTF-8")

java {
cleanthat()
cleanthat().version("2.8")

eclipse().configFile("$rootDir/config/codeformat/codeformat.xml")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,35 @@ protected void centerAlignTitleLabelX() {
}

@Override
public void render(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {
if (menu instanceof LegacyBaseBlockEntityMenu<?> baseBlockEntityMenu
&& baseBlockEntityMenu.getBlockEntity() == null) {
return;
}

super.render(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
super.render(guiGraphics, mouseX, mouseY, partialTick);
}

@Override
protected void renderLabels(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY) {
protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) {
if (shouldRenderLabels) {
super.renderLabels(pGuiGraphics, pMouseX, pMouseY);
super.renderLabels(guiGraphics, mouseX, mouseY);
}

// Move back to screen space rather than aligned to the background coordinates
pGuiGraphics.pose().pushPose();
pGuiGraphics.pose().translate(-leftPos, -topPos, 0.0D);
guiGraphics.pose().pushPose();
guiGraphics.pose().translate(-leftPos, -topPos, 0.0D);

int zOffset = 200;
for (var layer : overlayRenderables.keySet()) {
// Offset deeper for each layer.
pGuiGraphics.pose().pushPose();
guiGraphics.pose().pushPose();
zOffset += 150;
pGuiGraphics.pose().translate(0.0D, 0.0D, zOffset);
guiGraphics.pose().translate(0.0D, 0.0D, zOffset);

for (var overlay : overlayRenderables.get(layer)) {
if (!(overlay instanceof AbstractWidget widget) || widget.isActive()) {
overlay.render(pGuiGraphics, pMouseX, pMouseY,
overlay.render(guiGraphics, mouseX, mouseY,
Minecraft.getInstance().getTimer().getGameTimeDeltaPartialTick(false));

if (overlay instanceof BaseOverlay baseOverlay) {
Expand All @@ -92,19 +92,19 @@ protected void renderLabels(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY)
}
}

pGuiGraphics.pose().popPose();
guiGraphics.pose().popPose();
}

pGuiGraphics.pose().popPose();
guiGraphics.pose().popPose();

pGuiGraphics.pose().translate(0, 0, zOffset);
guiGraphics.pose().translate(0, 0, zOffset);

pGuiGraphics.pose().pushPose();
pGuiGraphics.pose().translate(-leftPos, -topPos, 0.0D);
guiGraphics.pose().pushPose();
guiGraphics.pose().translate(-leftPos, -topPos, 0.0D);

renderTooltip(pGuiGraphics, pMouseX, pMouseY);
renderTooltip(guiGraphics, mouseX, mouseY);

pGuiGraphics.pose().popPose();
guiGraphics.pose().popPose();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ public void endTick() {
}
}

@Override
public void setChanged() {
this.isChangedDeferred = true;
}
// TODO: I think we might be able to kill this optimisation now?
// @Override
// public void setChanged() {
// this.isChangedDeferred = true;
// }

// endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public T getBlockEntity() {
}

@Override
public boolean stillValid(Player pPlayer) {
return Container.stillValidBlockEntity(getBlockEntity(), pPlayer);
public boolean stillValid(Player player) {
return Container.stillValidBlockEntity(getBlockEntity(), player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,12 @@
"gui.enderio.collision.mobs_pass": "Not solid to monsters",
"gui.enderio.collision.players_block": "Only solid to players",
"gui.enderio.collision.players_pass": "Not solid to players",
"gui.enderio.conduit_channel": "Conduit-Channel",
"gui.enderio.confirm": "Confirm",
"gui.enderio.filter": "Filter",
"gui.enderio.filter.blacklist": "BlackList",
"gui.enderio.filter.nbt": "Match NBT",
"gui.enderio.filter.nonbt": "Ignore NBT",
"gui.enderio.filter.whitelist": "Whitelist",
"gui.enderio.fluid_conduit.change_fluid1": "Locked Fluid:",
"gui.enderio.fluid_conduit.change_fluid2": "Click to reset!",
"gui.enderio.fluid_conduit.change_fluid3": "Fluid: %s",
"gui.enderio.ioconfig": "IO Configuration",
"gui.enderio.ioconfig.both": "Push / Pull",
"gui.enderio.ioconfig.disabled": "Disabled",
Expand All @@ -265,13 +261,24 @@
"gui.enderio.redstone.active_with_signal": "Active with Signal",
"gui.enderio.redstone.active_without_signal": "Active without Signal",
"gui.enderio.redstone.always_active": "Always Active",
"gui.enderio.redstone.black": "Black",
"gui.enderio.redstone.blue": "Blue",
"gui.enderio.redstone.brown": "Brown",
"gui.enderio.redstone.cyan": "Cyan",
"gui.enderio.redstone.gray": "Gray",
"gui.enderio.redstone.green": "Green",
"gui.enderio.redstone.light_blue": "Light Blue",
"gui.enderio.redstone.light_gray": "Light Gray",
"gui.enderio.redstone.lime": "Lime",
"gui.enderio.redstone.magenta": "Magenta",
"gui.enderio.redstone.mode": "Redstone Mode",
"gui.enderio.redstone.never_active": "Never Active",
"gui.enderio.redstone_channel": "Redstone-Channel",
"gui.enderio.round_robin.disabled": "Round Robin Disabled",
"gui.enderio.round_robin.enabled": "Round Robin Enabled",
"gui.enderio.self_feed.disabled": "Self Feed Disabled",
"gui.enderio.self_feed.enabled": "Self Feed Enabled",
"gui.enderio.redstone.orange": "Orange",
"gui.enderio.redstone.pink": "Pink",
"gui.enderio.redstone.purple": "Purple",
"gui.enderio.redstone.red": "Red",
"gui.enderio.redstone.white": "White",
"gui.enderio.redstone.yellow": "Yellow",
"gui.enderio.visible.false": "Hidden",
"gui.enderio.visible.true": "Visible",
"guidebook.enderio.book_title": "Book Title",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

public enum RedstoneControl implements StringRepresentable {

ALWAYS_ACTIVE(0, "always_active", bool -> true), ACTIVE_WITH_SIGNAL(1, "active_with_signal", bool -> bool),
ACTIVE_WITHOUT_SIGNAL(2, "active_without_signal", bool -> !bool), NEVER_ACTIVE(3, "never_active", bool -> false);
ALWAYS_ACTIVE(0, "always_active", bool -> true, false),
ACTIVE_WITH_SIGNAL(1, "active_with_signal", bool -> bool, true),
ACTIVE_WITHOUT_SIGNAL(2, "active_without_signal", bool -> !bool, true),
NEVER_ACTIVE(3, "never_active", bool -> false, false);

public static final Codec<RedstoneControl> CODEC = StringRepresentable.fromEnum(RedstoneControl::values);
public static final IntFunction<RedstoneControl> BY_ID = ByIdMap.continuous(key -> key.id, values(),
Expand All @@ -25,17 +27,23 @@ public enum RedstoneControl implements StringRepresentable {
private final int id;
private final String name;
private final UnaryOperator<Boolean> isActive;
private final boolean isRedstoneSensitive;

RedstoneControl(int id, String name, UnaryOperator<Boolean> isActive) {
RedstoneControl(int id, String name, UnaryOperator<Boolean> isActive, boolean isRedstoneSensitive) {
this.id = id;
this.name = name;
this.isActive = isActive;
this.isRedstoneSensitive = isRedstoneSensitive;
}

public boolean isActive(boolean hasRedstone) {
return isActive.apply(hasRedstone);
}

public boolean isRedstoneSensitive() {
return isRedstoneSensitive;
}

@Override
public String getSerializedName() {
return name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
package com.enderio.base.client.gui.widget;

import com.enderio.base.client.gui.icon.EIOEnumIcons;
import com.enderio.base.common.lang.EIOEnumLang;
import com.enderio.core.client.gui.widgets.BaseEnumPickerWidget;
import java.util.function.Consumer;
import java.util.function.Supplier;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.DyeColor;
import org.jetbrains.annotations.Nullable;

import java.util.function.Consumer;
import java.util.function.Supplier;

public class DyeColorPickerWidget extends BaseEnumPickerWidget<DyeColor> {

// Reproduces the old ColorControl order for player familiarity.
private static final DyeColor[] ORDERED_VALUES = new DyeColor[] {
DyeColor.GREEN,
DyeColor.BROWN,
DyeColor.BLUE,
DyeColor.PURPLE,
DyeColor.CYAN,
DyeColor.LIGHT_GRAY,
DyeColor.GRAY,
DyeColor.PINK,
DyeColor.LIME,
DyeColor.YELLOW,
DyeColor.LIGHT_BLUE,
DyeColor.MAGENTA,
DyeColor.ORANGE,
DyeColor.WHITE,
DyeColor.BLACK,
DyeColor.RED,
};
private static final DyeColor[] ORDERED_VALUES = new DyeColor[] { DyeColor.GREEN, DyeColor.BROWN, DyeColor.BLUE,
DyeColor.PURPLE, DyeColor.CYAN, DyeColor.LIGHT_GRAY, DyeColor.GRAY, DyeColor.PINK, DyeColor.LIME,
DyeColor.YELLOW, DyeColor.LIGHT_BLUE, DyeColor.MAGENTA, DyeColor.ORANGE, DyeColor.WHITE, DyeColor.BLACK,
DyeColor.RED, };

public DyeColorPickerWidget(int pX, int pY, Supplier<DyeColor> getter, Consumer<DyeColor> setter, Component optionName) {
public DyeColorPickerWidget(int pX, int pY, Supplier<DyeColor> getter, Consumer<DyeColor> setter,
Component optionName) {
super(pX, pY, 16, 16, DyeColor.class, getter, setter, optionName);
}

@Override
@Nullable
public Component getValueTooltip(DyeColor value) {
return null;
return EIOEnumLang.DYE_COLOR.get(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package com.enderio.base.common.blockentity;

import com.enderio.base.api.UseOnly;
import net.minecraft.core.Direction;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.neoforged.fml.LogicalSide;
import org.jetbrains.annotations.Nullable;
import net.minecraft.world.item.context.UseOnContext;

// TODO: Move to API.

/**
* An interface that block entities may implement in order to implement special behaviours(other than to rotate the block) when right-clicked with the Yeta wrench.
*/
public interface Wrenchable {
@UseOnly(LogicalSide.SERVER)
ItemInteractionResult onWrenched(@Nullable Player player, @Nullable Direction side);
ItemInteractionResult onWrenched(UseOnContext context);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.enderio.base.common.item.tool;

import com.enderio.base.api.capability.SideConfig;
import com.enderio.base.common.blockentity.Wrenchable;
import com.enderio.base.common.init.EIOCapabilities;
import com.mojang.datafixers.util.Either;
import java.util.Optional;
Expand Down Expand Up @@ -29,10 +28,6 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext pContext)
Level level = pContext.getLevel();
BlockPos pos = pContext.getClickedPos();

if (!level.isClientSide && level.getBlockEntity(pos) instanceof Wrenchable wrenchable) {
return wrenchable.onWrenched(pContext.getPlayer(), pContext.getClickedFace()).result();
}

// Check for side config capability
SideConfig sideConfig = level.getCapability(EIOCapabilities.SideConfig.BLOCK, pos, pContext.getClickedFace());
if (sideConfig != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.enderio.regilite.Regilite;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.DyeColor;

public class EIOEnumLang {

Expand All @@ -20,6 +21,25 @@ public class EIOEnumLang {
.addTranslation(RedstoneControl.NEVER_ACTIVE, "Never Active")
.build();

public static final EnumTranslationMap<DyeColor> DYE_COLOR = builder(DyeColor.class, "redstone")
.addTranslation(DyeColor.WHITE, "White")
.addTranslation(DyeColor.ORANGE, "Orange")
.addTranslation(DyeColor.MAGENTA, "Magenta")
.addTranslation(DyeColor.LIGHT_BLUE, "Light Blue")
.addTranslation(DyeColor.YELLOW, "Yellow")
.addTranslation(DyeColor.LIME, "Lime")
.addTranslation(DyeColor.PINK, "Pink")
.addTranslation(DyeColor.GRAY, "Gray")
.addTranslation(DyeColor.LIGHT_GRAY, "Light Gray")
.addTranslation(DyeColor.CYAN, "Cyan")
.addTranslation(DyeColor.PURPLE, "Purple")
.addTranslation(DyeColor.BLUE, "Blue")
.addTranslation(DyeColor.BROWN, "Brown")
.addTranslation(DyeColor.GREEN, "Green")
.addTranslation(DyeColor.RED, "Red")
.addTranslation(DyeColor.BLACK, "Black")
.build();

public static final EnumTranslationMap<GlassCollisionPredicate> GLASS_COLLISION = builder(
GlassCollisionPredicate.class, "collision")
.addTranslation(GlassCollisionPredicate.PLAYERS_PASS, "Not solid to players")
Expand Down
Loading
Loading