Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item doesnt immediately update with drag and drop enchant system #654

Open
HashimTheArab opened this issue Aug 22, 2022 · 2 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@HashimTheArab
Copy link
Contributor

HashimTheArab commented Aug 22, 2022

2022-08-21_18-11-21.mp4

(flashes vid)

this is the code

func (h *InventoryHandler) HandlePlace(ctx *event.Context, slot int, it item.Stack) {
	enchant, ok := ce.FromBook(it)
	if !ok {
		return
	}

	targetItem, err := h.p.Inventory().Item(slot)
	if targetItem.Empty() || err != nil || !enchant.CompatibleWithItem(targetItem.Item()) {
		return
	}
	if err := h.p.Inventory().SetItem(slot, ce.ApplyEnchant(targetItem, enchant.Type(), enchant.Level())); err == nil {
		ctx.Cancel()
		time.AfterFunc(time.Millisecond*50, func() {
			h.p.Inventory().RemoveItem(it)
		})
	}
}

if it helps this is whats showing in the console

DEBU[0081] failed processing packet from (R53D): failed changing held slot: client-side item must be identical to server-side item, but got differences: client: Stack<item.Pickaxe{Tier:{HarvestLevel:4 BaseMiningEffic
iency:9 BaseAttackDamage:5 EnchantmentValue:15 Durability:2031 Name:netherite}}>(custom name='', lore='[]', damage=0, anvilCost=0) x1 vs server: Stack<item.Pickaxe{Tier:{HarvestLevel:4 BaseMiningEfficiency:9 BaseAttackDamage:5 Encha
ntmentValue:15 Durability:2031 Name:netherite}}>(custom name='', lore='[§r§6Speed 1§r]', damage=0, anvilCost=0) x1
DEBU[0081] failed processing packet from 127.0.0.1:59081 (R53D): InventoryTransaction: failed verifying actions in Normal transaction: different item thrown than held in slot: item.Stack{id:8367, item:item.Pickaxe{Tier:item.ToolTier
{HarvestLevel:4, BaseMiningEfficiency:9, BaseAttackDamage:5, EnchantmentValue:15, Durability:2031, Name:"netherite"}}, count:1, customName:"", lore:[]string(nil), damage:0, anvilCost:0, data:map[string]interface {}(nil), enchantment
s:map[item.EnchantmentType]item.Enchantment(nil)} was thrown but held item.Stack{id:8355, item:item.Pickaxe{Tier:item.ToolTier{HarvestLevel:4, BaseMiningEfficiency:9, BaseAttackDamage:5, EnchantmentValue:15, Durability:2031, Name:"n
etherite"}}, count:1, customName:"", lore:[]string{"§r§6Speed 1§r"}, damage:0, anvilCost:0, data:map[string]interface {}(nil), enchantments:map[item.EnchantmentType]item.Enchantment{ce.Speed{customEnchant:ce.customEnchant{}}:item.En
chantment{t:ce.Speed{customEnchant:ce.customEnchant{}}, lvl:1}}}
@Theflashiscool2
Copy link

Directly after the book is placed on the item it sends this: DEBU[0047] failed processing packet from (R53D): ItemStackRequest: error resolving item stack request: *protocol.SwapStackRequestAction: action was cancelled
The console thing shown above happens when you try and drop the item after using the book on it.

@Sandertv
Copy link
Member

Probably a duplicate of #646.

@Sandertv Sandertv added the bug Something isn't working label Aug 22, 2022
@Sandertv Sandertv added this to the v0.9.0 milestone Aug 22, 2022
@DaPigGuy DaPigGuy modified the milestones: v0.9.0, v0.10.0 Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants