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) * Fixed Accurate Placement Protocol with V3 * cleanup * cleanup * cleanup * Add Servux detection * Add Servux detection
- Loading branch information
1 parent
b30bd0e
commit 36a640f
Showing
15 changed files
with
554 additions
and
198 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,52 @@ | ||
package fi.dy.masa.tweakeroo.data; | ||
|
||
import net.minecraft.util.Identifier; | ||
|
||
public class DataManager | ||
{ | ||
private static final DataManager INSTANCE = new DataManager(); | ||
private boolean hasCarpetServer; | ||
private boolean hasServuxServer; | ||
public static final Identifier CARPET_HELLO = Identifier.of("carpet", "hello"); | ||
public static final Identifier SERVUX_ENTITY_DATA = Identifier.of("servux", "entity_data"); | ||
|
||
private DataManager() | ||
{ | ||
} | ||
|
||
public static DataManager getInstance() { return INSTANCE; } | ||
|
||
public void reset(boolean isLogout) | ||
{ | ||
if (isLogout) | ||
{ | ||
//Tweakeroo.logger.info("DataManager#reset() - log-out"); | ||
this.hasCarpetServer = false; | ||
this.hasServuxServer = false; | ||
} | ||
//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; | ||
} | ||
|
||
public void setHasServuxServer(boolean toggle) | ||
{ | ||
this.hasServuxServer = toggle; | ||
} | ||
|
||
public boolean hasServuxServer() | ||
{ | ||
return this.hasServuxServer; | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
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,26 @@ | ||
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.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)) | ||
{ | ||
DataManager.getInstance().setHasCarpetServer(true); | ||
} | ||
else if (packet.payload().getId().id().equals(DataManager.SERVUX_ENTITY_DATA)) | ||
{ | ||
DataManager.getInstance().setHasServuxServer(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.