mffs/src/main/java/mffs/base/PacketTileHandler.java

24 lines
734 B
Java
Raw Normal View History

2022-10-28 16:20:12 +02:00
package mffs.base;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
2023-01-08 16:58:21 +01:00
public class PacketTileHandler implements IMessageHandler<PacketTile, IMessage> {
@Override
public IMessage onMessage(PacketTile arg0, MessageContext arg1) {
World w = arg1.getServerHandler().playerEntity.worldObj;
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
TileEntity te = arg0.pos.getTileEntity(w);
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
if (!(te instanceof TileEntityBase))
return null;
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
((TileEntityBase) te).onReceivePacket(arg0.type, arg0.data);
2022-10-28 16:20:12 +02:00
2023-01-08 16:58:21 +01:00
return null;
}
2022-10-28 16:20:12 +02:00
}