forked from gnembon/carpetmod
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
63 additions
and
1 deletion.
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
29 changes: 29 additions & 0 deletions
29
src/main/java/carpet/logging/instantfall/InstantFallFlagWatcher.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package carpet.logging.instantfall; | ||
|
||
import net.minecraft.block.BlockFalling; | ||
|
||
public class InstantFallFlagWatcher | ||
{ | ||
private static final InstantFallFlagWatcher INSTANCE = new InstantFallFlagWatcher(); | ||
|
||
private boolean previousFlag; | ||
|
||
private InstantFallFlagWatcher() | ||
{ | ||
this.previousFlag = BlockFalling.fallInstantly; | ||
} | ||
|
||
public static InstantFallFlagWatcher getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
public void tick() | ||
{ | ||
boolean currentFlag = BlockFalling.fallInstantly; | ||
if (currentFlag != this.previousFlag) | ||
{ | ||
InstantFallLogger.getInstance().onInstantFallFlagFlipped(currentFlag); | ||
} | ||
this.previousFlag = currentFlag; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/carpet/logging/instantfall/InstantFallLogger.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package carpet.logging.instantfall; | ||
|
||
import carpet.logging.AbstractLogger; | ||
import carpet.utils.Messenger; | ||
import net.minecraft.util.text.ITextComponent; | ||
|
||
public class InstantFallLogger extends AbstractLogger | ||
{ | ||
public static final String NAME = "instantfall"; | ||
private static final InstantFallLogger INSTANCE = new InstantFallLogger(); | ||
|
||
public InstantFallLogger() | ||
{ | ||
super(NAME); | ||
} | ||
|
||
public static InstantFallLogger getInstance() | ||
{ | ||
return INSTANCE; | ||
} | ||
|
||
public void onInstantFallFlagFlipped(boolean currentFlag) | ||
{ | ||
this.log(() -> new ITextComponent[]{advTr("flag_changed", "InstantFall flag has changed to %s", Messenger.bool(currentFlag))}); | ||
} | ||
} |
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