Skip to content

Commit

Permalink
fix: we can use 'this' here
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jun 14, 2024
1 parent 40dc6f7 commit 1731cb3
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/main/java/net/zepalesque/redux/item/VeridiumItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,16 @@ default ItemStack deplete(ItemStack stack, @Nullable LivingEntity user, int amou
if (user != null && user.level().isClientSide()) {
return stack;
}
if (stack.getItem() instanceof VeridiumItem vi) {
CompoundTag tag = stack.getOrCreateTag();
if (tag.getByte(NBT_KEY) > amount) {
byte infusion = (byte) (tag.getByte(NBT_KEY) - amount);
stack.addTagElement(NBT_KEY, ByteTag.valueOf(infusion));
} else {
if (user != null && !user.level().isClientSide() && user instanceof ServerPlayer sp) {
sp.connection.send(new ClientboundSoundPacket(getUninfuseSound(), SoundSource.PLAYERS, sp.getX(), sp.getY(), sp.getZ(), 0.8F, 0.8F + sp.level().getRandom().nextFloat() * 0.4F, sp.level().getRandom().nextLong()));
}
return vi.getUninfusedStack(stack);

CompoundTag tag = stack.getOrCreateTag();
if (tag.getByte(NBT_KEY) > amount) {
byte infusion = (byte) (tag.getByte(NBT_KEY) - amount);
stack.addTagElement(NBT_KEY, ByteTag.valueOf(infusion));
} else {
if (user != null && !user.level().isClientSide() && user instanceof ServerPlayer sp) {
sp.connection.send(new ClientboundSoundPacket(getUninfuseSound(), SoundSource.PLAYERS, sp.getX(), sp.getY(), sp.getZ(), 0.8F, 0.8F + sp.level().getRandom().nextFloat() * 0.4F, sp.level().getRandom().nextLong()));
}
return this.getUninfusedStack(stack);
}
return null;
}
Expand Down

0 comments on commit 1731cb3

Please sign in to comment.