diff --git a/guilib b/guilib index 73deed043..8faf209f3 160000 --- a/guilib +++ b/guilib @@ -1 +1 @@ -Subproject commit 73deed04374e05bc2f3c6e890bbe4e3a098d716a +Subproject commit 8faf209f3f07562b9194337f430f2cdb2e941526 diff --git a/src/main/java/com/troblecodings/signals/blocks/Signal.java b/src/main/java/com/troblecodings/signals/blocks/Signal.java index 1bd983f83..d346824c0 100644 --- a/src/main/java/com/troblecodings/signals/blocks/Signal.java +++ b/src/main/java/com/troblecodings/signals/blocks/Signal.java @@ -181,7 +181,6 @@ public void destroy(final IWorld worldIn, final BlockPos pos, final BlockState s } } - @SuppressWarnings("unchecked") public int getHeight(final Map map) { for (final PredicateProperty property : this.prop.signalHeights) { if (property.test(map)) @@ -227,7 +226,6 @@ public void renderOverlay(final RenderOverlayInfo info) { this.renderOverlay(info, this.prop.customNameRenderHeight); } - @SuppressWarnings("unchecked") @OnlyIn(Dist.CLIENT) public void renderScaleOverlay(final RenderOverlayInfo info, final float renderHeight) { final Map map = ClientSignalStateHandler @@ -288,7 +286,6 @@ public void renderSingleScaleOverlay(final RenderOverlayInfo info) { info.stack.popPose(); } - @SuppressWarnings("unchecked") @OnlyIn(Dist.CLIENT) public void renderOverlay(final RenderOverlayInfo info, final float renderHeight) { float customRenderHeight = renderHeight; @@ -439,7 +436,6 @@ public int getDirectSignal(final BlockState blockState, final IBlockReader block return 0; } - @SuppressWarnings("unchecked") public void getUpdate(final World world, final BlockPos pos) { if (this.prop.sounds.isEmpty()) return; @@ -463,14 +459,13 @@ public void getUpdate(final World world, final BlockPos pos) { } } - @SuppressWarnings("unchecked") public SoundProperty getSound(final Map map) { for (final SoundProperty property : this.prop.sounds) { if (property.predicate.test(map)) { return property; } } - return new SoundProperty(); + return new SoundProperty(null, t -> true, -1); } @Override diff --git a/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java b/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java index b72487637..05b1aecd8 100644 --- a/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java +++ b/src/main/java/com/troblecodings/signals/guis/ContainerSignalBox.java @@ -13,7 +13,6 @@ import com.troblecodings.guilib.ecs.GuiInfo; import com.troblecodings.guilib.ecs.interfaces.UIClientSync; import com.troblecodings.signals.OpenSignalsMain; -import com.troblecodings.signals.blocks.Signal; import com.troblecodings.signals.core.PosIdentifier; import com.troblecodings.signals.core.ReadBuffer; import com.troblecodings.signals.core.SubsidiaryEntry; diff --git a/src/main/java/com/troblecodings/signals/guis/PreviewSideBar.java b/src/main/java/com/troblecodings/signals/guis/PreviewSideBar.java index 88e579e91..6be5a079d 100644 --- a/src/main/java/com/troblecodings/signals/guis/PreviewSideBar.java +++ b/src/main/java/com/troblecodings/signals/guis/PreviewSideBar.java @@ -13,6 +13,8 @@ import com.troblecodings.signals.enums.ChangeableStage; import com.troblecodings.signals.models.ModelInfoWrapper; +import net.minecraft.util.math.vector.Quaternion; + public class PreviewSideBar { public static final float MODIFIER = 0.1f; @@ -26,8 +28,9 @@ public PreviewSideBar(final float height) { blockRenderEntity.setInheritHeight(true); blockRenderEntity.setWidth(60); + // TODO Check if right blockRenderEntity.add(new UIDrag((x, y) -> blockRender - .updateRotation(QuaternionWrapper.fromXYZ(0, (float) x * MODIFIER, 0)))); + .updateRotation(new Quaternion(0, (float) x * MODIFIER, 0, false)))); blockRenderEntity.add(new UIScissor()); blockRenderEntity.add(new UIColor(GuiSignalBox.BACKGROUND_COLOR)); @@ -69,7 +72,7 @@ public void clear() { } public void update(final Signal signal) { - blockRender.setBlockState(new ModelInfoWrapper(signal, properties)); + blockRender.setBlockState(signal.defaultBlockState(), new ModelInfoWrapper(properties)); } } diff --git a/src/main/java/com/troblecodings/signals/guis/SidePanel.java b/src/main/java/com/troblecodings/signals/guis/SidePanel.java index 76b198335..a2e12a8d9 100644 --- a/src/main/java/com/troblecodings/signals/guis/SidePanel.java +++ b/src/main/java/com/troblecodings/signals/guis/SidePanel.java @@ -245,8 +245,8 @@ public void helpUsageMode(final Map subsidiaries, allNodes.forEach(currentNode -> { final UILabel currentStatus = new UILabel( - I18n.format("info.usage.status") + " : " - + I18n.format("info.usage.status.free")); + I18n.get("info.usage.status") + " : " + + I18n.get("info.usage.status.free")); currentStatus.setTextColor(new UIEntity().getBasicTextColor()); final UIEntity statusEntity = new UIEntity(); statusEntity.setInheritWidth(true); @@ -259,15 +259,15 @@ public void helpUsageMode(final Map subsidiaries, .getEntry(PathEntryType.PATHUSAGE); if (pathUsage.isPresent() && !pathUsage.get().equals(EnumPathUsage.FREE)) { - currentStatus.setText(I18n.format("info.usage.status") - + " : " + I18n.format("info.usage.status.blocked")); + currentStatus.setText(I18n.get("info.usage.status") + " : " + + I18n.get("info.usage.status.blocked")); canBeManuelChanged.set(false); } if (!entry.containsEntry(PathEntryType.OUTPUT)) return; final String name = currentNode.getPoint().toString() + " - " + ClientNameHandler.getClientName(new NameStateInfo( - mc.world, + mc.level, entry.getEntry(PathEntryType.OUTPUT).get())); final UIEntity button = GuiElements.createButton(name, e1 -> { gui.pop(); diff --git a/src/main/java/com/troblecodings/signals/models/ModelInfoWrapper.java b/src/main/java/com/troblecodings/signals/models/ModelInfoWrapper.java index d2fbb4e46..f2494832c 100644 --- a/src/main/java/com/troblecodings/signals/models/ModelInfoWrapper.java +++ b/src/main/java/com/troblecodings/signals/models/ModelInfoWrapper.java @@ -1,11 +1,16 @@ package com.troblecodings.signals.models; +import java.util.Map; + +import com.troblecodings.core.interfaces.BlockModelDataWrapper; import com.troblecodings.signals.SEProperty; import net.minecraftforge.client.model.data.IModelData; +import net.minecraftforge.client.model.data.ModelDataMap; +import net.minecraftforge.client.model.data.ModelDataMap.Builder; import net.minecraftforge.client.model.data.ModelProperty; -public class ModelInfoWrapper implements IModelData { +public class ModelInfoWrapper implements BlockModelDataWrapper { private final IModelData data; @@ -13,6 +18,12 @@ public ModelInfoWrapper(final IModelData data) { this.data = data; } + public ModelInfoWrapper(final Map states) { + final Builder builder = new ModelDataMap.Builder(); + states.forEach((property, value) -> builder.withInitial(property, value)); + this.data = builder.build(); + } + @Override public boolean hasProperty(final ModelProperty prop) { return data.hasProperty(prop);