Java Code Examples for net.minecraft.entity.player.EntityPlayer.getBedLocation()
The following are Jave code examples for showing how to use
getBedLocation() of the
net.minecraft.entity.player.EntityPlayer
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: HardcoreRevival File: RescueHandler.java View Source Code | 5 votes |
public static void finishRescue(EntityPlayer player) { IHardcoreRevival revival = player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null); if (revival != null) { EntityPlayer target = revival.getRescueTarget(); if (target != null) { MinecraftServer server = target.getServer(); if (server != null) { BlockPos prevSpawnPos = target.getBedLocation(target.dimension); boolean prevSpawnForced = target.isSpawnForced(target.dimension); target.setSpawnPoint(target.getPosition(), true); if (ModConfig.glowOnDeath) { target.setGlowing(false); } EntityPlayerMP newPlayer = server.getPlayerList().recreatePlayerEntity((EntityPlayerMP) target, target.dimension, false); ((EntityPlayerMP) target).connection.player = newPlayer; newPlayer.setHealth(1f); newPlayer.getFoodStats().setFoodLevel(5); newPlayer.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 20 * 30)); newPlayer.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 20 * 60)); newPlayer.inventory.copyInventory(target.inventory); newPlayer.experienceLevel = target.experienceLevel; newPlayer.experienceTotal = target.experienceTotal; newPlayer.experience = target.experience; newPlayer.extinguish(); newPlayer.setFlag(0, false); // burning flag newPlayer.setScore(target.getScore()); newPlayer.setSpawnPoint(prevSpawnPos, prevSpawnForced); NetworkHandler.instance.sendToAllAround(new MessageRevivalSuccess(newPlayer.getEntityId()), new NetworkRegistry.TargetPoint(newPlayer.dimension, newPlayer.posX, newPlayer.posY, newPlayer.posZ, 32)); } } } }