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
1 parent
15bbf66
commit 07403ac
Showing
3 changed files
with
47 additions
and
2 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
39 changes: 39 additions & 0 deletions
39
src/main/java/knightminer/inspirations/common/network/RenderBlockUpdatePacket.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,39 @@ | ||
package knightminer.inspirations.common.network; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.network.NetHandlerPlayClient; | ||
import net.minecraft.network.NetHandlerPlayServer; | ||
import net.minecraft.util.math.BlockPos; | ||
import slimeknights.mantle.network.AbstractPacketThreadsafe; | ||
|
||
public class RenderBlockUpdatePacket extends AbstractPacketThreadsafe { | ||
public BlockPos pos; | ||
|
||
public RenderBlockUpdatePacket() {} | ||
|
||
public RenderBlockUpdatePacket(BlockPos pos) { | ||
this.pos = pos; | ||
} | ||
|
||
@Override | ||
public void handleClientSafe(NetHandlerPlayClient netHandler) { | ||
Minecraft.getMinecraft().renderGlobal.notifyBlockUpdate(null, pos, null, null, 0); | ||
} | ||
|
||
@Override | ||
public void handleServerSafe(NetHandlerPlayServer netHandler) { | ||
// only send to clients | ||
throw new UnsupportedOperationException("Clientside only"); | ||
} | ||
|
||
@Override | ||
public void fromBytes(ByteBuf buf) { | ||
this.pos = readPos(buf); | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf buf) { | ||
writePos(pos, buf); | ||
} | ||
} |
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