本文整理汇总了Java中net.minecraft.entity.Entity.dismountRidingEntity方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.dismountRidingEntity方法的具体用法?Java Entity.dismountRidingEntity怎么用?Java Entity.dismountRidingEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.dismountRidingEntity方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Schedule the entity for removal during the next tick. Marks the entity dead in anticipation.
*/
public void removeEntity(Entity entityIn)
{
if (entityIn.isBeingRidden())
{
entityIn.removePassengers();
}
if (entityIn.isRiding())
{
entityIn.dismountRidingEntity();
}
entityIn.setDead();
if (entityIn instanceof EntityPlayer)
{
this.playerEntities.remove(entityIn);
this.updateAllPlayersSleepingFlag();
this.onEntityRemoved(entityIn);
}
}
示例2: setCarryingEntity
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void setCarryingEntity(Entity entity) {
if (entity == null) {
for (Entity e : getCarryingEntities()) {
e.dismountRidingEntity();
}
} else {
entity.startRiding(this);
}
}
示例3: fire
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private synchronized boolean fire() {
Entity itemShot = getCloseEntityIfUpgraded();
if (getPressure() >= PneumaticValues.MIN_PRESSURE_AIR_CANNON && (itemShot != null || !inventory.getStackInSlot(CANNON_SLOT).isEmpty())) {
double[] velocity = getVelocityVector(heightAngle, rotationAngle, getForce());
addAir((int) (-500 * getForce()));
boolean shootingInventory = false;
if (itemShot == null) {
shootingInventory = true;
itemShot = getPayloadEntity();
if (itemShot instanceof EntityItem) {
inventory.setStackInSlot(CANNON_SLOT, ItemStack.EMPTY);
if (getUpgrades(EnumUpgrade.BLOCK_TRACKER) > 0) {
trackedItems.add((EntityItem) itemShot);
}
} else {
inventory.extractItem(CANNON_SLOT, 1, false);
}
} else if (itemShot instanceof EntityPlayer) {
EntityPlayerMP entityplayermp = (EntityPlayerMP) itemShot;
if (entityplayermp.connection.getNetworkManager().isChannelOpen()) {
//This is a nasty hack to get around "player moved wrongly!" messages, which can be caused if player movement
// triggers a player teleport (e.g. player moves onto pressure plate, triggers air cannon with an entity tracker).
entityplayermp.invulnerableDimensionChange = true;
entityplayermp.setPositionAndUpdate(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
}
}
if (itemShot.isRiding()) {
itemShot.dismountRidingEntity();
}
itemShot.setPosition(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
NetworkHandler.sendToAllAround(new PacketSetEntityMotion(itemShot, velocity[0], velocity[1], velocity[2]),
new TargetPoint(getWorld().provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 64));
if (itemShot instanceof EntityFireball) {
velocity[0] *= 0.05D;
velocity[1] *= 0.05D;
velocity[2] *= 0.05D;
}
itemShot.motionX = velocity[0];
itemShot.motionY = velocity[1];
itemShot.motionZ = velocity[2];
itemShot.onGround = false;
itemShot.collided = false;
itemShot.collidedHorizontally = false;
itemShot.collidedVertically = false;
if (itemShot instanceof EntityLivingBase) ((EntityLivingBase) itemShot).setJumping(true);
if (shootingInventory && !getWorld().isRemote) getWorld().spawnEntity(itemShot);
for (int i = 0; i < 10; i++) {
double velX = velocity[0] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
double velY = velocity[1] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
double velZ = velocity[2] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5D, getPos().getY() + 0.7D, getPos().getZ() + 0.5D, velX, velY, velZ), getWorld());
}
NetworkHandler.sendToAllAround(new PacketPlaySound(Sounds.CANNON_SOUND, SoundCategory.BLOCKS, getPos().getX(), getPos().getY(), getPos().getZ(), 1.0F, rand.nextFloat() / 4F + 0.75F, true), getWorld());
return true;
} else {
return false;
}
}
示例4: tickPlayers
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
protected void tickPlayers()
{
super.tickPlayers();
this.theProfiler.endStartSection("players");
for (int i = 0; i < this.playerEntities.size(); ++i)
{
Entity entity = (Entity)this.playerEntities.get(i);
Entity entity1 = entity.getRidingEntity();
if (entity1 != null)
{
if (!entity1.isDead && entity1.isPassenger(entity))
{
continue;
}
entity.dismountRidingEntity();
}
this.theProfiler.startSection("tick");
if (!entity.isDead)
{
try
{
this.updateEntity(entity);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
entity.addEntityCrashInfo(crashreportcategory);
throw new ReportedException(crashreport);
}
}
this.theProfiler.endSection();
this.theProfiler.startSection("remove");
if (entity.isDead)
{
int j = entity.chunkCoordX;
int k = entity.chunkCoordZ;
if (entity.addedToChunk && this.isChunkLoaded(j, k, true))
{
this.getChunkFromChunkCoords(j, k).removeEntity(entity);
}
this.loadedEntityList.remove(entity);
this.onEntityRemoved(entity);
}
this.theProfiler.endSection();
}
}
示例5: removeAllEntities
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* also releases skins.
*/
public void removeAllEntities()
{
this.loadedEntityList.removeAll(this.unloadedEntityList);
for (int i = 0; i < this.unloadedEntityList.size(); ++i)
{
Entity entity = (Entity)this.unloadedEntityList.get(i);
int j = entity.chunkCoordX;
int k = entity.chunkCoordZ;
if (entity.addedToChunk && this.isChunkLoaded(j, k, true))
{
this.getChunkFromChunkCoords(j, k).removeEntity(entity);
}
}
for (int i1 = 0; i1 < this.unloadedEntityList.size(); ++i1)
{
this.onEntityRemoved((Entity)this.unloadedEntityList.get(i1));
}
this.unloadedEntityList.clear();
for (int j1 = 0; j1 < this.loadedEntityList.size(); ++j1)
{
Entity entity1 = (Entity)this.loadedEntityList.get(j1);
Entity entity2 = entity1.getRidingEntity();
if (entity2 != null)
{
if (!entity2.isDead && entity2.isPassenger(entity1))
{
continue;
}
entity1.dismountRidingEntity();
}
if (entity1.isDead)
{
int k1 = entity1.chunkCoordX;
int l = entity1.chunkCoordZ;
if (entity1.addedToChunk && this.isChunkLoaded(k1, l, true))
{
this.getChunkFromChunkCoords(k1, l).removeEntity(entity1);
}
this.loadedEntityList.remove(j1--);
this.onEntityRemoved(entity1);
}
}
}
示例6: doTeleport
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Perform the actual teleport
*/
private static void doTeleport(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
if (p_189862_0_ instanceof EntityPlayerMP)
{
Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
float f = (float)p_189862_4_.getAmount();
if (p_189862_4_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
}
else
{
f = MathHelper.wrapDegrees(f);
}
float f1 = (float)p_189862_5_.getAmount();
if (p_189862_5_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
}
else
{
f1 = MathHelper.wrapDegrees(f1);
}
p_189862_0_.dismountRidingEntity();
((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
p_189862_0_.setRotationYawHead(f);
}
else
{
float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
f3 = MathHelper.clamp(f3, -90.0F, 90.0F);
p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
p_189862_0_.setRotationYawHead(f2);
}
if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
{
p_189862_0_.motionY = 0.0D;
p_189862_0_.onGround = true;
}
}
示例7: execute
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Callback for when the command is executed
*/
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
if (args.length < 1)
{
throw new WrongUsageException("commands.tp.usage", new Object[0]);
}
else
{
int i = 0;
Entity entity;
if (args.length != 2 && args.length != 4 && args.length != 6)
{
entity = getCommandSenderAsPlayer(sender);
}
else
{
entity = getEntity(server, sender, args[0]);
i = 1;
}
if (args.length != 1 && args.length != 2)
{
if (args.length < i + 3)
{
throw new WrongUsageException("commands.tp.usage", new Object[0]);
}
else if (entity.world != null)
{
int j = 4096;
int lvt_6_2_ = i + 1;
CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(entity.posX, args[i], true);
CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(entity.posY, args[lvt_6_2_++], -4096, 4096, false);
CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(entity.posZ, args[lvt_6_2_++], true);
CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate((double)entity.rotationYaw, args.length > lvt_6_2_ ? args[lvt_6_2_++] : "~", false);
CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate((double)entity.rotationPitch, args.length > lvt_6_2_ ? args[lvt_6_2_] : "~", false);
teleportEntityToCoordinates(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
notifyCommandListener(sender, this, "commands.tp.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
}
}
else
{
Entity entity1 = getEntity(server, sender, args[args.length - 1]);
if (entity1.world != entity.world)
{
throw new CommandException("commands.tp.notSameDimension", new Object[0]);
}
else
{
entity.dismountRidingEntity();
if (entity instanceof EntityPlayerMP)
{
((EntityPlayerMP)entity).connection.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
}
else
{
entity.setLocationAndAngles(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
}
notifyCommandListener(sender, this, "commands.tp.success", new Object[] {entity.getName(), entity1.getName()});
}
}
}
}
示例8: teleportEntityToCoordinates
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Teleports an entity to the specified coordinates
*/
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
if (p_189863_0_ instanceof EntityPlayerMP)
{
Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
if (p_189863_1_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X);
}
if (p_189863_2_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y);
}
if (p_189863_3_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Z);
}
if (p_189863_5_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
}
if (p_189863_4_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
}
float f = (float)p_189863_4_.getAmount();
if (!p_189863_4_.isRelative())
{
f = MathHelper.wrapDegrees(f);
}
float f1 = (float)p_189863_5_.getAmount();
if (!p_189863_5_.isRelative())
{
f1 = MathHelper.wrapDegrees(f1);
}
p_189863_0_.dismountRidingEntity();
((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
p_189863_0_.setRotationYawHead(f);
}
else
{
float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
f3 = MathHelper.clamp(f3, -90.0F, 90.0F);
p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
p_189863_0_.setRotationYawHead(f2);
}
if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
{
p_189863_0_.motionY = 0.0D;
p_189863_0_.onGround = true;
}
}
示例9: doTeleport
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Perform the actual teleport
*/
private static void doTeleport(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
if (p_189862_0_ instanceof EntityPlayerMP)
{
Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
float f = (float)p_189862_4_.getAmount();
if (p_189862_4_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
}
else
{
f = MathHelper.wrapDegrees(f);
}
float f1 = (float)p_189862_5_.getAmount();
if (p_189862_5_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
}
else
{
f1 = MathHelper.wrapDegrees(f1);
}
p_189862_0_.dismountRidingEntity();
((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
p_189862_0_.setRotationYawHead(f);
}
else
{
float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
p_189862_0_.setRotationYawHead(f2);
}
if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
{
p_189862_0_.motionY = 0.0D;
p_189862_0_.onGround = true;
}
}
示例10: execute
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Callback for when the command is executed
*/
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
if (args.length < 1)
{
throw new WrongUsageException("commands.tp.usage", new Object[0]);
}
else
{
int i = 0;
Entity entity;
if (args.length != 2 && args.length != 4 && args.length != 6)
{
entity = getCommandSenderAsPlayer(sender);
}
else
{
entity = getEntity(server, sender, args[0]);
i = 1;
}
if (args.length != 1 && args.length != 2)
{
if (args.length < i + 3)
{
throw new WrongUsageException("commands.tp.usage", new Object[0]);
}
else if (entity.worldObj != null)
{
int j = 4096;
int lvt_6_2_ = i + 1;
CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(entity.posX, args[i], true);
CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(entity.posY, args[lvt_6_2_++], -4096, 4096, false);
CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(entity.posZ, args[lvt_6_2_++], true);
CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate((double)entity.rotationYaw, args.length > lvt_6_2_ ? args[lvt_6_2_++] : "~", false);
CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate((double)entity.rotationPitch, args.length > lvt_6_2_ ? args[lvt_6_2_] : "~", false);
teleportEntityToCoordinates(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
notifyCommandListener(sender, this, "commands.tp.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
}
}
else
{
Entity entity1 = getEntity(server, sender, args[args.length - 1]);
if (entity1.worldObj != entity.worldObj)
{
throw new CommandException("commands.tp.notSameDimension", new Object[0]);
}
else
{
entity.dismountRidingEntity();
if (entity instanceof EntityPlayerMP)
{
((EntityPlayerMP)entity).connection.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
}
else
{
entity.setLocationAndAngles(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
}
notifyCommandListener(sender, this, "commands.tp.success", new Object[] {entity.getName(), entity1.getName()});
}
}
}
}
示例11: teleportEntityToCoordinates
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
* Teleports an entity to the specified coordinates
*/
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
if (p_189863_0_ instanceof EntityPlayerMP)
{
Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
if (p_189863_1_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X);
}
if (p_189863_2_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y);
}
if (p_189863_3_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Z);
}
if (p_189863_5_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
}
if (p_189863_4_.isRelative())
{
set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
}
float f = (float)p_189863_4_.getAmount();
if (!p_189863_4_.isRelative())
{
f = MathHelper.wrapDegrees(f);
}
float f1 = (float)p_189863_5_.getAmount();
if (!p_189863_5_.isRelative())
{
f1 = MathHelper.wrapDegrees(f1);
}
p_189863_0_.dismountRidingEntity();
((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
p_189863_0_.setRotationYawHead(f);
}
else
{
float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
p_189863_0_.setRotationYawHead(f2);
}
if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
{
p_189863_0_.motionY = 0.0D;
p_189863_0_.onGround = true;
}
}