Fixed crashbug, now to fix rendering
This commit is contained in:
parent
f88c314922
commit
4e0b7fa977
4 changed files with 60 additions and 18 deletions
|
@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
|
@ -11,6 +12,10 @@ import net.minecraft.network.packet.Packet1Login;
|
|||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.network.ForgePacket;
|
||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
@ -20,26 +25,12 @@ public class ConnectionHandler implements IConnectionHandler
|
|||
@Override
|
||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
/**
|
||||
try
|
||||
for(NewDimData data : PocketManager.getDimensions())
|
||||
{
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
DataOutputStream writer = new DataOutputStream(buffer);
|
||||
writer.writeByte(PacketConstants.CLIENT_JOIN_PACKET_ID);
|
||||
PocketManager.writePacket(writer);
|
||||
writer.close();
|
||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||
packet.data = buffer.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
manager.addToSendQueue(packet);
|
||||
|
||||
Packet250CustomPayload[] pkt = ForgePacket.makePacketSet(new DimensionRegisterPacket(data.id(), DimensionManager.getProviderType(data.id())));
|
||||
manager.addToSendQueue(pkt[0]);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
//This shouldn't happen...
|
||||
e.printStackTrace();
|
||||
}
|
||||
**/
|
||||
return null;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.network.ForgePacket;
|
||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||
import cpw.mods.fml.common.IPlayerTracker;
|
||||
|
||||
public class PlayerTracker implements IPlayerTracker
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPlayerLogin(EntityPlayer player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerLogout(EntityPlayer player) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerChangedDimension(EntityPlayer player) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerRespawn(EntityPlayer player)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ import net.minecraft.entity.item.EntityMinecart;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.network.packet.Packet41EntityEffect;
|
||||
import net.minecraft.network.packet.Packet43Experience;
|
||||
import net.minecraft.network.packet.Packet9Respawn;
|
||||
|
@ -19,6 +20,8 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.network.ForgePacket;
|
||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
|
@ -270,6 +273,7 @@ public class DDTeleporter
|
|||
{
|
||||
throw new IllegalArgumentException("destination cannot be null.");
|
||||
}
|
||||
|
||||
|
||||
//This beautiful teleport method is based off of xCompWiz's teleport function.
|
||||
|
||||
|
@ -316,6 +320,10 @@ public class DDTeleporter
|
|||
{
|
||||
// We need to do all this special stuff to move a player between dimensions.
|
||||
|
||||
//Register the dim on the client when we teleport to it.
|
||||
Packet250CustomPayload[] pkt = ForgePacket.makePacketSet(new DimensionRegisterPacket(newWorld.provider.dimensionId, DimensionManager.getProviderType(newWorld.provider.dimensionId)));
|
||||
player.playerNetServerHandler.sendPacketToPlayer(pkt[0]);
|
||||
|
||||
// Set the new dimension and inform the client that it's moving to a new world.
|
||||
player.dimension = destination.getDimension();
|
||||
player.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(player.dimension, (byte)player.worldObj.difficultySetting, newWorld.getWorldInfo().getTerrainType(), newWorld.getHeight(), player.theItemInWorldManager.getGameType()));
|
||||
|
|
|
@ -50,6 +50,7 @@ import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
|||
import StevenDimDoors.mod_pocketDimClient.ClientPacketHandler;
|
||||
import StevenDimDoors.mod_pocketDimClient.ClientTickHandler;
|
||||
|
||||
import cpw.mods.fml.common.IPlayerTracker;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
@ -136,6 +137,7 @@ public class mod_pocketDim
|
|||
public static DDProperties properties;
|
||||
public static MonolithSpawner spawner; //Added this field temporarily. Will be refactored out later.
|
||||
public static GatewayGenerator riftGen;
|
||||
public static PlayerTracker tracker;
|
||||
|
||||
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab")
|
||||
{
|
||||
|
@ -213,6 +215,8 @@ public class mod_pocketDim
|
|||
mod_pocketDim.pocketBiome= (new BiomeGenPocket(properties.PocketBiomeID));
|
||||
|
||||
GameRegistry.registerWorldGenerator(mod_pocketDim.riftGen);
|
||||
tracker = new PlayerTracker();
|
||||
GameRegistry.registerPlayerTracker(tracker);
|
||||
|
||||
GameRegistry.registerBlock(goldDoor, "Golden Door");
|
||||
GameRegistry.registerBlock(goldDimDoor, "Golden Dimensional Door");
|
||||
|
|
Loading…
Add table
Reference in a new issue