-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
2b3f2f5
commit 7fe2a89
Showing
5 changed files
with
68 additions
and
9 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
48 changes: 48 additions & 0 deletions
48
src/main/java/refinedstorage/network/MessageGridCraftingShift.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,48 @@ | ||
package refinedstorage.network; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.tileentity.TileEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage; | ||
import refinedstorage.block.EnumGridType; | ||
import refinedstorage.container.ContainerGrid; | ||
import refinedstorage.tile.grid.TileGrid; | ||
|
||
public class MessageGridCraftingShift extends MessageHandlerPlayerToServer<MessageGridCraftingShift> implements IMessage { | ||
private int x; | ||
private int y; | ||
private int z; | ||
|
||
public MessageGridCraftingShift() { | ||
} | ||
|
||
public MessageGridCraftingShift(TileGrid grid) { | ||
this.x = grid.getPos().getX(); | ||
this.y = grid.getPos().getY(); | ||
this.z = grid.getPos().getZ(); | ||
} | ||
|
||
@Override | ||
public void fromBytes(ByteBuf buf) { | ||
x = buf.readInt(); | ||
y = buf.readInt(); | ||
z = buf.readInt(); | ||
} | ||
|
||
@Override | ||
public void toBytes(ByteBuf buf) { | ||
buf.writeInt(x); | ||
buf.writeInt(y); | ||
buf.writeInt(z); | ||
} | ||
|
||
@Override | ||
public void handle(MessageGridCraftingShift message, EntityPlayerMP player) { | ||
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z)); | ||
|
||
if (tile instanceof TileGrid && ((TileGrid) tile).getType() == EnumGridType.CRAFTING && player.openContainer instanceof ContainerGrid) { | ||
((ContainerGrid) player.openContainer).getGrid().onCraftedShift((ContainerGrid) player.openContainer, player); | ||
} | ||
} | ||
} |
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