forked from maruohon/tweakeroo
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempting to fix accurate placement protocol for the Crafter (Doesn'…
…t yet work)
- Loading branch information
1 parent
b30bd0e
commit f240edf
Showing
16 changed files
with
721 additions
and
168 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
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,38 @@ | ||
package fi.dy.masa.tweakeroo.data; | ||
|
||
import net.minecraft.util.Identifier; | ||
|
||
public class DataManager | ||
{ | ||
private static final DataManager INSTANCE = new DataManager(); | ||
private boolean hasCarpetServer; | ||
public static final Identifier CARPET_HELLO = Identifier.of("carpet", "hello"); | ||
|
||
private DataManager() | ||
{ | ||
} | ||
|
||
public static DataManager getInstance() { return INSTANCE; } | ||
|
||
public void reset(boolean isLogout) | ||
{ | ||
if (isLogout) | ||
{ | ||
//Tweakeroo.logger.info("DataManager#reset() - log-out"); | ||
} | ||
else | ||
{ | ||
//Tweakeroo.logger.info("DataManager#reset() - dimension change or log-in"); | ||
} | ||
} | ||
|
||
public void setHasCarpetServer(boolean toggle) | ||
{ | ||
this.hasCarpetServer = toggle; | ||
} | ||
|
||
public boolean hasCarpetServer() | ||
{ | ||
return this.hasCarpetServer; | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommonNetworkHandler.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,24 @@ | ||
package fi.dy.masa.tweakeroo.mixin; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import net.minecraft.client.network.ClientCommonNetworkHandler; | ||
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket; | ||
import fi.dy.masa.tweakeroo.Tweakeroo; | ||
import fi.dy.masa.tweakeroo.data.DataManager; | ||
|
||
@Mixin(ClientCommonNetworkHandler.class) | ||
public class MixinClientCommonNetworkHandler | ||
{ | ||
@Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", at = @At("HEAD")) | ||
private void tweakeroo_onCustomPayload(CustomPayloadS2CPacket packet, CallbackInfo ci) | ||
{ | ||
if (packet.payload().getId().id().equals(DataManager.CARPET_HELLO)) | ||
{ | ||
Tweakeroo.debugLog("ClientCommonNetworkHandler#tweakeroo_onCustomPayload(): received carpet hello packet"); | ||
DataManager.getInstance().setHasCarpetServer(true); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.