本文整理了Java中net.minecraft.entity.Entity.dismountRidingEntity()
方法的一些代码示例,展示了Entity.dismountRidingEntity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.dismountRidingEntity()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:dismountRidingEntity
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
passanger.dismountRidingEntity();
passangersOnOtherSide.add( this.teleportEntity( passanger, link ) );
代码示例来源:origin: Vazkii/Botania
e.dismountRidingEntity();
if(e instanceof EntityPlayerMP)
((EntityPlayerMP) e).connection.setPlayerLocation(posX, posY, posZ, e.rotationYaw, e.rotationPitch);
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@SubscribeEvent
public void onPlayerLeaveEvent(PlayerEvent.PlayerLoggedOutEvent event) {
if (event.player != null && !event.player.getPassengers().isEmpty()) {
Iterator<Entity> itr = event.player.getPassengers().iterator();
while (itr.hasNext()) {
(itr.next()).dismountRidingEntity();
}
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@Override
@SideOnly(Side.CLIENT)
public void onClientReceived(Minecraft client, MicroraptorDismountMessage message, EntityPlayer player, MessageContext messageContext) {
Entity entity = client.world.getEntityByID(message.entityId);
if (entity instanceof MicroraptorEntity) {
entity.dismountRidingEntity();
}
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
@SubscribeEvent
public void onPlayerLoggedOut(PlayerLoggedOutEvent event) {
event.player.getPassengers().stream().filter(entity -> entity instanceof EntityBasket).forEach(entity -> {
AnimalStats stats = EntityHelper.getStats(entity);
entity.dismountRidingEntity();
entity.rotationPitch = event.player.rotationPitch;
entity.rotationYaw = event.player.rotationYaw;
entity.moveRelative(0F, 0.1F, 1.05F);
entity.setEntityInvulnerable(false);
});
}
代码示例来源:origin: SleepyTrousers/EnderIO
private static boolean doTeleport(@Nonnull World world, @Nonnull Entity entity, double targetX, double targetY, double targetZ) {
if (entity instanceof EntityLivingBase) {
return doTeleport(world, (EntityLivingBase) entity, targetX, targetY, targetZ);
}
if (entity.isRiding()) {
entity.dismountRidingEntity();
}
if (entity.isBeingRidden()) {
entity.removePassengers();
}
entity.setPositionAndRotation(targetX, targetY, targetZ, entity.rotationYaw, entity.rotationPitch);
return true;
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public boolean attackEntityFrom(DamageSource source, float amount) {
StoneEntityProperties properties = EntityPropertiesHandler.INSTANCE.getProperties(this, StoneEntityProperties.class);
if(amount >= 1.0D && !this.getPassengers().isEmpty() && rand.nextInt(2) == 0){
for(Entity entity : this.getPassengers()){
entity.dismountRidingEntity();
}
}
visibleTicks = 300;
this.setHiding(false);
return super.attackEntityFrom(source, amount);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public boolean attackEntityFrom(DamageSource source, float amount) {
StoneEntityProperties properties = EntityPropertiesHandler.INSTANCE.getProperties(this, StoneEntityProperties.class);
if(amount >= 1.0D && !this.world.isRemote && this.getRNG().nextInt(3) == 0 && this.getHeldItem(EnumHand.MAIN_HAND) != ItemStack.EMPTY && !properties.isStone){
this.entityDropItem(this.getHeldItem(EnumHand.MAIN_HAND), 0);
this.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
}
if(amount >= 1.0D && !this.getPassengers().isEmpty()){
for(Entity entity : this.getPassengers()){
entity.dismountRidingEntity();
}
}
return super.attackEntityFrom(source, amount);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public boolean attackEntityAsMob(Entity entityIn) {
if(this.getGrowthStage() < 2){
return false;
}
if (this.getAnimation() != this.ANIMATION_STING && this.getAnimation() != this.ANIMATION_BITE) {
this.setAnimation(this.getRNG().nextBoolean() ? this.ANIMATION_STING : this.ANIMATION_BITE);
if(!this.world.isRemote && this.getRNG().nextInt(3) == 0 && this.getHeldItem(EnumHand.MAIN_HAND) != ItemStack.EMPTY){
this.entityDropItem(this.getHeldItem(EnumHand.MAIN_HAND), 0);
this.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
}
if(!this.getPassengers().isEmpty()){
for(Entity entity : this.getPassengers()){
entity.dismountRidingEntity();
}
}
return true;
}
return false;
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public boolean attackEntityAsMob(Entity entityIn) {
if(this.getGrowthStage() < 2){
return false;
}
if (this.getAnimation() != this.ANIMATION_STING && this.getAnimation() != this.ANIMATION_BITE) {
this.setAnimation(this.getRNG().nextBoolean() ? this.ANIMATION_STING : this.ANIMATION_BITE);
if(!this.world.isRemote && this.getRNG().nextInt(3) == 0 && this.getHeldItem(EnumHand.MAIN_HAND) != ItemStack.EMPTY){
this.entityDropItem(this.getHeldItem(EnumHand.MAIN_HAND), 0);
this.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
}
if(!this.getPassengers().isEmpty()){
for(Entity entity : this.getPassengers()){
entity.dismountRidingEntity();
}
}
return true;
}
return false;
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public boolean attackEntityAsMob(Entity entityIn) {
if(this.getGrowthStage() < 2){
return false;
}
if (this.getAnimation() != this.ANIMATION_STING && this.getAnimation() != this.ANIMATION_BITE) {
this.setAnimation(this.getRNG().nextBoolean() ? this.ANIMATION_STING : this.ANIMATION_BITE);
if(!this.world.isRemote && this.getRNG().nextInt(3) == 0 && this.getHeldItem(EnumHand.MAIN_HAND) != ItemStack.EMPTY){
this.entityDropItem(this.getHeldItem(EnumHand.MAIN_HAND), 0);
this.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
}
if(!this.getPassengers().isEmpty()){
for(Entity entity : this.getPassengers()){
entity.dismountRidingEntity();
}
}
return true;
}
return false;
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public void updateTask() {
this.myrmex.getNavigator().tryMoveToXYZ(this.nextRoom.getX(), this.nextRoom.getY(), this.nextRoom.getZ(), this.movementSpeed);
if (nextRoom != null && this.myrmex.getDistanceSq(nextRoom) < 4 && this.myrmex.holdingBaby()) {
if(!this.myrmex.getPassengers().isEmpty()){
for(Entity entity : this.myrmex.getPassengers()){
entity.dismountRidingEntity();
resetTask();
entity.copyLocationAndAnglesFrom(this.myrmex);
}
}
}
}
代码示例来源:origin: Mine-and-blade-admin/Battlegear2
/**
* Most generic handling of EnderTeleportEvent
*
* @param event to handle
* @return true only if the event is not cancelled
*/
private boolean handleTeleportEvent(EnderTeleportEvent event){
if (!MinecraftForge.EVENT_BUS.post(event)) {
for (int i = 0; i < 32; ++i){
this.world.spawnParticle(EnumParticleTypes.PORTAL, event.getTargetX(), event.getTargetY() + this.rand.nextDouble() * 2.0D, event.getTargetZ(), this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
}
event.getEntity().dismountRidingEntity();
event.getEntity().setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
event.getEntity().fallDistance = 0.0F;
event.getEntity().attackEntityFrom(getEnderDamage(), event.getAttackDamage());
return true;
}
return false;
}
}
代码示例来源:origin: CoFH/ThermalDynamics
public void teleport(DuctUnitTransport dest) {
if (this.world.isRemote || this.isDead || rider == null || rider.isDead) {
return;
}
int curDim = this.dimension;
int destDim = dest.world().provider.getDimension();
if (destDim != curDim) {
MinecraftServer minecraftserver = this.world.getMinecraftServer();
WorldServer currentWorld = minecraftserver.getWorld(curDim);
WorldServer destinationWorld = minecraftserver.getWorld(destDim);
rider.dismountRidingEntity();
transferNormalEntity(curDim, destDim, currentWorld, destinationWorld, this);
if (rider instanceof EntityPlayerMP) {
transferPlayer(destDim, rider);
} else {
transferNormalEntity(curDim, destDim, currentWorld, destinationWorld, rider);
}
rider.dismountRidingEntity();
currentWorld.resetUpdateEntityTick();
destinationWorld.resetUpdateEntityTick();
}
pos = new BlockPos(dest.pos());
if (myPath.hasNextDirection()) {
oldDirection = direction;
direction = myPath.getNextDirection();
} else {
reRoute = true;
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public void updatePassenger(Entity passenger) {
super.updatePassenger(passenger);
if (this.isPassenger(passenger)) {
passenger.motionX = 0;
passenger.motionZ = 0;
this.setAnimation(ANIMATION_EATPLAYER);
double raiseUp = this.getAnimationTick() < 10 ? 0 : Math.min((this.getAnimationTick() * 3 - 30) * 0.2, 5.2F);
float pullIn = this.getAnimationTick() < 15 ? 0 : Math.min((this.getAnimationTick() - 15) * 0.15F, 0.75F);
renderYawOffset = rotationYaw;
this.rotationYaw *= 0;
float radius = -2.75F + pullIn;
float angle = (0.01745329251F * this.renderYawOffset) + 3.15F;
double extraX = (double) (radius * MathHelper.sin((float) (Math.PI + angle)));
double extraZ = (double) (radius * MathHelper.cos(angle));
double extraY = raiseUp;
passenger.setPosition(this.posX + extraX, this.posY + extraY, this.posZ + extraZ);
if(this.getAnimationTick() == 32){
passenger.attackEntityFrom(DamageSource.causeMobDamage(this), passenger instanceof EntityPlayer ? (float)IceAndFire.CONFIG.cyclopsBiteStrength : passenger instanceof EntityLivingBase ? (float) ((EntityLivingBase) passenger).getMaxHealth() * 2F : (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() * 2F);
passenger.dismountRidingEntity();
}
}
}
代码示例来源:origin: CoFH/CoFHCore
public static void transferEntityToDimension(Entity entity, int dimension, PlayerList manager) {
if (entity instanceof EntityPlayerMP) {
transferPlayerToDimension((EntityPlayerMP) entity, dimension, manager);
return;
}
WorldServer worldserver = manager.getServerInstance().getWorld(entity.dimension);
entity.dimension = dimension;
WorldServer worldserver1 = manager.getServerInstance().getWorld(entity.dimension);
worldserver.removeEntityDangerously(entity);
if (entity.isBeingRidden()) {
entity.removePassengers();
}
if (entity.isRiding()) {
entity.dismountRidingEntity();
}
entity.isDead = false;
transferEntityToWorld(entity, worldserver, worldserver1);
}
代码示例来源:origin: CoFH/CoFHCore
public static void transferEntityToDimension(Entity entity, double x, double y, double z, int dimension, PlayerList manager) {
if (entity instanceof EntityPlayerMP) {
transferPlayerToDimension((EntityPlayerMP) entity, dimension, manager);
return;
}
WorldServer worldserver = manager.getServerInstance().getWorld(entity.dimension);
entity.dimension = dimension;
WorldServer worldserver1 = manager.getServerInstance().getWorld(entity.dimension);
worldserver.removeEntityDangerously(entity);
if (entity.isBeingRidden()) {
entity.removePassengers();
}
if (entity.isRiding()) {
entity.dismountRidingEntity();
}
entity.isDead = false;
transferEntityToWorld(entity, x, y, z, worldserver, worldserver1);
}
代码示例来源:origin: gegy1000/Terrarium
private void teleport(Entity entity, Coordinate coordinate) {
int blockX = MathHelper.floor(coordinate.getBlockX());
int blockZ = MathHelper.floor(coordinate.getBlockZ());
Chunk chunk = entity.world.getChunk(blockX >> 4, blockZ >> 4);
int height = chunk.getHeightValue(blockX & 15, blockZ & 15);
entity.dismountRidingEntity();
if (entity instanceof EntityPlayerMP) {
NetHandlerPlayServer connection = ((EntityPlayerMP) entity).connection;
connection.setPlayerLocation(coordinate.getBlockX(), height + 0.5, coordinate.getBlockZ(), 180.0F, 0.0F);
}
entity.motionY = 0.0;
entity.onGround = true;
entity.sendMessage(DeferredTranslator.translate(entity, new TextComponentTranslation("commands.earth.geotp.success", coordinate.getX(), coordinate.getZ())));
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
@SubscribeEvent
@SuppressWarnings("ConstantConditions")
public void onRightClickGround(PlayerInteractEvent.RightClickBlock event) {
EntityPlayer player = event.getEntityPlayer();
if (!forbidsDrop(event.getWorld().getBlockState(event.getPos()).getBlock())) {
for (Entity entity : player.getPassengers()) {
AnimalStats stats = EntityHelper.getStats(entity);
if (stats != null && stats.performTest(AnimalTest.CAN_CARRY)) {
entity.dismountRidingEntity();
entity.rotationPitch = player.rotationPitch;
entity.rotationYaw = player.rotationYaw;
entity.moveRelative(0F, 0.1F, 1.05F);
entity.setEntityInvulnerable(false);
stats.performAction(player.world, null, AnimalAction.DISMOUNT);
}
}
}
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
private void updatePreyInMouth(Entity prey) {
this.setAnimation(ANIMATION_SHAKEPREY);
if (this.getAnimation() == ANIMATION_SHAKEPREY && this.getAnimationTick() > 55 && prey != null) {
prey.attackEntityFrom(DamageSource.causeMobDamage(this), prey instanceof EntityPlayer ? 17F : (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue() * 4);
prey.dismountRidingEntity();
}
renderYawOffset = rotationYaw;
float modTick_0 = this.getAnimationTick() - 25;
float modTick_1 = this.getAnimationTick() > 25 && this.getAnimationTick() < 55 ? 8 * MathHelper.clamp(MathHelper.sin((float) (Math.PI + modTick_0 * 0.25)), -0.8F, 0.8F) : 0;
float modTick_2 = this.getAnimationTick() > 30 ? 10 : Math.max(0, this.getAnimationTick() - 20);
float radius = 0.75F * (0.6F * getRenderSize() / 3) * -3;
float angle = (0.01745329251F * this.renderYawOffset) + 3.15F + (modTick_1 * 2F) * 0.015F;
double extraX = (double) (radius * MathHelper.sin((float) (Math.PI + angle)));
double extraZ = (double) (radius * MathHelper.cos(angle));
double extraY = modTick_2 == 0 ? 0 : 0.035F * ((getRenderSize() / 3) + (modTick_2 * 0.5 * (getRenderSize() / 3)));
prey.setPosition(this.posX + extraX, this.posY + extraY, this.posZ + extraZ);
}
内容来源于网络,如有侵权,请联系作者删除!