Java Code Examples for net.minecraft.entity.Entity#isSneaking()
The following examples show how to use
net.minecraft.entity.Entity#isSneaking() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jesus.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onTick(EventTick event) { Entity e = mc.player.getVehicle() != null ? mc.player.getVehicle() : mc.player; if (e.isSneaking() || e.fallDistance > 3f) return; if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.3,0)))) { e.setVelocity(e.getVelocity().x, 0.08, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.1,0)))) { e.setVelocity(e.getVelocity().x, 0.05, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.05,0)))) { e.setVelocity(e.getVelocity().x, 0.01, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos()))) { e.setVelocity(e.getVelocity().x, -0.005, e.getVelocity().z); e.onGround = true; } }
Example 2
Source File: ItemEnderPorter.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
private boolean doTeleport(ItemStack stack, Entity entity, boolean targetMustSneakIfPlayer) { TargetData target = TargetData.getTargetFromSelectedModule(stack, ModuleType.TYPE_LINKCRYSTAL); int entityDim = entity.getEntityWorld().provider.getDimension(); // The basic version can only teleport inside the same dimension if (target != null && EntityUtils.doesEntityStackHaveBlacklistedEntities(entity) == false && (this.isAdvancedPorter(stack) || target.dimension == entityDim)) { int cost = (target.dimension == entityDim ? ENDER_CHARGE_COST_INTER_DIM_TP : ENDER_CHARGE_COST_CROSS_DIM_TP); if (UtilItemModular.useEnderCharge(stack, cost, true)) { // If the target entity is a player, then they have to be sneaking too if (targetMustSneakIfPlayer == false || ((entity instanceof EntityPlayer) == false || entity.isSneaking())) { UtilItemModular.useEnderCharge(stack, cost, false); TeleportEntity.teleportEntityUsingModularItem(entity, stack, true, true); return true; } } } return false; }
Example 3
Source File: ModelArmorStand.java From Et-Futurum with The Unlicense | 6 votes |
@Override public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) { super.render(p_78088_1_, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_); OpenGLHelper.pushMatrix(); if (isChild) { float f6 = 2.0F; OpenGLHelper.scale(1.0F / f6, 1.0F / f6, 1.0F / f6); OpenGLHelper.translate(0.0F, 24.0F * p_78088_7_, 0.0F); standRightSide.render(p_78088_7_); standLeftSide.render(p_78088_7_); standWaist.render(p_78088_7_); standBase.render(p_78088_7_); } else { if (p_78088_1_.isSneaking()) OpenGLHelper.translate(0.0F, 0.2F, 0.0F); standRightSide.render(p_78088_7_); standLeftSide.render(p_78088_7_); standWaist.render(p_78088_7_); standBase.render(p_78088_7_); } OpenGLHelper.popMatrix(); }
Example 4
Source File: ItemCybereyeUpgrade.java From Cyberware with MIT License | 6 votes |
@Override public void use(Entity e, ItemStack stack) { if (stack.getItemDamage() == 4) { if (e == this.player) { if (e.isSneaking()) { zoomSettingOn = (zoomSettingOn + 4 - 1) % 4; } else { zoomSettingOn = (zoomSettingOn + 1) % 4; } } return; } EnableDisableHelper.toggle(stack); }
Example 5
Source File: ItemArmorCyberware.java From Cyberware with MIT License | 6 votes |
@Override public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.pushMatrix(); if (this.isChild) { float f = 2.0F; GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); this.bottomThing.render(scale); } else { if (entityIn.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } this.bottomThing.render(scale); } GlStateManager.popMatrix(); }
Example 6
Source File: ModelClaws.java From Cyberware with MIT License | 6 votes |
/** * Sets the models various rotation angles then renders the model. */ public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.pushMatrix(); if (entityIn.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } this.claw1.render(scale); GlStateManager.popMatrix(); }
Example 7
Source File: RayTraceUtils.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Nullable public static BlockPos getTargetedPosition(World world, Entity entity, double maxDistance, boolean sneakToOffset) { RayTraceResult trace = fi.dy.masa.malilib.util.RayTraceUtils .getRayTraceFromEntity(world, entity, RayTraceFluidHandling.NONE, false, maxDistance); if (trace.typeOfHit != RayTraceResult.Type.BLOCK) { return null; } BlockPos pos = trace.getBlockPos(); // Sneaking puts the position adjacent the targeted block face, not sneaking puts it inside the targeted block if (sneakToOffset == entity.isSneaking()) { pos = pos.offset(trace.sideHit); } return pos; }
Example 8
Source File: Jesus.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onTick(EventTick event) { Entity e = mc.player.getVehicle() != null ? mc.player.getVehicle() : mc.player; if (e.isSneaking() || e.fallDistance > 3f) return; if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.3,0)))) { e.setVelocity(e.getVelocity().x, 0.08, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.1,0)))) { e.setVelocity(e.getVelocity().x, 0.05, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.05,0)))) { e.setVelocity(e.getVelocity().x, 0.01, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos()))) { e.setVelocity(e.getVelocity().x, -0.005, e.getVelocity().z); e.onGround = true; } }
Example 9
Source File: Jesus.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onTick(EventTick event) { Entity e = mc.player.getVehicle() != null ? mc.player.getVehicle() : mc.player; if (e.isSneaking() || e.fallDistance > 3f) return; if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.3,0)))) { e.setVelocity(e.getVelocity().x, 0.08, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.1,0)))) { e.setVelocity(e.getVelocity().x, 0.05, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos().add(0,0.05,0)))) { e.setVelocity(e.getVelocity().x, 0.01, e.getVelocity().z); } else if (WorldUtils.isFluid(new BlockPos(e.getPos()))) { e.setVelocity(e.getVelocity().x, -0.005, e.getVelocity().z); e.setOnGround(true); } }
Example 10
Source File: Jesus.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public void onUpdate() { if (this.isToggled()) { Entity e = mc.player.getRidingEntity() != null ? mc.player.getRidingEntity() : mc.player; if (e.isSneaking() || e.fallDistance > 3f || e.collidedHorizontally) return; if (isFluid(e.getPositionVec().add(0,0.3,0))) { e.setMotion(e.getMotion().x, 0.08, e.getMotion().z); } else if (isFluid(e.getPositionVec().add(0,0.07,0))) { e.setMotion(e.getMotion().x, 0.01, e.getMotion().z); } else if (isFluid(e.getPositionVec())) { e.setMotion(e.getMotion().x, -0.005, e.getMotion().z); e.onGround = true; } } }
Example 11
Source File: MixinModelPlayer.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
/** * @author 9Y0, Mojang * @reason body parts */ @Overwrite public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); GlStateManager.pushMatrix(); if (isChild) { float f = 2.0F; GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); } else { if (entityIn.isSneaking()) GlStateManager.translate(0.0F, 0.2F, 0.0F); } bipedLeftLegwear.render(scale); bipedRightLegwear.render(scale); bipedLeftArmwear.render(scale); bipedRightArmwear.render(scale); bipedBodyWear.render(scale); bipedLeftForeArmwear.render(scale); bipedLeftForeArm.render(scale); bipedRightForeArmwear.render(scale); bipedRightForeArm.render(scale); bipedLeftLowerLeg.render(scale); bipedLeftLowerLegwear.render(scale); bipedRightLowerLeg.render(scale); bipedRightLowerLegwear.render(scale); butt.render(scale); GlStateManager.popMatrix(); }
Example 12
Source File: MixinModelBiped.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
/** * @author 9Y0, Mojang * @reason body parts */ @Overwrite public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); GlStateManager.pushMatrix(); if (isChild) { float f = 2.0F; GlStateManager.scale(1.5F / f, 1.5F / f, 1.5F / f); GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); bipedHead.render(scale); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); } else { if (entityIn.isSneaking()) GlStateManager.translate(0.0F, 0.2F, 0.0F); bipedHead.render(scale); } // Adding our parts bipedBody.render(scale); bipedRightArm.render(scale); bipedLeftArm.render(scale); bipedRightLeg.render(scale); bipedLeftLeg.render(scale); bipedHeadwear.render(scale); if (getClass().equals(ModelBiped.class)) renderBiped(scale); GlStateManager.popMatrix(); }
Example 13
Source File: BlockFrame.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.motionX = MathHelper.clamp(entityIn.motionX, -0.15, 0.15); entityIn.motionZ = MathHelper.clamp(entityIn.motionZ, -0.15, 0.15); entityIn.fallDistance = 0.0F; if (entityIn.motionY < -0.15D) { entityIn.motionY = -0.15D; } if (entityIn.isSneaking() && entityIn.motionY < 0.0D) { entityIn.motionY = 0.0D; } if (entityIn.collidedHorizontally) { entityIn.motionY = 0.2; } }
Example 14
Source File: SlimeBlock.java From Et-Futurum with The Unlicense | 5 votes |
@Override public void onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance) { if (!entity.isSneaking()) { entity.fallDistance = 0; if (entity.motionY < 0) entity.getEntityData().setDouble(Reference.MOD_ID + ":slime", -entity.motionY); } }
Example 15
Source File: SlimeBlock.java From Et-Futurum with The Unlicense | 5 votes |
@Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { NBTTagCompound data = entity.getEntityData(); if (data.hasKey(Reference.MOD_ID + ":slime")) { entity.motionY = data.getDouble(Reference.MOD_ID + ":slime"); data.removeTag(Reference.MOD_ID + ":slime"); } if (Math.abs(entity.motionY) < 0.1 && !entity.isSneaking()) { double d = 0.4 + Math.abs(entity.motionY) * 0.2; entity.motionX *= d; entity.motionZ *= d; } }
Example 16
Source File: RenderJetPack.java From AdvancedRocketry with MIT License | 5 votes |
/** * Sets the models various rotation angles then renders the model. */ public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { //super.render(p_78088_1_, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_); biped.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity); biped.bipedRightArm.showModel = true; biped.bipedBody.showModel = true; biped.bipedLeftArm.showModel = true; GL11.glPushMatrix(); if(entity.isSneaking()) { GL11.glTranslatef(0,.25f, 0); } biped.bipedBody.render(scale); biped.bipedLeftArm.render(scale); biped.bipedRightArm.render(scale); GL11.glPopMatrix(); GL11.glPushMatrix(); //GL11.glTranslatef(x, y, z); if(entity.isSneaking()) { GL11.glRotatef(0.5F * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0,.2f, 0); } Minecraft.getMinecraft().renderEngine.bindTexture(texture); model.renderAll(); GL11.glPopMatrix(); }
Example 17
Source File: MovingStructure.java From Framez with GNU General Public License v3.0 | 5 votes |
private void moveEntity(Entity entity) { Vec3d pos = getMovement().transform(new Vec3d(entity.posX, entity.posY, entity.posZ), 1).clone() .sub(new Vec3d(entity.posX, entity.posY, entity.posZ)).mul(1 / (1 / getSpeed() - 1)); pos.setY(Math.max(pos.getY(), 0)); entity.motionY = Math.max(entity.motionY, 0) + pos.getY(); if (!(entity instanceof EntityPlayer) || !(entity.isSneaking())) entity.moveEntity(pos.getX(), 0, pos.getZ()); entity.onGround = true; entity.fallDistance = 0; }
Example 18
Source File: WallHackModule.java From seppuku with GNU General Public License v3.0 | 5 votes |
private int getColor(Entity entity) { int ret = -1; if (entity instanceof IAnimals && !(entity instanceof IMob)) { ret = 0xFF00FF44; } if (entity instanceof IMob) { ret = 0xFFFFAA00; } if (entity instanceof EntityBoat || entity instanceof EntityMinecart || entity instanceof EntityMinecartContainer) { ret = 0xFF00FFAA; } if (entity instanceof EntityItem) { ret = 0xFF00FFAA; } if (entity instanceof EntityEnderCrystal) { ret = 0xFFCD00CD; } if (entity instanceof EntityEnderPearl) { ret = 0xFFCD00CD; } if (entity instanceof EntityPlayer) { ret = 0xFFFF4444; if (entity == Minecraft.getMinecraft().player) { ret = -1; } if (entity.isSneaking()) { ret = 0xFFEE9900; } if (Seppuku.INSTANCE.getFriendManager().isFriend(entity) != null) { ret = 0xFF9900EE; } } return ret; }
Example 19
Source File: BlockSolidAir.java From Artifacts with MIT License | 5 votes |
@Override public void onEntityWalking(World world, int x, int y, int z, Entity entity) { super.onEntityWalking(world, x, y, z, entity); if(entity instanceof EntityPlayer && !entity.isSneaking()) { world.setBlockMetadataWithNotify(x, y, z, 0, 3); } }
Example 20
Source File: BlockQuickSand.java From Artifacts with MIT License | 4 votes |
/** * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity */ @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if(entity instanceof EntityLivingBase && headInQuicksand(world, x, y, z, entity)) { //If the entity is inside of a quicksand block, give some damage. It's only 0.5f damage, so a quarter heart. entity.attackEntityFrom(DamageSourceQuicksand.instance, 0.5f); //I tried to make it render the texture on your screen like if you're in a block, //but it turned out to be a private method. } if(insideQuicksand(world, x, y, z, entity)) { //If the entity inside of the quicksand is a player, make the player fall slowly. //If the player is moving horizontally ("struggling"), make them fall faster. //If the player is sneaking, make them "swim" upwards. if(entity instanceof EntityPlayer) { double horizMotion = Math.sqrt(entity.motionX*entity.motionX + entity.motionZ*entity.motionZ); if(horizMotion > 0.0) { if(debug) System.out.println("Horizonal Motion: " + horizMotion); } if(entity.isSneaking()) { //Make the player go up slowly. Weird numbers, right? entity.motionY = 0.085102044; } else { //Make the player go down slowly. Seriously, I don't know why these numbers are so exact. entity.motionY = 0.074897955; } if(horizMotion > 0.001) { //If the player is moving significantly horizontally, make them sink faster. entity.motionY -= horizMotion*0.3; } entity.fallDistance = 0; } else { //If not a player, just set the entity in a web. //It's a bit glitchy otherwise... especially with chickens, who don't sink. entity.setInWeb(); } } }