mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Remove unused variables; fix opening double chests quickly
This commit is contained in:
parent
7e773c9970
commit
ca3f9550dd
5 changed files with 7 additions and 14 deletions
|
@ -250,12 +250,6 @@ public class GeyserSession implements CommandSender {
|
||||||
@Setter
|
@Setter
|
||||||
private Entity ridingVehicleEntity;
|
private Entity ridingVehicleEntity;
|
||||||
|
|
||||||
@Setter
|
|
||||||
private long lastWindowCloseTime = 0;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private long lastInteractedVillagerEid;
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private Int2ObjectMap<Recipe> craftingRecipes;
|
private Int2ObjectMap<Recipe> craftingRecipes;
|
||||||
private final Set<String> unlockedRecipes;
|
private final Set<String> unlockedRecipes;
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
|
||||||
@Override
|
@Override
|
||||||
public void translate(ContainerClosePacket packet, GeyserSession session) {
|
public void translate(ContainerClosePacket packet, GeyserSession session) {
|
||||||
session.addInventoryTask(() -> {
|
session.addInventoryTask(() -> {
|
||||||
session.setLastWindowCloseTime(0);
|
|
||||||
byte windowId = packet.getId();
|
byte windowId = packet.getId();
|
||||||
|
|
||||||
//Client wants close confirmation
|
//Client wants close confirmation
|
||||||
|
|
|
@ -327,10 +327,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||||
session.sendDownstreamPacket(interactAtPacket);
|
session.sendDownstreamPacket(interactAtPacket);
|
||||||
|
|
||||||
EntitySoundInteractionHandler.handleEntityInteraction(session, vector, entity);
|
EntitySoundInteractionHandler.handleEntityInteraction(session, vector, entity);
|
||||||
|
|
||||||
if (entity instanceof AbstractMerchantEntity) {
|
|
||||||
session.setLastInteractedVillagerEid(packet.getRuntimeEntityId());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 1: //Attack
|
case 1: //Attack
|
||||||
if (entity.getEntityType() == EntityType.ENDER_DRAGON) {
|
if (entity.getEntityType() == EntityType.ENDER_DRAGON) {
|
||||||
|
|
|
@ -77,7 +77,8 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
||||||
updateTradePacket.setPlayerUniqueEntityId(session.getPlayerEntity().getGeyserId());
|
updateTradePacket.setPlayerUniqueEntityId(session.getPlayerEntity().getGeyserId());
|
||||||
updateTradePacket.setTraderUniqueEntityId(villager.getGeyserId());
|
updateTradePacket.setTraderUniqueEntityId(villager.getGeyserId());
|
||||||
NbtMapBuilder builder = NbtMap.builder();
|
NbtMapBuilder builder = NbtMap.builder();
|
||||||
List<NbtMap> tags = new ArrayList<>();
|
boolean addExtraTrade = packet.isRegularVillager() && packet.getVillagerLevel() < 5;
|
||||||
|
List<NbtMap> tags = new ArrayList<>(addExtraTrade ? packet.getTrades().length + 1 : packet.getTrades().length);
|
||||||
for (int i = 0; i < packet.getTrades().length; i++) {
|
for (int i = 0; i < packet.getTrades().length; i++) {
|
||||||
VillagerTrade trade = packet.getTrades()[i];
|
VillagerTrade trade = packet.getTrades()[i];
|
||||||
NbtMapBuilder recipe = NbtMap.builder();
|
NbtMapBuilder recipe = NbtMap.builder();
|
||||||
|
@ -101,7 +102,7 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hidden trade to fix visual experience bug
|
//Hidden trade to fix visual experience bug
|
||||||
if (packet.isRegularVillager() && packet.getVillagerLevel() < 5) {
|
if (addExtraTrade) {
|
||||||
tags.add(NbtMap.builder()
|
tags.add(NbtMap.builder()
|
||||||
.putInt("maxUses", 0)
|
.putInt("maxUses", 0)
|
||||||
.putInt("traderExp", 0)
|
.putInt("traderExp", 0)
|
||||||
|
@ -117,7 +118,7 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.putList("Recipes", NbtType.COMPOUND, tags);
|
builder.putList("Recipes", NbtType.COMPOUND, tags);
|
||||||
List<NbtMap> expTags = new ArrayList<>();
|
List<NbtMap> expTags = new ArrayList<>(5);
|
||||||
expTags.add(NbtMap.builder().putInt("0", 0).build());
|
expTags.add(NbtMap.builder().putInt("0", 0).build());
|
||||||
expTags.add(NbtMap.builder().putInt("1", 10).build());
|
expTags.add(NbtMap.builder().putInt("1", 10).build());
|
||||||
expTags.add(NbtMap.builder().putInt("2", 70).build());
|
expTags.add(NbtMap.builder().putInt("2", 70).build());
|
||||||
|
|
|
@ -79,6 +79,9 @@ public class InventoryUtils {
|
||||||
if (openInv != null && openInv.getId() == inventory.getId()) {
|
if (openInv != null && openInv.getId() == inventory.getId()) {
|
||||||
translator.openInventory(session, inventory);
|
translator.openInventory(session, inventory);
|
||||||
translator.updateInventory(session, inventory);
|
translator.updateInventory(session, inventory);
|
||||||
|
} else if (openInv != null && openInv.isPending()) {
|
||||||
|
// Presumably, this inventory is no longer relevant, and the client doesn't care about it
|
||||||
|
displayInventory(session, openInv);
|
||||||
}
|
}
|
||||||
}), 200, TimeUnit.MILLISECONDS);
|
}), 200, TimeUnit.MILLISECONDS);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue