本文整理汇总了Java中net.minecraft.client.entity.EntityPlayerSP类的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayerSP类的具体用法?Java EntityPlayerSP怎么用?Java EntityPlayerSP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityPlayerSP类属于net.minecraft.client.entity包,在下文中一共展示了EntityPlayerSP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderWorld
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
public static void onRenderWorld(RenderWorldLastEvent event) {
// EntityPlayerSP player = Minecraft.getMinecraft().player;
// if (player.getHeldItem(EnumHand.MAIN_HAND).isEmpty()) {
// return;
// }
// if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.radiationMonitorItem) {
// return;
// }
if (cleanAir != null) {
EntityPlayerSP p = Minecraft.getMinecraft().player;
if (hasGlasses()) {
int cnt = cleanAir.size();
if (cnt != prevCnt) {
System.out.println("cleanAir = " + cnt);
prevCnt = cnt;
}
renderHighlightedBlocks(event, p, cleanAir);
}
}
}
示例2: onUpdate
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP player) {
if(isEnabled()) {
currentMS = System.nanoTime() / 1000000;
if(hasDelayRun((long)(1000 / crystalSpeed.getValue())))
{
for (Entity e : Wrapper.getWorld().loadedEntityList) {
if (player.getDistanceToEntity(e) < crystalRange.getValue()) {
if (e instanceof EntityEnderCrystal) {
Wrapper.getMinecraft().playerController.attackEntity(player, e);
player.swingArm(EnumHand.MAIN_HAND);
lastMS = System.nanoTime() / 1000000;
break;
}
}
}
}
}
}
示例3: sendChanges
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
private void sendChanges()
{
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
if (player == null)
return;
// Send any changes requested over the wire to the server:
double x = this.setX ? this.x : 0;
double y = this.setY ? this.y : 0;
double z = this.setZ ? this.z : 0;
float yaw = this.setYaw ? this.rotationYaw : 0;
float pitch = this.setPitch ? this.rotationPitch : 0;
if (this.setX || this.setY || this.setZ || this.setYaw || this.setPitch)
{
MalmoMod.network.sendToServer(new TeleportMessage(x, y, z, yaw, pitch, this.setX, this.setY, this.setZ, this.setYaw, this.setPitch));
if (this.setYaw || this.setPitch)
{
// Send a message that the ContinuousMovementCommands can pick up on:
Event event = new CommandForWheeledRobotNavigationImplementation.ResetPitchAndYawEvent(this.setYaw, this.rotationYaw, this.setPitch, this.rotationPitch);
MinecraftForge.EVENT_BUS.post(event);
}
this.setX = this.setY = this.setZ = this.setYaw = this.setPitch = false;
}
}
示例4: renderBlocks
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
private static void renderBlocks(RenderWorldLastEvent evt, Set<BlockPos> blocks) {
EntityPlayerSP player = MinecraftTools.getPlayer(Minecraft.getMinecraft());
double doubleX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
double doubleY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
double doubleZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();
GlStateManager.pushMatrix();
GlStateManager.translate(-doubleX, -doubleY, -doubleZ);
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
for (BlockPos pos : blocks) {
renderBoxOutline(pos);
}
GlStateManager.enableDepth();
GlStateManager.popMatrix();
}
示例5: doRender
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doe
*/
public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, float partialTicks)
{
if (!entity.isUser() || this.renderManager.livingPlayer == entity)
{
double d0 = y;
if (entity.isSneaking() && !(entity instanceof EntityPlayerSP))
{
d0 = y - 0.125D;
}
this.setModelVisibilities(entity);
super.doRender(entity, x, d0, z, entityYaw, partialTicks);
}
}
示例6: call
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
@Override
public void call(String[] args) throws CmdException
{
if(args.length > 0)
throw new CmdSyntaxError();
// check for creative mode
EntityPlayerSP player = WMinecraft.getPlayer();
if(!player.capabilities.isCreativeMode)
throw new CmdError("Creative mode only.");
// validate item
ItemStack item = player.inventory.getCurrentItem();
if(item == null)
throw new CmdError("You need an item in your hand.");
if(!item.isItemStackDamageable())
throw new CmdError("This item can't take damage.");
if(!item.isItemDamaged())
throw new CmdError("This item is not damaged.");
// repair item
item.setItemDamage(0);
WConnection.sendPacket(new CPacketCreativeInventoryAction(
36 + player.inventory.currentItem, item));
}
示例7: drawBeacon
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
public static void drawBeacon(BlockPos pos, int color, int colorIn, float partialTicks) {
GlStateManager.pushMatrix();
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
GL11.glLineWidth((float)1.0f);
AxisAlignedBB var11 = new AxisAlignedBB((double)(pos.getX() + 1), (double)pos.getY(), (double)(pos.getZ() + 1), (double)pos.getX(), (double)(pos.getY() + 200), (double)pos.getZ());
AxisAlignedBB var12 = new AxisAlignedBB(var11.minX - x, var11.minY - y, var11.minZ - z, var11.maxX - x, var11.maxY - y, var11.maxZ - z);
if (color != 0) {
GlStateManager.disableDepth();
RenderUtils.filledBox(var12, colorIn, true);
RenderUtils.disableLighting();
drawOutlinedBoundingBox((AxisAlignedBB)var12, (int)color);
}
GlStateManager.popMatrix();
}
示例8: onUpdate
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP player) {
ItemStack curStack = player.inventory.getCurrentItem();
if(isEnabled()) {
if(!shouldEat()) {
Wrapper.getMinecraft().gameSettings.keyBindUseItem.pressed = false;
return;
}
FoodStats foodStats = player.getFoodStats();
if (foodStats.getFoodLevel() <= hungerFactor.getValue() && shouldEat())
{
eatFood();
}
}
}
示例9: drawBeacon
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
public static void drawBeacon(BlockPos pos, int color, int colorIn, float partialTicks) {
GlStateManager.pushMatrix();
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
GL11.glLineWidth((float)1.0f);
AxisAlignedBB var11 = new AxisAlignedBB((double)(pos.getX() + 1), (double)pos.getY(), (double)(pos.getZ() + 1), (double)pos.getX(), (double)(pos.getY() + 200), (double)pos.getZ());
AxisAlignedBB var12 = new AxisAlignedBB(var11.minX - x, var11.minY - y, var11.minZ - z, var11.maxX - x, var11.maxY - y, var11.maxZ - z);
if (color != 0) {
GlStateManager.disableDepth();
RenderUtils.filledBox(var12, colorIn);
RenderUtils.disableLighting();
drawOutlinedBoundingBox((AxisAlignedBB)var12, (int)color);
}
GlStateManager.popMatrix();
}
示例10: onItemRightClick
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand); //Not entirely convinced it works
RayTraceResult result = world.isRemote ? RayTraceHelper.tracePlayerHighlight((EntityPlayerSP) player) : RayTraceHelper.tracePlayerHighlight((EntityPlayerMP) player);
if(result.typeOfHit != RayTraceResult.Type.BLOCK) {
if(!world.isRemote) {
Vector3 vec = Vector3.create(player.posX, player.posY + player.getEyeHeight(), player.posZ);
vec.add(Vector3.create(player.getLookVec()).multiply(2.5D));
BlockPos pos = new BlockPos(vec.toVec3d());
IBlockState replaced = world.getBlockState(pos);
if(world.isAirBlock(pos) || replaced.getBlock().isReplaceable(world, pos)) {
IBlockState state = ModBlocks.ANGSTROM.getDefaultState();
SoundType type = ModBlocks.ANGSTROM.getSoundType(state, world, pos, player);
world.setBlockState(pos, state);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), type.getPlaceSound(), SoundCategory.BLOCKS, 0.75F, 0.8F);
}
if(!player.capabilities.isCreativeMode) {
stack.shrink(1);
}
}
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
return ActionResult.newResult(EnumActionResult.PASS, stack);
}
示例11: getTouchingBlocks
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
public static List<BlockPos> getTouchingBlocks(EntityPlayerSP player)
{
// Determine which blocks we are touching.
// This code is adapted from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
BlockPos blockposmin = new BlockPos(player.getEntityBoundingBox().minX - 0.001D, player.getEntityBoundingBox().minY - 0.001D, player.getEntityBoundingBox().minZ - 0.001D);
BlockPos blockposmax = new BlockPos(player.getEntityBoundingBox().maxX + 0.001D, player.getEntityBoundingBox().maxY + 0.001D, player.getEntityBoundingBox().maxZ + 0.001D);
List<BlockPos> blocks = new ArrayList<BlockPos>();
if (player.worldObj.isAreaLoaded(blockposmin, blockposmax))
{
for (int i = blockposmin.getX(); i <= blockposmax.getX(); ++i)
{
for (int j = blockposmin.getY(); j <= blockposmax.getY(); ++j)
{
for (int k = blockposmin.getZ(); k <= blockposmax.getZ(); ++k)
{
blocks.add(new BlockPos(i, j, k));
}
}
}
}
return blocks;
}
示例12: install
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
@Override
public void install(MissionInit missionInit)
{
// Create our movement hook, which allows us to override the Minecraft movement.
this.overrideMovement = new MovementHook(Minecraft.getMinecraft().gameSettings);
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
if (player != null)
{
// Insert it into the player, keeping a record of the original movement object
// so we can restore it later.
this.originalMovement = player.movementInput;
player.movementInput = this.overrideMovement;
}
FMLCommonHandler.instance().bus().register(this);
MinecraftForge.EVENT_BUS.register(this);
}
示例13: calculateReward
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
private void calculateReward(MultidimensionalReward reward)
{
// Determine what blocks we are touching.
// This code is largely cribbed from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
List<BlockPos> touchingBlocks = PositionHelper.getTouchingBlocks(player);
for (BlockPos pos : touchingBlocks) {
IBlockState iblockstate = player.worldObj.getBlockState(pos);
for (BlockMatcher bm : this.matchers) {
if (bm.applies(pos) && bm.matches(pos, iblockstate))
{
float reward_value = bm.reward();
float adjusted_reward = adjustAndDistributeReward(reward_value, this.params.getDimension(), bm.spec.getDistribution());
reward.add( this.params.getDimension(), adjusted_reward );
}
}
}
}
示例14: getInventoryJSON
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
public static void getInventoryJSON(JsonObject json, String prefix, int maxSlot)
{
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
int nSlots = Math.min(player.inventory.getSizeInventory(), maxSlot);
for (int i = 0; i < nSlots; i++)
{
ItemStack is = player.inventory.getStackInSlot(i);
if (is != null)
{
json.addProperty(prefix + i + "_size", is.stackSize);
DrawItem di = MinecraftTypeHelper.getDrawItemFromItemStack(is);
String name = di.getType();
if (di.getColour() != null)
json.addProperty(prefix + i + "_colour", di.getColour().value());
if (di.getVariant() != null)
json.addProperty(prefix + i + "_variant", di.getVariant().getValue());
json.addProperty(prefix + i + "_item", name);
}
}
}
示例15: onRender
import net.minecraft.client.entity.EntityPlayerSP; //导入依赖的package包/类
@Override
public void onRender() {
if(isEnabled()) {
for(Entity ep : Wrapper.getWorld().loadedEntityList) {
if(ep instanceof EntityPlayerSP) continue;
if(ep instanceof EntityPlayer) {
double d = ep.lastTickPosX + (ep.posX - ep.lastTickPosX) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
double d1 = ep.lastTickPosY + (ep.posY - ep.lastTickPosY) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
double d2 = ep.lastTickPosZ + (ep.posZ - ep.lastTickPosZ) * (double)Wrapper.getMinecraft().timer.renderPartialTicks;
if(Wrapper.getFriends().isFriend(((EntityPlayer)ep).getName())) {
GL11.glColor4f(0.15F, 0.15F, 1.0F, 1.0F);
} else {
if(Wrapper.getPlayer().getDistanceToEntity(ep) >= 64) {
GL11.glColor4f(0.0F, 1.0F, 0.0F, 1.0F);
} else {
GL11.glColor4f(1.0F, Wrapper.getPlayer().getDistanceToEntity(ep) / 150, 0.0F, 1.0F);
}
}
RenderUtils.drawSphere(d, d1, d2, KillAura.auraRange.getValue(), 20, 15);
}
}
}
}