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

Feats/1.12.2 #214

Merged
merged 39 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
33136bb
first 1.18 feats
Uhutown Sep 1, 2023
13ac061
fixed 1.18 feats
Uhutown Sep 3, 2023
dbd9702
feat: configs and assets
Jeronimo97 Sep 3, 2023
6961fc5
Merge branch 'feats/1.12.2' of https://github.com/MrTroble/Open-Signa…
Jeronimo97 Sep 3, 2023
57dd90a
fix: signal lightemission
Jeronimo97 Sep 3, 2023
bdcdbf9
fix issue in ContainerSignalBox
Uhutown Sep 3, 2023
e8c9c4b
fix: signal linking
Jeronimo97 Sep 3, 2023
f8a793a
ref: fixed BufferUnderFlowException
Uhutown Sep 3, 2023
3123a24
fix: RS remote Output
Uhutown Sep 3, 2023
56e3172
fix: issues in SignalBox UI
Uhutown Sep 3, 2023
80597b4
fix: NPE
Uhutown Sep 4, 2023
bdf8592
feat: apply config values
Jeronimo97 Sep 5, 2023
095d2ce
fix: side panel text rotation
Jeronimo97 Sep 5, 2023
1068fe6
ref: better code performance
Uhutown Sep 6, 2023
d48e867
fix: signal in preview not shown
Uhutown Sep 6, 2023
46a30b0
fix: class cast exception
Uhutown Sep 6, 2023
11e7c52
ref: better code performance
Uhutown Sep 6, 2023
add4539
fix possible issue with subsidiaries
Uhutown Sep 11, 2023
948fa68
ref: reduced NBT Usage
Uhutown Sep 11, 2023
4b00de4
dont fix rotation
Jeronimo97 Sep 13, 2023
a867fb0
fix: quaternion
Jeronimo97 Sep 13, 2023
c7d31c0
fix: problems with CPs
Uhutown Sep 13, 2023
8354eab
fix: quaternion
Jeronimo97 Sep 13, 2023
66c29eb
Merge branch 'feats/1.12.2' of https://github.com/MrTroble/Open-Signa…
Jeronimo97 Sep 13, 2023
4eb1f29
update contentPackLib
Uhutown Sep 13, 2023
6e79f57
Merge branch 'feats/1.12.2' of https://github.com/MrTroble/Open-Signa…
Uhutown Sep 13, 2023
9dd2f38
fix: wrong lang keys
Jeronimo97 Sep 13, 2023
8b3cc99
fix: UI Tool Tip
Uhutown Sep 14, 2023
bc5418a
Merge branch 'feats/1.12.2' of https://github.com/MrTroble/Open-Signa…
Uhutown Sep 14, 2023
7b9a3aa
fix Scroll in SignalBox
Uhutown Sep 14, 2023
9a85f56
try to fix rotation
Uhutown Sep 14, 2023
56e30cf
fix: quaternion rotation
Jeronimo97 Sep 16, 2023
99abb77
Update guilib
Jeronimo97 Sep 16, 2023
9653b24
Update guilib
Jeronimo97 Sep 17, 2023
0127bae
Update guilib
Jeronimo97 Sep 17, 2023
242ce2b
Update changelog.md
Jeronimo97 Sep 17, 2023
222beb9
ref: checkstyle
Jeronimo97 Sep 17, 2023
5de106a
chore: checkstyle
Jeronimo97 Sep 17, 2023
f92687b
chore: checkstyle
Jeronimo97 Sep 17, 2023
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 .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
if: endswith(github.ref_name, 'master') && github.ref_protected && github.ref_type == 'branch'
runs-on: ubuntu-latest
env:
APPVEYOR_BUILD_VERSION: '3.0.2'
APPVEYOR_BUILD_VERSION: '3.1.0'
CURSETOKEN: ${{ secrets.CURSETOKEN }}
steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/versioncheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Check version!"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, push]

jobs:
# Enforces the update of the gradle file on every pull request
test:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- name: Get Changed Files
id: changed
uses: foodee/pr-includes-file-change@master
with:
paths: github/workflows/gradle.yml

- name: Echo Match
if: steps.changed.outputs.matched == 'true'
run: echo Matched
22 changes: 22 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## [1.12.2 - 3.1.0]

* feat: added help panel to signalbox
* feat: added shortcuts in help panel
* feat: added manipulator tool for new signal renaming
* feat: reverse resetting pathways
* feat: added tooltip to text input field
* feat: added tooltip hiding option
* feat: remove grid in usage mode from signalbox
* feat: readded configurable block light emission
* feat: configurable colors
* feat: add preview renderer
* feat: added sorting and search option in linking list
* feat: switch handle with opposide basic position
* fix: circle model
* fix: tooltip out of screen
* fix: bug in signal configs (hl, zs2v, semaphore)
* fix: redstone output of switch signals
* fix: content pack problems
* ref: better code performance
* ref: predicate properties

## [1.12.2 - 3.0.2]

* feat/fix: better and working system for relinking inputs after SignalBox Placement
Expand Down
2 changes: 1 addition & 1 deletion contentPackLib
4 changes: 0 additions & 4 deletions src/main/java/com/troblecodings/signals/SEProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ public boolean testMap(final Map<SEProperty, String> t) {
return this.deps.test(t);
}

public static SEProperty cst(final Object iup) {
return (SEProperty) iup;
}

public JsonEnum getParent() {
return parent;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.troblecodings.signals.blocks;

import com.troblecodings.signals.config.ConfigHandler;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
Expand All @@ -17,6 +19,7 @@ public class GhostBlock extends BasicBlock {

public GhostBlock() {
super(Material.GLASS);
setLightLevel(ConfigHandler.lightEmission / 15.0F);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/troblecodings/signals/blocks/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public AxisAlignedBB getBoundingBox(final IBlockState state, final IBlockAccess
final BlockPos pos) {
return BOUNDING_BOX;
}
}
}
101 changes: 48 additions & 53 deletions src/main/java/com/troblecodings/signals/blocks/Signal.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.google.common.collect.ImmutableList;
import com.troblecodings.signals.OpenSignalsMain;
import com.troblecodings.signals.SEProperty;
import com.troblecodings.signals.config.ConfigHandler;
import com.troblecodings.signals.core.JsonEnum;
import com.troblecodings.signals.core.PosIdentifier;
import com.troblecodings.signals.core.RenderOverlayInfo;
Expand All @@ -29,9 +30,7 @@
import com.troblecodings.signals.init.OSItems;
import com.troblecodings.signals.items.Placementtool;
import com.troblecodings.signals.parser.ValuePack;
import com.troblecodings.signals.properties.BooleanProperty;
import com.troblecodings.signals.properties.FloatProperty;
import com.troblecodings.signals.properties.HeightProperty;
import com.troblecodings.signals.properties.PredicatedPropertyBase.PredicateProperty;
import com.troblecodings.signals.properties.SoundProperty;
import com.troblecodings.signals.tileentitys.SignalTileEntity;

Expand Down Expand Up @@ -83,7 +82,6 @@ public class Signal extends BasicBlock {
private final int id;
private List<SEProperty> signalProperties;
private final Map<SEProperty, Integer> signalPropertiesToInt = new HashMap<>();
private SEProperty powerProperty = null;

public Signal(final SignalProperties prop) {
super(Material.ROCK);
Expand All @@ -96,6 +94,7 @@ public Signal(final SignalProperties prop) {
final SEProperty property = signalProperties.get(i);
signalPropertiesToInt.put(property, i);
}
setLightLevel(ConfigHandler.lightEmission / 15.0f);
}

public int getID() {
Expand All @@ -105,8 +104,8 @@ public int getID() {
@Override
public AxisAlignedBB getBoundingBox(final IBlockState state, final IBlockAccess source,
final BlockPos pos) {
final SignalTileEntity te = (SignalTileEntity) source.getTileEntity(pos);
if (te == null)
final TileEntity te = source.getTileEntity(pos);
if (te == null || !(te instanceof SignalTileEntity))
return FULL_BLOCK_AABB;
final World world = te.getWorld();
final SignalStateInfo info = new SignalStateInfo(world, pos, this);
Expand Down Expand Up @@ -246,11 +245,10 @@ public void breakBlock(final World worldIn, final BlockPos pos, final IBlockStat
}
}

@SuppressWarnings("unchecked")
public int getHeight(final Map<SEProperty, String> map) {
for (final HeightProperty property : this.prop.signalHeights) {
if (property.predicate.test(map))
return property.height;
for (final PredicateProperty<Integer> property : this.prop.signalHeights) {
if (property.test(map))
return property.state;
}
return this.prop.defaultHeight;
}
Expand Down Expand Up @@ -293,7 +291,6 @@ public void renderOverlay(final RenderOverlayInfo info) {
this.renderOverlay(info, this.prop.customNameRenderHeight);
}

@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void renderScaleOverlay(final RenderOverlayInfo info, final float renderHeight) {
final Map<SEProperty, String> map = ClientSignalStateHandler.getClientStates(
Expand All @@ -302,9 +299,9 @@ public void renderScaleOverlay(final RenderOverlayInfo info, final float renderH
if (customNameState == null || customNameState.equalsIgnoreCase("FALSE"))
return;
float customRenderHeight = renderHeight;
for (final FloatProperty property : this.prop.customRenderHeights) {
for (final PredicateProperty<Float> property : this.prop.customRenderHeights) {
if (property.predicate.test(map)) {
customRenderHeight = property.height;
customRenderHeight = property.state;
}
if (customRenderHeight == -1)
return;
Expand All @@ -316,9 +313,9 @@ public void renderScaleOverlay(final RenderOverlayInfo info, final float renderH
return;
}
boolean doubleSidedText = false;
for (final BooleanProperty boolProp : this.prop.doubleSidedText) {
for (final PredicateProperty<Boolean> boolProp : this.prop.doubleSidedText) {
if (boolProp.predicate.test(map)) {
doubleSidedText = boolProp.doubleSided;
doubleSidedText = boolProp.state;
}
}
final SignalAngel face = state.getValue(Signal.ANGEL);
Expand Down Expand Up @@ -354,7 +351,6 @@ public void renderSingleScaleOverlay(final RenderOverlayInfo info) {
GlStateManager.popMatrix();
}

@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void renderOverlay(final RenderOverlayInfo info, final float renderHeight) {
float customRenderHeight = renderHeight;
Expand All @@ -363,9 +359,9 @@ public void renderOverlay(final RenderOverlayInfo info, final float renderHeight
final String customNameState = map.get(CUSTOMNAME);
if (customNameState == null || customNameState.equalsIgnoreCase("FALSE"))
return;
for (final FloatProperty property : this.prop.customRenderHeights) {
for (final PredicateProperty<Float> property : this.prop.customRenderHeights) {
if (property.predicate.test(map)) {
customRenderHeight = property.height;
customRenderHeight = property.state;
}
}
if (customRenderHeight == -1)
Expand All @@ -377,9 +373,9 @@ public void renderOverlay(final RenderOverlayInfo info, final float renderHeight
return;
}
boolean doubleSidedText = false;
for (final BooleanProperty boolProp : this.prop.doubleSidedText) {
for (final PredicateProperty<Boolean> boolProp : this.prop.doubleSidedText) {
if (boolProp.predicate.test(map)) {
doubleSidedText = boolProp.doubleSided;
doubleSidedText = boolProp.state;
}
}

Expand Down Expand Up @@ -439,44 +435,45 @@ public boolean onBlockActivated(final World world, final BlockPos pos, final IBl
return false;
}
final SignalStateInfo stateInfo = new SignalStateInfo(world, pos, this);
if (loadRedstoneOutput(world, stateInfo)) {
world.setBlockState(pos, state, 3);
world.notifyNeighborsOfStateChange(pos, this, false);
world.markAndNotifyBlock(pos, null, state, state, 3);
return true;
}
final boolean customname = canHaveCustomname(SignalStateHandler.getStates(stateInfo));
if ((canBeLinked() || customname)) {
final Map<SEProperty, String> states = SignalStateHandler.getStates(stateInfo);
final boolean customname = canHaveCustomname(states);
if (player.getHeldItemMainhand().getItem().equals(OSItems.MANIPULATOR)
&& (canBeLinked() || customname)) {
if (world.isRemote)
return true;
OpenSignalsMain.handler.invokeGui(Signal.class, player, world, pos, "signal");
return true;
}
return false;
if (loadRedstoneOutput(world, stateInfo, states)) {
world.setBlockState(pos, state, 3);
world.notifyNeighborsOfStateChange(pos, this, true);
world.markAndNotifyBlock(pos, null, state, state, 3);
}
return true;
}

@SuppressWarnings("unchecked")
private boolean loadRedstoneOutput(final World worldIn, final SignalStateInfo info) {
private boolean loadRedstoneOutput(final World worldIn, final SignalStateInfo info,
final Map<SEProperty, String> properties) {
if (!this.prop.redstoneOutputs.isEmpty()) {
final Map<SEProperty, String> properties = SignalStateHandler.getStates(info);
this.powerProperty = null;
for (final ValuePack pack : this.prop.redstoneOutputs) {
if (pack.predicate.test(properties)) {
this.powerProperty = pack.property;
SignalStateHandler.getState(info, pack.property).ifPresent(power -> {
SignalStateHandler.setState(info, pack.property,
Boolean.toString(!Boolean.valueOf(power)));
});
if (properties.containsKey(pack.property) && pack.predicate.test(properties)) {
SignalStateHandler.setState(info, pack.property,
Boolean.toString(!Boolean.valueOf(properties.get(pack.property))));
return true;
}
}
}
return false;
}

public boolean hasRedstoneOut() {
return !this.prop.redstoneOutputs.isEmpty() || !this.prop.redstoneOutputPacks.isEmpty();
}

@Override
public boolean canProvidePower(final IBlockState state) {
return !this.prop.redstoneOutputs.isEmpty();
return hasRedstoneOut();
}

@Override
Expand All @@ -489,25 +486,24 @@ public int getStrongPower(final IBlockState blockState, final IBlockAccess block
@Override
public int getWeakPower(final IBlockState blockState, final IBlockAccess blockAccess,
final BlockPos pos, final EnumFacing side) {
if (this.prop.redstoneOutputs.isEmpty() || this.powerProperty == null
|| !(blockAccess instanceof World)) {
if (!hasRedstoneOut() || !(blockAccess instanceof World)) {
return 0;
}
final SignalStateInfo stateInfo = new SignalStateInfo((World) blockAccess, pos, this);
if (SignalStateHandler.getState(stateInfo, powerProperty)
.filter(power -> power.equalsIgnoreCase("false")).isPresent()) {
return 0;
}
final Map<SEProperty, String> properties = SignalStateHandler.getStates(stateInfo);
for (final ValuePack pack : this.prop.redstoneOutputs) {
if (pack.predicate.test(properties)) {
return 15;
for (final List<ValuePack> valuePacks : ImmutableList.of(this.prop.redstoneOutputPacks,
this.prop.redstoneOutputs)) {
for (final ValuePack pack : valuePacks) {
if (properties.containsKey(pack.property) && pack.predicate.test(properties)
&& !properties.get(pack.property)
.equalsIgnoreCase(pack.property.getDefault())) {
return 15;
}
}
}
return 0;
}

@SuppressWarnings("unchecked")
public void getUpdate(final World world, final BlockPos pos) {
if (this.prop.sounds.isEmpty())
return;
Expand All @@ -519,7 +515,7 @@ public void getUpdate(final World world, final BlockPos pos) {
return;

if (sound.duration == 1) {
world.playSound(null, pos, sound.sound, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.playSound(null, pos, sound.state, SoundCategory.BLOCKS, 1.0F, 1.0F);
} else {
if (world.isUpdateScheduled(pos, this)) {
return;
Expand All @@ -531,14 +527,13 @@ public void getUpdate(final World world, final BlockPos pos) {
}
}

@SuppressWarnings("unchecked")
public SoundProperty getSound(final Map<SEProperty, String> map) {
for (final SoundProperty property : this.prop.sounds) {
if (property.predicate.test(map)) {
return property;
}
}
return new SoundProperty();
return new SoundProperty(null, t -> true, 0);
}

@Override
Expand All @@ -552,7 +547,7 @@ public void updateTick(final World worldIn, final BlockPos pos, final IBlockStat
if (sound.duration <= 1) {
return;
}
worldIn.playSound(null, pos, sound.sound, SoundCategory.BLOCKS, 1.0F, 1.0F);
worldIn.playSound(null, pos, sound.state, SoundCategory.BLOCKS, 1.0F, 1.0F);
worldIn.scheduleUpdate(pos, this, sound.duration);
}

Expand Down
Loading
Loading