-
Notifications
You must be signed in to change notification settings - Fork 31
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
25 changed files
with
778 additions
and
381 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package xaeroplus.event; | ||
|
||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraftforge.fml.common.eventhandler.Event; | ||
|
||
public class ChunkDataEvent extends Event { | ||
private final boolean isFullChunk; | ||
private final Chunk chunk; | ||
|
||
public ChunkDataEvent(final boolean isFullChunk, final Chunk chunk) { | ||
this.isFullChunk = isFullChunk; | ||
this.chunk = chunk; | ||
} | ||
|
||
public boolean isFullChunk() { | ||
return this.isFullChunk; | ||
} | ||
|
||
public Chunk getChunk() { | ||
return this.chunk; | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
src/main/java/xaeroplus/mixin/client/mc/MixinNetHandlerPlayClient.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,23 @@ | ||
package xaeroplus.mixin.client.mc; | ||
|
||
import net.minecraft.client.multiplayer.WorldClient; | ||
import net.minecraft.client.network.NetHandlerPlayClient; | ||
import net.minecraft.network.play.server.SPacketChunkData; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import xaeroplus.XaeroPlus; | ||
import xaeroplus.event.ChunkDataEvent; | ||
|
||
@Mixin(NetHandlerPlayClient.class) | ||
public class MixinNetHandlerPlayClient { | ||
@Shadow | ||
private WorldClient world; | ||
|
||
@Inject(method = "handleChunkData", at = @At("RETURN")) | ||
public void handleChunkData(final SPacketChunkData packetIn, final CallbackInfo ci) { | ||
XaeroPlus.EVENT_BUS.post(new ChunkDataEvent(packetIn.isFullChunk(), this.world.getChunk(packetIn.getChunkX(), packetIn.getChunkZ()))); | ||
} | ||
} |
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.