-
Notifications
You must be signed in to change notification settings - Fork 2
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
11 changed files
with
120 additions
and
26 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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/tangykiwi/kiwiclient/mixin/ClientPlayerEntityAccessor.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,14 @@ | ||
package com.tangykiwi.kiwiclient.mixin; | ||
|
||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.network.message.ChatMessageSigner; | ||
import net.minecraft.network.message.MessageSignature; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(ClientPlayerEntity.class) | ||
public interface ClientPlayerEntityAccessor { | ||
@Invoker("signChatMessage") | ||
MessageSignature _signChatMessage(ChatMessageSigner signer, Text message); | ||
} |
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
37 changes: 37 additions & 0 deletions
37
src/main/java/com/tangykiwi/kiwiclient/mixin/SimpleOptionMixin.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,37 @@ | ||
package com.tangykiwi.kiwiclient.mixin; | ||
|
||
import com.tangykiwi.kiwiclient.mixininterface.ISimpleOption; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.option.SimpleOption; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Consumer; | ||
|
||
@Mixin(SimpleOption.class) | ||
public class SimpleOptionMixin<T> implements ISimpleOption<T> { | ||
@Shadow | ||
T value; | ||
|
||
@Shadow | ||
@Final | ||
private Consumer<T> changeCallback; | ||
|
||
@Override | ||
public void forceSetValue(T newValue) | ||
{ | ||
if(!MinecraftClient.getInstance().isRunning()) | ||
{ | ||
value = newValue; | ||
return; | ||
} | ||
|
||
if(!Objects.equals(value, newValue)) | ||
{ | ||
value = newValue; | ||
changeCallback.accept(value); | ||
} | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
src/main/java/com/tangykiwi/kiwiclient/mixininterface/IClientPlayerEntity.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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
package com.tangykiwi.kiwiclient.mixininterface; | ||
|
||
public interface IClientPlayerEntity { | ||
void setNoClip(boolean noClip); | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/tangykiwi/kiwiclient/mixininterface/ISimpleOption.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,5 @@ | ||
package com.tangykiwi.kiwiclient.mixininterface; | ||
|
||
public interface ISimpleOption<T> { | ||
public void forceSetValue(T newValue); | ||
} |
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