generated from Turnip-Labs/bta-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
102 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...main/java/deus/stanleylib/StanleyLib.java → ...tanleytemperature/StanleyTemperature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../stanleylib/config/TemperatureConfig.java → ...temperature/config/TemperatureConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/stanleylib/enums/CustomDamageTypes.java → ...ytemperature/enums/CustomDamageTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nleylib/enums/PlayerTemperatureState.java → ...erature/enums/PlayerTemperatureState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../stanleylib/interfaces/IPlayerEntity.java → ...temperature/interfaces/IPlayerEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...ylib/interfaces/IStanleyPlayerEntity.java → ...ture/interfaces/IStanleyPlayerEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...stanleylib/management/SignalAccessor.java → ...emperature/management/SignalAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
...leylib/management/TemperatureManager.java → ...rature/management/TemperatureManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/stanleylib/network/INetHandler.java.wip → ...ytemperature/network/INetHandler.java.wip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...us/stanleylib/network/NetManager.java.wip → ...eytemperature/network/NetManager.java.wip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lib/network/PacketAddTemperature.java.wip → ...ure/network/PacketAddTemperature.java.wip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ib/network/PacketSendTemperature.java.wip → ...re/network/PacketSendTemperature.java.wip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package gssl; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class Signal<T> { | ||
|
||
private final List<Listener<T>> listeners = new ArrayList<>(); | ||
private final List<Listener<T>> removeQueue = new ArrayList<>(); | ||
private boolean emitting = false; | ||
public boolean silenced = false; | ||
|
||
public interface Listener<T> { | ||
void signalEmitted(Signal<T> signal, T t); | ||
} | ||
|
||
public List<Listener<T>> getListeners() { | ||
return Collections.unmodifiableList(listeners); | ||
} | ||
|
||
public void connect(Listener<T> listener) { | ||
if(!listeners.contains(listener)){ | ||
listeners.add(listener); | ||
} | ||
} | ||
|
||
public void disconnect(Listener<T> listener) { | ||
if(!emitting){ | ||
listeners.remove(listener); | ||
} else { | ||
removeQueue.add(listener); | ||
} | ||
} | ||
|
||
public void emit(T t) { | ||
if(!silenced){ | ||
emitting = true; | ||
for (Listener<T> listener : new ArrayList<>(listeners)) { | ||
listener.signalEmitted(this, t); | ||
} | ||
for (Listener<T> listener : removeQueue) { | ||
listeners.remove(listener); | ||
} | ||
removeQueue.clear(); | ||
emitting = false; | ||
} | ||
} | ||
} |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
} | ||
}, | ||
"mixins": [ | ||
"stanleylib.mixins.json" | ||
"stanleytemperature.mixins.json" | ||
], | ||
|
||
"depends": { | ||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/main/resources/stanleylib.mixins.json → .../resources/stanleytemperature.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters