mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Add files via upload
This commit is contained in:
parent
43d520f692
commit
83e9ee31e3
|
|
@ -36,6 +36,8 @@
|
|||
#include "FrustumCuller.h"
|
||||
#include "Camera.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "..\Minecraft.World\MobEffect.h"
|
||||
#include "..\Minecraft.World\Difficulty.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.h"
|
||||
|
|
@ -1460,6 +1462,8 @@ void Minecraft::run_middle()
|
|||
#endif
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DROP)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_DROP;
|
||||
|
||||
if(InputManager.ButtonPressed(i, MINECRAFT_ACTION_DROPALL)) localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_DROPALL;
|
||||
|
||||
// 4J-PB - If we're flying, the sneak needs to be held on to go down
|
||||
if(localplayers[i]->abilities.flying)
|
||||
{
|
||||
|
|
@ -1509,8 +1513,41 @@ void Minecraft::run_middle()
|
|||
}
|
||||
}
|
||||
|
||||
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DROP))
|
||||
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_DROP;
|
||||
|
||||
// CHANGED FROM IsKeyPressed SO YOU CAN HOLD TO DROP (after 0.3 sec delay).
|
||||
|
||||
static bool wasDown = false;
|
||||
static std::chrono::steady_clock::time_point pressTime;
|
||||
|
||||
bool down = g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_DROP);
|
||||
|
||||
if (down)
|
||||
{
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (!wasDown)
|
||||
{
|
||||
// first press
|
||||
localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROP;
|
||||
pressTime = now;
|
||||
}
|
||||
else
|
||||
{
|
||||
float held = std::chrono::duration<float>(now - pressTime).count();
|
||||
|
||||
if (held > 0.3f)
|
||||
localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROP;
|
||||
}
|
||||
}
|
||||
|
||||
wasDown = down;
|
||||
|
||||
// TO DROP A STACK
|
||||
|
||||
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DROP) && g_KBMInput.IsKeyDown(VK_CONTROL))
|
||||
{
|
||||
localplayers[i]->ullButtonsPressed |= 1LL << MINECRAFT_ACTION_DROPALL;
|
||||
}
|
||||
|
||||
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING) || g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING_ALT))
|
||||
{
|
||||
|
|
@ -2592,6 +2629,36 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
*piUse=IDS_TOOLTIPS_BLOCK;
|
||||
break;
|
||||
|
||||
// QUICK EQUIP FOR ARMOR (TOOLTIPS ONLY)
|
||||
|
||||
// LEATHER
|
||||
case Item::helmet_leather_Id:
|
||||
case Item::chestplate_leather_Id:
|
||||
case Item::leggings_leather_Id:
|
||||
case Item::boots_leather_Id:
|
||||
// CHAIN
|
||||
case Item::helmet_chain_Id:
|
||||
case Item::chestplate_chain_Id:
|
||||
case Item::leggings_chain_Id:
|
||||
case Item::boots_chain_Id:
|
||||
// IRON
|
||||
case Item::helmet_iron_Id:
|
||||
case Item::chestplate_iron_Id:
|
||||
case Item::leggings_iron_Id:
|
||||
case Item::boots_iron_Id:
|
||||
// GOLD
|
||||
case Item::helmet_gold_Id:
|
||||
case Item::chestplate_gold_Id:
|
||||
case Item::leggings_gold_Id:
|
||||
case Item::boots_gold_Id:
|
||||
// DIAMOND
|
||||
case Item::helmet_diamond_Id:
|
||||
case Item::chestplate_diamond_Id:
|
||||
case Item::leggings_diamond_Id:
|
||||
case Item::boots_diamond_Id:
|
||||
*piUse=IDS_TOOLTIPS_EQUIP;
|
||||
break;
|
||||
|
||||
case Item::bucket_empty_Id:
|
||||
case Item::glassBottle_Id:
|
||||
if (bUseItem) *piUse=IDS_TOOLTIPS_COLLECT;
|
||||
|
|
@ -3802,6 +3869,11 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
player->drop();
|
||||
}
|
||||
|
||||
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROPALL)) && gameMode->isInputAllowed(MINECRAFT_ACTION_DROPALL))
|
||||
{
|
||||
player->dropall();
|
||||
}
|
||||
|
||||
uint64_t ullButtonsPressed=player->ullButtonsPressed;
|
||||
|
||||
bool selected = false;
|
||||
|
|
|
|||
|
|
@ -179,6 +179,12 @@ shared_ptr<ItemEntity> MultiplayerLocalPlayer::drop()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<ItemEntity> MultiplayerLocalPlayer::dropall()
|
||||
{
|
||||
connection->send(std::make_shared<PlayerActionPacket>(PlayerActionPacket::DROP_ALL_ITEMS, 0, 0, 0, 0));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MultiplayerLocalPlayer::reallyDrop(shared_ptr<ItemEntity> itemEntity)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ public:
|
|||
|
||||
using Player::drop;
|
||||
virtual shared_ptr<ItemEntity> drop();
|
||||
|
||||
using Player::dropall;
|
||||
virtual shared_ptr<ItemEntity> dropall();
|
||||
protected:
|
||||
virtual void reallyDrop(shared_ptr<ItemEntity> itemEntity);
|
||||
public:
|
||||
|
|
|
|||
Loading…
Reference in a new issue