diff --git a/build.gradle b/build.gradle index 2547c72..4514ffa 100644 --- a/build.gradle +++ b/build.gradle @@ -109,7 +109,7 @@ dependencies { if (findProject(':titanium') != null) { implementation project(':titanium') } else { - implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.0-27')) + implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.1-31')) } runtimeOnly fg.deobf("team.chisel.ctm:CTM:1.18-+") } diff --git a/gradle.properties b/gradle.properties index 5576e62..0a0cd4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ modGroup=com.buuz135.portality.Portality -api_version=3.3.1 +api_version=3.3.2 modBaseName=portality forgeVersion=1.12.2-14.23.4.2759 mcpVersion=stable_39 diff --git a/src/main/java/com/buuz135/portality/gui/button/PortalSettingButton.java b/src/main/java/com/buuz135/portality/gui/button/PortalSettingButton.java index db20542..5e173e5 100644 --- a/src/main/java/com/buuz135/portality/gui/button/PortalSettingButton.java +++ b/src/main/java/com/buuz135/portality/gui/button/PortalSettingButton.java @@ -35,16 +35,16 @@ import com.hrznstudio.titanium.client.screen.addon.StateButtonInfo; import com.hrznstudio.titanium.client.screen.asset.IAssetProvider; import com.hrznstudio.titanium.component.button.ButtonComponent; -import com.hrznstudio.titanium.network.locator.ILocatable; import com.hrznstudio.titanium.network.locator.instance.TileEntityLocatorInstance; import com.hrznstudio.titanium.network.messages.ButtonClickNetworkMessage; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.nbt.CompoundTag; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Collections; import java.util.List; @@ -71,6 +71,7 @@ public PortalSettingButton(int posX, int posY, Supplier runnableSuppli this.supplier = runnableSupplier; } + @OnlyIn(Dist.CLIENT) @Override public List> getScreenAddons() { return Collections.singletonList(() -> new StateButtonAddon(this, infos) { diff --git a/src/main/java/com/buuz135/portality/gui/button/TextPortalButton.java b/src/main/java/com/buuz135/portality/gui/button/TextPortalButton.java index 647f853..0f05b32 100644 --- a/src/main/java/com/buuz135/portality/gui/button/TextPortalButton.java +++ b/src/main/java/com/buuz135/portality/gui/button/TextPortalButton.java @@ -37,12 +37,13 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Collections; import java.util.List; @@ -70,11 +71,13 @@ public TextPortalButton setClientConsumer(Supplier> screenConsu return this; } + @OnlyIn(Dist.CLIENT) @Override public List> getScreenAddons() { return Collections.singletonList(() -> new TextButtonAddon(this, display, screenConsumer.get())); } + @OnlyIn(Dist.CLIENT) public class TextButtonAddon extends BasicButtonAddon { private String text; diff --git a/src/main/java/com/buuz135/portality/tile/ControllerTile.java b/src/main/java/com/buuz135/portality/tile/ControllerTile.java index 64d623a..c0e5233 100644 --- a/src/main/java/com/buuz135/portality/tile/ControllerTile.java +++ b/src/main/java/com/buuz135/portality/tile/ControllerTile.java @@ -117,6 +117,21 @@ public int getState() { return 0; } }.setId(1)); + this.addButton(new PortalSettingButton(-22, 12 + 22 * 3, () -> () -> { + OpenGui.open(3, ControllerTile.this); + }, new StateButtonInfo(0, PortalSettingButton.CHANGE_COLOR, "portality.display.change_color")) { + @Override + public int getState() { + return 0; + } + }.setId(5)); + this.addButton(new TextPortalButton(5, 90, 80, 16, "portality.display.call_portal") + .setClientConsumer(() -> screen -> { + OpenGui.open(2, ControllerTile.this); + }) + .setId(4) + .setPredicate((playerEntity, compoundNBT) -> PortalNetworkMessage.sendInformationToPlayer((ServerPlayer) playerEntity, isInterdimensional(), getBlockPos(), BlockPosUtils.getMaxDistance(this.getLength()), this.teleportationTokens)) + ); this.addButton(new PortalSettingButton(-22, 12 + 22, () -> () -> { }, new StateButtonInfo(0, PortalSettingButton.PUBLIC, "portality.display.make_private"), new StateButtonInfo(1, PortalSettingButton.PRIVATE, "portality.display.make_public")) { @@ -138,21 +153,6 @@ public int getState() { if (information.getOwner().equals(playerEntity.getUUID())) setDisplayNameEnabled(!isDisplayNameEnabled()); }).setId(3)); - this.addButton(new PortalSettingButton(-22, 12 + 22 * 3, () -> () -> { - OpenGui.open(3, ControllerTile.this); - }, new StateButtonInfo(0, PortalSettingButton.CHANGE_COLOR, "portality.display.change_color")) { - @Override - public int getState() { - return 0; - } - }.setId(5)); - this.addButton(new TextPortalButton(5, 90, 80, 16, "portality.display.call_portal") - .setClientConsumer(() -> screen -> { - OpenGui.open(2, ControllerTile.this); - }) - .setId(4) - .setPredicate((playerEntity, compoundNBT) -> PortalNetworkMessage.sendInformationToPlayer((ServerPlayer) playerEntity, isInterdimensional(), getBlockPos(), BlockPosUtils.getMaxDistance(this.getLength()), this.teleportationTokens)) - ); this.addButton(new TextPortalButton(90, 90, 80, 16, "portality.display.close_portal").setPredicate((playerEntity, compoundNBT) -> closeLink()).setId(5)); } @@ -384,6 +384,7 @@ public void linkTo(PortalLinkData data, PortalLinkData.PortalCallType type) { } PortalDataManager.setActiveStatus(this.level, this.worldPosition, true); this.linkData = data; + markForUpdate(); } public void closeLink() { @@ -402,6 +403,7 @@ public void closeLink() { linkData = null; } ChunkLoaderHandler.removePortalAsChunkloader(this); + markForUpdate(); } public boolean isActive() {