Applied-Energistics-2-tiler.../core/sync/packets/PacketNewStorageDimension.java
AlgorithmX2 6beaa85da6 Website Name Fix.
Meteorite Spawns tweaked and chest contents tweaked.
Catch Dimension Registration.
2014-03-08 17:31:09 -06:00

53 lines
1.1 KiB
Java

package appeng.core.sync.packets;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.DimensionManager;
import appeng.core.AEConfig;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PacketNewStorageDimension extends AppEngPacket
{
final int newDim;
// automatic.
public PacketNewStorageDimension(ByteBuf stream) throws IOException {
newDim = stream.readInt();
}
@Override
@SideOnly(Side.CLIENT)
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player)
{
try
{
DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID );
}
catch (IllegalArgumentException iae)
{
// ok!
}
}
// api
public PacketNewStorageDimension(int newDim) throws IOException {
this.newDim = newDim;
ByteBuf data = Unpooled.buffer();
data.writeInt( getPacketID() );
data.writeInt( newDim );
configureWrite( data );
}
}