Commit cb6b2b69 authored by Matchlighter's avatar Matchlighter
Browse files

Removed deprecated PacketDescribe classes. Removed internal PacketHandler

parent e442f52e
package ml.core;
import net.minecraftforge.common.MinecraftForge;
import ml.core.internal.PacketHandler;
import ml.core.texture.CustomTextureMapManager;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
@Mod(modid="MLCore", name="MLCore")
@NetworkMod(versionBounds="[0.6,)", clientSideRequired=false, serverSideRequired=false, channels={"MLCore"}, packetHandler=PacketHandler.class)
//@NetworkMod(versionBounds="[0.6,)", clientSideRequired=false, serverSideRequired=false, channels={"MLCore"}, packetHandler=PacketHandler.class)
@TransformerExclusions({"ml"})
public class MLCore { // implements IFMLLoadingPlugin
......
package ml.core.internal;
import ml.core.network.PacketDescribeConnectable;
public class PacketHandler extends ml.core.network.PacketHandler {
public PacketHandler() {
addHandler(PacketDescribeConnectable.class);
}
}
package ml.core.network;
import java.io.IOException;
import ml.core.tile.IRotatableTE;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import com.google.common.io.ByteArrayDataInput;
@Deprecated
public abstract class PacketDescribe extends MLPacket {
public @data int x;
public @data int y;
public @data int z;
public @data ForgeDirection facing;
public PacketDescribe(TileEntity te, String ch) {
super(ch);
x = te.xCoord;
y = te.yCoord;
z = te.zCoord;
facing = (te instanceof IRotatableTE) ? ((IRotatableTE)te).getFacing() : ForgeDirection.UNKNOWN;
}
public PacketDescribe(EntityPlayer pl, ByteArrayDataInput data) {
super(pl, data);
}
@Override
public void handleClientSide(EntityPlayer epl) throws IOException{
TileEntity te = epl.worldObj.getBlockTileEntity(x, y, z);
if (te instanceof IRotatableTE){
((IRotatableTE)te).setFacing(facing);
}
handleClientSide(te, epl);
}
public abstract void handleClientSide(TileEntity te, EntityPlayer epl) throws IOException;
@Override
public void handleServerSide(EntityPlayer epl) throws IOException {};
}
package ml.core.network;
import java.io.IOException;
import ml.core.tile.TileEntityConnectable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.Player;
/**
* Can be extended or left untouched.
* You do not need to add this to your PacketHandler unless you extend it; MLCore features a minimal PacketHandler.
*/
@Deprecated
public class PacketDescribeConnectable extends PacketDescribe {
public @data ForgeDirection linkDir;
public PacketDescribeConnectable(TileEntityConnectable tec, String ch) {
super(tec, ch);
linkDir = tec.linkedDir;
}
public PacketDescribeConnectable(EntityPlayer pl, ByteArrayDataInput data) {
super(pl, data);
}
@Override
public void handleClientSide(TileEntity te, EntityPlayer epl) throws IOException {
TileEntityConnectable tec = (TileEntityConnectable)te;
tec.linkedDir = linkDir;
}
}
package ml.core.tile;
import ml.core.network.PacketDescribeConnectable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.common.network.PacketDispatcher;
public class TileEntityConnectable extends TileEntity {
public abstract class TileEntityConnectable extends TileEntity {
public ForgeDirection facing = ForgeDirection.NORTH;
public ForgeDirection linkedDir = ForgeDirection.UNKNOWN;
......@@ -53,10 +52,7 @@ public class TileEntityConnectable extends TileEntity {
}
@Override
public Packet getDescriptionPacket() {
PacketDescribeConnectable pdc = new PacketDescribeConnectable(this, "MLCore");
return pdc.convertToPkt250();
}
public abstract Packet getDescriptionPacket();
private void sendPacket() {
PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.getWorldInfo().getDimension());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment