本文整理汇总了Java中net.minecraftforge.common.ForgeHooks.onTravelToDimension方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeHooks.onTravelToDimension方法的具体用法?Java ForgeHooks.onTravelToDimension怎么用?Java ForgeHooks.onTravelToDimension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.ForgeHooks
的用法示例。
在下文中一共展示了ForgeHooks.onTravelToDimension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEntityTeleport
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
private static Entity handleEntityTeleport(Entity entity, MinecraftServer server, int sourceDim, int targetDim, double xCoord, double yCoord, double zCoord, float yaw, float pitch, Vector3d motion) {
if (entity == null || entity.getEntityWorld().isRemote) {
return entity;
}
boolean interDimensional = sourceDim != targetDim;
if (interDimensional && !ForgeHooks.onTravelToDimension(entity, targetDim)) {
return entity;
}
if (interDimensional) {
if (entity instanceof EntityPlayerMP) {
return teleportPlayerToDim((EntityPlayerMP) entity, server, sourceDim, targetDim, xCoord, yCoord, zCoord, yaw, pitch, motion);
}
else {
return teleportEntityToDim(entity, server, sourceDim, targetDim, xCoord, yCoord, zCoord, yaw, pitch, motion);
}
}
else {
if (entity instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) entity;
player.connection.setPlayerLocation(xCoord, yCoord, zCoord, yaw, pitch);
player.setRotationYawHead(yaw);
player.motionX += motion.x; player.motionY += motion.y; player.motionZ += motion.z;
NBTTagCompound nbt = new NBTTagCompound();
nbt.setDouble("X", motion.x);
nbt.setDouble("Y", motion.y);
nbt.setDouble("Z", motion.z);
CrystalModNetwork.sendToAll(new PacketEntityMessage(player, "AddMotion", nbt));
}
else {
entity.setLocationAndAngles(xCoord, yCoord, zCoord, yaw, pitch);
entity.setRotationYawHead(yaw);
entity.motionX += motion.x; entity.motionY += motion.y; entity.motionZ += motion.z;
}
}
return entity;
}
示例2: teleportPlayer
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
private void teleportPlayer(boolean shouldSpawnPortal)
{
if (this.thePlayer instanceof EntityPlayerMP)
{
int previousDimension = this.thePlayer.dimension;
int transferDimension = previousDimension == AetherConfig.getAetherDimensionID() ? 0 : AetherConfig.getAetherDimensionID();
if (ForgeHooks.onTravelToDimension(this.thePlayer, transferDimension))
{
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
TeleporterAether teleporter = new TeleporterAether(shouldSpawnPortal, server.worldServerForDimension(transferDimension));
for (Entity passenger : this.thePlayer.getPassengers())
{
transferEntity(shouldSpawnPortal, passenger, server.worldServerForDimension(previousDimension), server.worldServerForDimension(transferDimension));
passenger.dismountRidingEntity();
}
server.getPlayerList().transferPlayerToDimension((EntityPlayerMP) this.thePlayer, transferDimension, teleporter);
if (this.thePlayer.getRidingEntity() != null)
{
transferEntity(shouldSpawnPortal, this.thePlayer.getRidingEntity(), server.worldServerForDimension(previousDimension), server.worldServerForDimension(transferDimension));
}
}
}
}
示例3: onEntityCollidedWithBlock
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, IBlockState state, Entity par5Entity)
{
if (!par5Entity.isRiding() && !par5Entity.isBeingRidden() && !par1World.isRemote)
if(par5Entity.timeUntilPortal <= 0){
if(par5Entity instanceof EntityPlayerMP){
EntityPlayerMP thePlayer = (EntityPlayerMP)par5Entity;
// thePlayer.addStat(ACAchievements.enter_omothol, 1);
thePlayer.timeUntilPortal = ACConfig.portalCooldown;
if (thePlayer.dimension != ACLib.omothol_id)
{
if(!ForgeHooks.onTravelToDimension(thePlayer, ACLib.omothol_id)) return;
thePlayer.mcServer.getPlayerList().transferPlayerToDimension(thePlayer, ACLib.omothol_id, new TeleporterAC(thePlayer.mcServer.getWorld(ACLib.omothol_id), this, ACBlocks.stone.getStateFromMeta(6)));
}
else {
if(!ForgeHooks.onTravelToDimension(thePlayer, ACLib.abyssal_wasteland_id)) return;
thePlayer.mcServer.getPlayerList().transferPlayerToDimension(thePlayer, ACLib.abyssal_wasteland_id, new TeleporterAC(thePlayer.mcServer.getWorld(ACLib.abyssal_wasteland_id), this, ACBlocks.stone.getStateFromMeta(6)));
}
} else {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
par5Entity.timeUntilPortal = par5Entity.getPortalCooldown();
if(par5Entity.dimension != ACLib.omothol_id){
if(!ForgeHooks.onTravelToDimension(par5Entity, ACLib.omothol_id)) return;
int i = par5Entity.dimension;
par5Entity.dimension = ACLib.omothol_id;
par1World.removeEntityDangerously(par5Entity);
par5Entity.isDead = false;
server.getPlayerList().transferEntityToWorld(par5Entity, i, server.getWorld(i), server.getWorld(ACLib.omothol_id), new TeleporterAC(server.getWorld(ACLib.omothol_id), this, ACBlocks.stone.getStateFromMeta(6)));
} else {
if(!ForgeHooks.onTravelToDimension(par5Entity, ACLib.dreadlands_id)) return;
par5Entity.dimension = ACLib.dreadlands_id;
par1World.removeEntityDangerously(par5Entity);
par5Entity.isDead = false;
server.getPlayerList().transferEntityToWorld(par5Entity, ACLib.omothol_id, server.getWorld(ACLib.omothol_id), server.getWorld(ACLib.dreadlands_id), new TeleporterAC(server.getWorld(ACLib.dreadlands_id), this, ACBlocks.stone.getStateFromMeta(6)));
}
}
} else par5Entity.timeUntilPortal = par5Entity.getPortalCooldown();
}
示例4: onEntityCollidedWithBlock
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, IBlockState state, Entity par5Entity)
{
if (!par5Entity.isRiding() && !par5Entity.isBeingRidden() && !par1World.isRemote)
if(par5Entity.timeUntilPortal <= 0){
if(par5Entity instanceof EntityPlayerMP){
EntityPlayerMP thePlayer = (EntityPlayerMP)par5Entity;
// thePlayer.addStat(ACAchievements.enter_abyssal_wasteland, 1);
thePlayer.timeUntilPortal = ACConfig.portalCooldown;
if (thePlayer.dimension != ACLib.abyssal_wasteland_id)
{
if(!ForgeHooks.onTravelToDimension(thePlayer, ACLib.abyssal_wasteland_id)) return;
thePlayer.mcServer.getPlayerList().transferPlayerToDimension(thePlayer, ACLib.abyssal_wasteland_id, new TeleporterAC(thePlayer.mcServer.getWorld(ACLib.abyssal_wasteland_id), this, ACBlocks.stone.getStateFromMeta(1)));
}
else {
if(!ForgeHooks.onTravelToDimension(thePlayer, 0)) return;
thePlayer.mcServer.getPlayerList().transferPlayerToDimension(thePlayer, 0, new TeleporterAC(thePlayer.mcServer.getWorld(0), this, ACBlocks.stone.getStateFromMeta(1)));
}
} else {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
par5Entity.timeUntilPortal = par5Entity.getPortalCooldown();
if(par5Entity.dimension != ACLib.abyssal_wasteland_id){
if(!ForgeHooks.onTravelToDimension(par5Entity, ACLib.abyssal_wasteland_id)) return;
int i = par5Entity.dimension;
par5Entity.dimension = ACLib.abyssal_wasteland_id;
par1World.removeEntityDangerously(par5Entity);
par5Entity.isDead = false;
server.getPlayerList().transferEntityToWorld(par5Entity, i, server.getWorld(i), server.getWorld(ACLib.abyssal_wasteland_id), new TeleporterAC(server.getWorld(ACLib.abyssal_wasteland_id), this, ACBlocks.stone.getStateFromMeta(1)));
} else {
if(!ForgeHooks.onTravelToDimension(par5Entity, 0)) return;
par5Entity.dimension = 0;
par1World.removeEntityDangerously(par5Entity);
par5Entity.isDead = false;
server.getPlayerList().transferEntityToWorld(par5Entity, ACLib.abyssal_wasteland_id, server.getWorld(ACLib.abyssal_wasteland_id), server.getWorld(0), new TeleporterAC(server.getWorld(0), this, ACBlocks.stone.getStateFromMeta(1)));
}
}
} else par5Entity.timeUntilPortal = par5Entity.getPortalCooldown();
}
示例5: onEntityCollidedWithBlock
import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public void onEntityCollidedWithBlock(World par1World, BlockPos pos, IBlockState state, Entity par5Entity)
{
if (!par5Entity.isRiding() && !par5Entity.isBeingRidden() && !par1World.isRemote)
if(par5Entity.timeUntilPortal <= 0){
if(par5Entity instanceof EntityPlayerMP){
EntityPlayerMP thePlayer = (EntityPlayerMP)par5Entity;
// thePlayer.addStat(ACAchievements.enter_dreadlands, 1);
thePlayer.timeUntilPortal = ACConfig.portalCooldown;
if (thePlayer.dimension != ACLib.dreadlands_id)
{
if(!ForgeHooks.onTravelToDimension(thePlayer, ACLib.dreadlands_id)) return;
thePlayer.mcServer.getPlayerList().transferPlayerToDimension(thePlayer, ACLib.dreadlands_id, new TeleporterAC(thePlayer.mcServer.getWorld(ACLib.dreadlands_id), this, ACBlocks.stone.getStateFromMeta(2)));
}
else {
if(!ForgeHooks.onTravelToDimension(thePlayer, ACLib.abyssal_wasteland_id)) return;
thePlayer.mcServer.getPlayerList().transferPlayerToDimension(thePlayer, ACLib.abyssal_wasteland_id, new TeleporterAC(thePlayer.mcServer.getWorld(ACLib.abyssal_wasteland_id), this, ACBlocks.stone.getStateFromMeta(2)));
}
} else {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
par5Entity.timeUntilPortal = par5Entity.getPortalCooldown();
if(par5Entity.dimension != ACLib.dreadlands_id){
if(!ForgeHooks.onTravelToDimension(par5Entity, ACLib.dreadlands_id)) return;
int i = par5Entity.dimension;
par5Entity.dimension = ACLib.dreadlands_id;
par1World.removeEntityDangerously(par5Entity);
par5Entity.isDead = false;
server.getPlayerList().transferEntityToWorld(par5Entity, i, server.getWorld(i), server.getWorld(ACLib.dreadlands_id), new TeleporterAC(server.getWorld(ACLib.dreadlands_id), this, ACBlocks.stone.getStateFromMeta(2)));
} else {
if(!ForgeHooks.onTravelToDimension(par5Entity, ACLib.abyssal_wasteland_id)) return;
par5Entity.dimension = ACLib.abyssal_wasteland_id;
par1World.removeEntityDangerously(par5Entity);
par5Entity.isDead = false;
server.getPlayerList().transferEntityToWorld(par5Entity, ACLib.dreadlands_id, server.getWorld(ACLib.dreadlands_id), server.getWorld(ACLib.abyssal_wasteland_id), new TeleporterAC(server.getWorld(ACLib.abyssal_wasteland_id), this, ACBlocks.stone.getStateFromMeta(2)));
}
}
} else par5Entity.timeUntilPortal = par5Entity.getPortalCooldown();
}