net.minecraft.client.entity.EntityPlayerSP Java Examples

The following examples show how to use net.minecraft.client.entity.EntityPlayerSP. 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: SneakHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onDisable()
{
	MinecraftForge.EVENT_BUS.unregister(this);
	
	switch(mode.getSelected())
	{
		case LEGIT:
		KeyBindingUtils.resetPressed(mc.gameSettings.keyBindSneak);
		break;
		
		case PACKET:
		EntityPlayerSP player = WMinecraft.getPlayer();
		player.connection.sendPacket(
			new CPacketEntityAction(player, Action.STOP_SNEAKING));
		break;
	}
}
 
Example #2
Source File: CivilizationOverlayHandler.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int screenWidth, int screenHeight) {
	this.screenWidth = screenWidth;
	this.screenHeight = screenHeight;

	EntityPlayerSP player = mc.player;

	if (player.dimension != 0) {
		return;
	}

	Province civ = PlayerCivilizationCapabilityImpl.get(player).getInCivilization();

	if (civ == null || civ.civilization == null) {
		return;
	}

	displayPosition = ConfigurationHandler.repDisplayPosition;

	if ("OFF".equals(displayPosition)) {
		return;
	}

	drawCurrentCivilizationIcon(civ, player);
}
 
Example #3
Source File: PotionNullMovement.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onTick(TickEvent.ClientTickEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	EntityPlayerSP player = mc.player;
	if (player == null) return;
	if (player.isPotionActive(ModPotions.NULL_MOVEMENT)) {
		//player.rotationYaw = player.getEntityData().getFloat("rot_yaw");
		//player.rotationPitch = player.getEntityData().getFloat("rot_pitch");
		//player.prevRotationYaw = player.getEntityData().getFloat("rot_yaw");
		//player.prevRotationPitch = player.getEntityData().getFloat("rot_pitch");

		if (!(player.movementInput instanceof NullMovementInput))
			player.movementInput = new NullMovementInput(player.movementInput);
	} else if (!(player.movementInput instanceof MovementInputFromOptions))
		player.movementInput = new MovementInputFromOptions(mc.gameSettings);
}
 
Example #4
Source File: BufferSpeed.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
private boolean isNearBlock() {
    final EntityPlayerSP thePlayer = mc.thePlayer;
    final WorldClient theWorld = mc.theWorld;

    final List<BlockPos> blocks = new ArrayList<>();

    blocks.add(new BlockPos(thePlayer.posX, thePlayer.posY + 1, thePlayer.posZ - 0.7));
    blocks.add(new BlockPos(thePlayer.posX + 0.7, thePlayer.posY + 1, thePlayer.posZ));
    blocks.add(new BlockPos(thePlayer.posX, thePlayer.posY + 1, thePlayer.posZ + 0.7));
    blocks.add(new BlockPos(thePlayer.posX - 0.7, thePlayer.posY + 1, thePlayer.posZ));

    for(final BlockPos blockPos : blocks)
        if((theWorld.getBlockState(blockPos).getBlock().getBlockBoundsMaxY() ==
                theWorld.getBlockState(blockPos).getBlock().getBlockBoundsMinY() + 1 &&
                !theWorld.getBlockState(blockPos).getBlock().isTranslucent() &&
                theWorld.getBlockState(blockPos).getBlock() != Blocks.water &&
                !(theWorld.getBlockState(blockPos).getBlock() instanceof BlockSlab)) ||
                theWorld.getBlockState(blockPos).getBlock() == Blocks.barrier)
            return true;

    return false;
}
 
Example #5
Source File: CivilizationOverlayHandler.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
private void drawReputationText(Province civ, EntityPlayerSP player) {
	int textX = determineTextX();
	int textY = determineIconY();

	if (displayPosition.contains("RIGHT")) {
		drawRightString(Integer.toString(PlayerCivilizationCapabilityImpl.get(player).getReputation(civ.civilization), 10) + " Rep", textX, textY,
				0xffffff);
		textY += 10;

		drawRightString(PlayerCivilizationCapabilityImpl.get(player).getReputationLevel(civ.civilization).getLocalname(), textX, textY, 0xffffff);
		textY += 10;

		drawRightString(civ.name, textX, textY, 0xffffff);
	} else {
		drawString(Integer.toString(PlayerCivilizationCapabilityImpl.get(player).getReputation(civ.civilization), 10) + " Rep", textX, textY,
				0xffffff);
		textY += 10;

		drawString(PlayerCivilizationCapabilityImpl.get(player).getReputationLevel(civ.civilization).getLocalname(), textX, textY, 0xffffff);
		textY += 10;

		drawString(civ.name, textX, textY, 0xffffff);
	}
}
 
Example #6
Source File: GeneralChiselClient.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
public static void speedupPlayer(World world, Entity entity, double concreteVelocity) {
	double velocity = Math.sqrt(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ);

	if (!(entity instanceof EntityPlayerSP))
		return;
	if (velocity == 0)
		return;
	if (velocity >= Configurations.concreteVelocity)
		return;

	EntityPlayerSP player = (EntityPlayerSP) entity;

	if (Math.abs(player.movementInput.moveForward) < 0.75f && Math.abs(player.movementInput.moveStrafe) < 0.75f)
		return;

	entity.motionX = Configurations.concreteVelocity * entity.motionX / velocity;
	entity.motionZ = Configurations.concreteVelocity * entity.motionZ / velocity;
}
 
Example #7
Source File: AimBot.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onTicks() {
    block3:
    {
        try {
            if (KillAura.isActive || MobAura.isActive || ProphuntAura.isActive) {
                break block3;
            }
            for (Object o : Wrapper.INSTANCE.world().loadedEntityList) {
                EntityPlayer e;
                if (!(o instanceof EntityPlayer) || (e = (EntityPlayer) o) instanceof EntityPlayerSP || Wrapper.INSTANCE.player().getDistanceToEntity(e) > CheatConfiguration.config.aimbotdistance || e.isDead || !Wrapper.INSTANCE.player().canEntityBeSeen(e) || !e.isEntityAlive() || e.isDead || AuraConfiguration.config.friends.contains(e.getCommandSenderName())) {
                    continue;
                }
                AimBot.faceEntity(e);
                break;
            }
        } catch (Exception ex) {
        }
    }
}
 
Example #8
Source File: UIFactory.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public final void initClientUI(PacketBuffer serializedHolder, int windowId, List<PacketUIWidgetUpdate> initialWidgetUpdates) {
    E holder = readHolderFromSyncData(serializedHolder);
    Minecraft minecraft = Minecraft.getMinecraft();
    EntityPlayerSP entityPlayer = minecraft.player;

    ModularUI uiTemplate = createUITemplate(holder, entityPlayer);
    uiTemplate.initWidgets();
    ModularUIGui modularUIGui = new ModularUIGui(uiTemplate);
    modularUIGui.inventorySlots.windowId = windowId;
    for (PacketUIWidgetUpdate packet : initialWidgetUpdates) {
        modularUIGui.handleWidgetUpdate(packet);
    }
    minecraft.addScheduledTask(() -> {
        minecraft.displayGuiScreen(modularUIGui);
        minecraft.player.openContainer.windowId = windowId;
    });
}
 
Example #9
Source File: SneakHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onPreMotion(WPreMotionEvent event)
{
	switch(mode.getSelected())
	{
		case LEGIT:
		KeyBindingUtils.setPressed(mc.gameSettings.keyBindSneak, true);
		break;
		
		case PACKET:
		KeyBindingUtils.resetPressed(mc.gameSettings.keyBindSneak);
		EntityPlayerSP player = event.getPlayer();
		player.connection.sendPacket(
			new CPacketEntityAction(player, Action.START_SNEAKING));
		player.connection.sendPacket(
			new CPacketEntityAction(player, Action.STOP_SNEAKING));
		break;
	}
}
 
Example #10
Source File: FreecamHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onUpdate(WUpdateEvent event)
{
	EntityPlayerSP player = event.getPlayer();
	
	player.motionX = 0;
	player.motionY = 0;
	player.motionZ = 0;
	
	player.onGround = false;
	player.jumpMovementFactor = speed.getValueF();
	
	if(mc.gameSettings.keyBindJump.isKeyDown())
		player.motionY += speed.getValue();
	
	if(mc.gameSettings.keyBindSneak.isKeyDown())
		player.motionY -= speed.getValue();
}
 
Example #11
Source File: BoingHandler.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SubscribeEvent
public static void onJump(InputEvent.KeyInputEvent event) {
    if(jump.isPressed()) {
        EntityPlayerSP player = Minecraft.getMinecraft().player;
        BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ);
        int level = EnchantmentHelper.getMaxEnchantmentLevel(BiJump.BOINGBOING, player);

        if(player.world.getBlockState(pos).getBlock().equals(Blocks.AIR) &&
                player.world.getBlockState(pos.add(0, -2, 0)).getBlock().equals(Blocks.AIR) &&
                !jumpybois.contains(player) &&  level > 0) {
            player.sprintingTicksLeft += 40;
            player.addVelocity(0, 1.2 * Math.sqrt(level), 0);
            jumpybois.add(player);
            new Timer().schedule(new TimerTask(){ @Override public void run(){ jumpybois.remove(player);}}, 7000);
        }
    }
}
 
Example #12
Source File: HotBarRefillModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Searches the player's inventory for the smallest stack.
 * Gets the smallest stack so that there are not a a bunch
 * of partially full stacks left in the player's inventory.
 *
 * @param player The player
 * @param itemStack The item type that should be found
 * @return The index of the smallest stack of the given item, -1 if the given item does not exist
 */
private int getSmallestStack(EntityPlayerSP player, ItemStack itemStack) {
    if (itemStack == null) {
        return -1;
    }

    int minCount = itemStack.getMaxStackSize() + 1;
    int minIndex = -1;

    // i starts at 9 so that the hotbar is not checked
    for (int i = 9; i < player.inventory.mainInventory.size(); i++) {
        ItemStack stack = player.inventory.mainInventory.get(i);

        if (stack.getItem() != Items.AIR
            && stack.getItem() == itemStack.getItem()
            && stack.getCount() < minCount) {

            minCount = stack.getCount();
            minIndex = i;
        }
    }

    return minIndex;
}
 
Example #13
Source File: HotBarRefillModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks all items in the hotbar that can be refilled
 * If offhand is on, it is checked first
 *
 * @param player The player
 * @return The index of the first item to be refilled, -1 if there are no refillable items
 */
private int getRefillable(EntityPlayerSP player) {
    if (offHand.getValue()) {
        if (player.getHeldItemOffhand().getItem() != Items.AIR
            && player.getHeldItemOffhand().getCount() < player.getHeldItemOffhand().getMaxStackSize()
            && (double) player.getHeldItemOffhand().getCount() / player.getHeldItemOffhand().getMaxStackSize() <= (percentage.getValue() / 100.0)) {
            return 45;
        }
    }

    for (int i = 0; i < 9; i++) {
        ItemStack stack = player.inventory.mainInventory.get(i);
        if (stack.getItem() != Items.AIR && stack.getCount() < stack.getMaxStackSize()
            && (double) stack.getCount() / stack.getMaxStackSize() <= (percentage.getValue() / 100.0)) {
            return i;
        }
    }

    return -1;
}
 
Example #14
Source File: GuiArmorSelection.java    From Levels with GNU General Public License v2.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
protected void actionPerformed(GuiButton button) throws IOException 
{
	EntityPlayerSP player = mc.player;
	ItemStack stack = player.inventory.getCurrentItem();
	NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
	
	if (player != null && stack != null && nbt != null)
	{
		if (Experience.getAttributeTokens(nbt) > 0)
		{
			if (stack.getItem() instanceof ItemArmor)
			{
				for (int i = 0; i < attributes.length; i++)
				{
					if (button == attributes[i])
						Levels.network.sendToServer(new PacketAttributeSelection(i));
				}
			}
		}
	}
}
 
Example #15
Source File: MissionQuitCommandsImplementation.java    From malmo with MIT License 6 votes vote down vote up
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit)
{
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if (player == null)
    {
        return false;
    }

    if (!verb.equalsIgnoreCase(MissionQuitCommand.QUIT.value()))
    {
        return false;
    }

    player.sendChatMessage( "Quitting mission" );
    this.iWantToQuit = true;
    return true;
}
 
Example #16
Source File: PlayerListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
/**
 * This method handles key presses while the player is in-game.
 * For handling of key presses while a GUI (e.g. chat, pause menu, F3) is open,
 * see {@link GuiScreenListener#onKeyInput(GuiScreenEvent.KeyboardInputEvent)}
 *
 * @param e the {@code KeyInputEvent}
 */
@SubscribeEvent(receiveCanceled = true)
public void onKeyInput(InputEvent.KeyInputEvent e) {
    if (main.getOpenSettingsKey().isPressed()) {
        main.getUtils().setFadingIn(true);
        main.getRenderListener().setGuiToOpen(EnumUtils.GUIType.MAIN, 1, EnumUtils.GuiTab.MAIN);
    } else if (main.getOpenEditLocationsKey().isPressed()) {
        main.getUtils().setFadingIn(false);
        main.getRenderListener().setGuiToOpen(EnumUtils.GUIType.EDIT_LOCATIONS, 0, null);
    } else if (Keyboard.getEventKey() == DevUtils.DEV_KEY && Keyboard.getEventKeyState()) {
        // Copy Mob Data
        if (main.isDevMode()) {
            EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
            List<Entity> entityList = Minecraft.getMinecraft().theWorld.loadedEntityList;

            DevUtils.copyMobData(player, entityList);
        }
    }
}
 
Example #17
Source File: ReachDisplay.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@InvokeEvent
public void attacc(PlayerAttackEntityEvent entityEvent) {
    if (!Settings.SHOW_HIT_DISTANCES) return;
    if (!(entityEvent.getEntity() instanceof EntityLivingBase)) return;
    if (((EntityLivingBase) entityEvent.getEntity()).hurtTime > 0) return;
    if (locked) return;

    locked = true;
    EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer;
    double d0 = 6;
    Vec3 vec3 = entity.getPositionEyes(0.0F);
    Vec3 vec31 = entity.getLook(0.0F);
    Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
    Entity entity1 = entityEvent.getEntity();
    float f1 = .1F;
    AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f1, f1, f1);
    MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
    if (movingobjectposition == null) return;
    Vec3 vec33 = movingobjectposition.hitVec;
    hits.add(new Hit(vec33, dis));

}
 
Example #18
Source File: PlayerListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
/**
 * Block emptying of buckets separately because they aren't handled like blocks.
 * The event name {@code FillBucketEvent} is misleading. The event is fired when buckets are emptied also so
 * it should really be called {@code BucketEvent}.
 *
 * @param bucketEvent the event
 */
@SubscribeEvent
public void onBucketEvent(FillBucketEvent bucketEvent) {
    ItemStack bucket = bucketEvent.current;
    EntityPlayer player = bucketEvent.entityPlayer;

    if (main.getUtils().isOnSkyblock() && player instanceof EntityPlayerSP) {
        if (main.getConfigValues().isEnabled(Feature.AVOID_PLACING_ENCHANTED_ITEMS)) {
            String skyblockItemId = ItemUtils.getSkyBlockItemID(bucket);

            if (skyblockItemId != null && skyblockItemId.equals("ENCHANTED_LAVA_BUCKET")) {
                bucketEvent.setCanceled(true);
            }
        }
    }
}
 
Example #19
Source File: FlightHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onUpdate(WUpdateEvent event)
{
	EntityPlayerSP player = event.getPlayer();
	
	player.capabilities.isFlying = false;
	player.motionX = 0;
	player.motionY = 0;
	player.motionZ = 0;
	player.jumpMovementFactor = speed.getValueF();
	
	if(mc.gameSettings.keyBindJump.isKeyDown())
		player.motionY += speed.getValue();
	if(mc.gameSettings.keyBindSneak.isKeyDown())
		player.motionY -= speed.getValue();
}
 
Example #20
Source File: ChatCommandsImplementation.java    From malmo with MIT License 6 votes vote down vote up
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit)
{
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if (player == null)
    {
        return false;
    }
    
    if (!verb.equalsIgnoreCase(ChatCommand.CHAT.value()))
    {
        return false;
    }
    
    player.sendChatMessage( parameter );
    return true;
}
 
Example #21
Source File: RewardForTouchingBlockTypeImplementation.java    From malmo with MIT License 6 votes vote down vote up
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().player;

    List<BlockPos> touchingBlocks = PositionHelper.getTouchingBlocks(player);
    for (BlockPos pos : touchingBlocks) {
        IBlockState iblockstate = player.world.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 );
            }
        }
    }
}
 
Example #22
Source File: CommandForWheeledRobotNavigationImplementation.java    From malmo with MIT License 5 votes vote down vote up
private void init()
{
	EntityPlayerSP player = Minecraft.getMinecraft().player;
	this.mVelocity = 0;
    this.mTargetVelocity = 0;
    this.mTicksSinceLastVelocityChange = 0;
    this.mCameraPitch = (player != null) ? player.rotationPitch : 0;
    this.pitchScale = 0;
    this.mYaw = (player != null) ? player.rotationYaw : 0;
    this.yawScale = 0;
}
 
Example #23
Source File: LevelheadGui.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void doGeneral(DisplayConfig config, Levelhead instance, int editWidth) {
    reg(new GuiButton(++currentID, width - editWidth - 1, 29, editWidth, 20, YELLOW + "Status: "
        + (config.isEnabled() ? GREEN + "Enabled" : RED + "Disabled")), button -> config.setEnabled(!config.isEnabled()));

    reg(new GuiButton(++currentID, width - editWidth - 1, 50, editWidth, 20, YELLOW + "Type: "
        + AQUA + instance.getTypes().optJsonObject(config.getType()).optString("name")), button -> {
        String currentType = config.getType();
        HashMap<String, String> typeMap = instance.allowedTypes();
        Set<String> keys = typeMap.keySet();
        List<String> strings = new ArrayList<>(keys);
        strings.sort(String::compareTo);
        int i = strings.indexOf(config.getType()) + 1;

        if (i >= strings.size())
            i = 0;

        config.setType(strings.get(i));

        if (config.getCustomHeader().equalsIgnoreCase(typeMap.get(currentType))) {
            config.setCustomHeader(typeMap.get(strings.get(i)));

            if (currentlyBeingEdited instanceof AboveHeadDisplay) {
                textField.setText(config.getCustomHeader());
            }
        }

        EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
        currentlyBeingEdited.getCache().remove(thePlayer.getUniqueID());
        currentlyBeingEdited.getTrueValueCache().remove(thePlayer.getUniqueID());
        bigChange = true;
    });
}
 
Example #24
Source File: WinTrackingChatHandler.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean chatReceived(IChatComponent component, String text) {
    Matcher matcher = regexPatterns.get(ChatRegexType.WIN).matcher(text);
    if (matcher.matches()) {
        String winnersString = matcher.group("winners");
        String[] winners = winnersString.split(", ");

        // Means they have a rank prefix. We don't want that
        for (int i = 0; i < winners.length; i++) {
            String winner = winners[i];
            if (winner.contains(" ")) {
                winners[i] = winner.split(" ")[1];
            }
        }

        EventBus.INSTANCE.post(new HypixelWinEvent(Arrays.asList(winners)));
    }

    // Should actually change the regex tho
    EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
    if (thePlayer == null) return false;

    if (text.toLowerCase().contains(thePlayer.getName().toLowerCase() + " winner!")) {
        EventBus.INSTANCE.post(new HypixelWinEvent(Collections.singletonList(thePlayer.getName())));
    }

    return false;
}
 
Example #25
Source File: ArrowCount.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void draw(int starX, double startY, boolean isConfig) {
    List<ItemStack> list = new ArrayList<>();
    list.add(new ItemStack(Item.getItemById(262), 64));
    EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
    if (thePlayer != null) {
        int c = Arrays.stream(thePlayer.inventory.mainInventory).filter(Objects::nonNull).filter(is ->
            is.getUnlocalizedName().equalsIgnoreCase("item.arrow")).mapToInt(is -> is.stackSize).sum();
        ElementRenderer.render(list, starX, startY, false);
        ElementRenderer.draw(starX + 16, startY + 8, "x" + (isConfig ? 64 : c));
    }
}
 
Example #26
Source File: EntityHamster.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public EntityHamster(World worldIn) {
    super(worldIn);
    setSize(0.4F, 0.2F);
    ((PathNavigateGround) getNavigator()).setAvoidsWater(true);
    tasks.addTask(1, new EntityAIFollowOwner(this, 1f, 10f, 2f));
    tasks.addTask(2, new EntityAIWander(this, 1));
    tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayerSP.class, 8f));
    tasks.addTask(3, new EntityAILookIdle(this));
    setTamed(true);
    preventEntitySpawning = false;
}
 
Example #27
Source File: HyperiumMinecraft.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void loop(boolean inGameHasFocus, WorldClient theWorld, EntityPlayerSP thePlayer, RenderManager renderManager, Timer timer) {
    if (inGameHasFocus && theWorld != null) {
        HyperiumHandlers handlers = Hyperium.INSTANCE.getHandlers();
        RenderPlayerEvent event = new RenderPlayerEvent(thePlayer, renderManager, renderManager.viewerPosZ, renderManager.viewerPosY, renderManager.viewerPosZ,
            timer.renderPartialTicks);
        if (handlers != null && Settings.SHOW_PART_1ST_PERSON) {
            handlers.getParticleAuraHandler().renderPlayer(event);
        }
    }
}
 
Example #28
Source File: UUIDUtil.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static UUID getClientUUID() {
    GameProfile profile = Minecraft.getMinecraft().getSession().getProfile();
    if (profile != null) {
        UUID id = profile.getId();
        if (id != null) return id;
    }

    EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
    if (thePlayer != null) return thePlayer.getUniqueID();
    return null;
}
 
Example #29
Source File: AgentQuitFromTouchingBlockTypeImplementation.java    From malmo with MIT License 5 votes vote down vote up
@Override
public boolean doIWantToQuit(MissionInit missionInit)
{
    if (this.wantToQuit)
        return true;
    
	EntityPlayerSP player = Minecraft.getMinecraft().player;
       List<BlockPos> touchingBlocks = PositionHelper.getTouchingBlocks(player);
       for (BlockPos pos : touchingBlocks)
       {
       	IBlockState bs = player.world.getBlockState(pos);
       	// Does this block match our trigger specs?
       	String blockname = bs.getBlock().getUnlocalizedName().toLowerCase();
       	if (!this.blockTypeNames.contains(blockname))
       		continue;
       	
   		// The type matches one of our block types, so now we need to perform additional checks.
       	for (BlockSpecWithDescription blockspec : this.params.getBlock())
       	{
       		if (findMatch(blockspec, bs))
       		{
       			this.quitCode = blockspec.getDescription();
       			return true;	// Yes, we want to quit!
       		}
       	}
       }
       return false;	// Nothing matched, we can quit happily.
}
 
Example #30
Source File: RotationUtils.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
public static Vec3d getClientLookVec()
{
	EntityPlayerSP player = WMinecraft.getPlayer();
	
	float f =
		MathHelper.cos(-player.rotationYaw * 0.017453292F - (float)Math.PI);
	float f1 =
		MathHelper.sin(-player.rotationYaw * 0.017453292F - (float)Math.PI);
	
	float f2 = -MathHelper.cos(-player.rotationPitch * 0.017453292F);
	float f3 = MathHelper.sin(-player.rotationPitch * 0.017453292F);
	
	return new Vec3d(f1 * f2, f3, f * f2);
}