Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-07 08:40:09 +01:00
Remove unused variables; fix opening double chests quickly
Dieser Commit ist enthalten in:
Ursprung
7e773c9970
Commit
ca3f9550dd
@ -250,12 +250,6 @@ public class GeyserSession implements CommandSender {
|
||||
@Setter
|
||||
private Entity ridingVehicleEntity;
|
||||
|
||||
@Setter
|
||||
private long lastWindowCloseTime = 0;
|
||||
|
||||
@Setter
|
||||
private long lastInteractedVillagerEid;
|
||||
|
||||
@Setter
|
||||
private Int2ObjectMap<Recipe> craftingRecipes;
|
||||
private final Set<String> unlockedRecipes;
|
||||
|
@ -40,7 +40,6 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
|
||||
@Override
|
||||
public void translate(ContainerClosePacket packet, GeyserSession session) {
|
||||
session.addInventoryTask(() -> {
|
||||
session.setLastWindowCloseTime(0);
|
||||
byte windowId = packet.getId();
|
||||
|
||||
//Client wants close confirmation
|
||||
|
@ -327,10 +327,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||
session.sendDownstreamPacket(interactAtPacket);
|
||||
|
||||
EntitySoundInteractionHandler.handleEntityInteraction(session, vector, entity);
|
||||
|
||||
if (entity instanceof AbstractMerchantEntity) {
|
||||
session.setLastInteractedVillagerEid(packet.getRuntimeEntityId());
|
||||
}
|
||||
break;
|
||||
case 1: //Attack
|
||||
if (entity.getEntityType() == EntityType.ENDER_DRAGON) {
|
||||
|
@ -77,7 +77,8 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
||||
updateTradePacket.setPlayerUniqueEntityId(session.getPlayerEntity().getGeyserId());
|
||||
updateTradePacket.setTraderUniqueEntityId(villager.getGeyserId());
|
||||
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++) {
|
||||
VillagerTrade trade = packet.getTrades()[i];
|
||||
NbtMapBuilder recipe = NbtMap.builder();
|
||||
@ -101,7 +102,7 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
||||
}
|
||||
|
||||
//Hidden trade to fix visual experience bug
|
||||
if (packet.isRegularVillager() && packet.getVillagerLevel() < 5) {
|
||||
if (addExtraTrade) {
|
||||
tags.add(NbtMap.builder()
|
||||
.putInt("maxUses", 0)
|
||||
.putInt("traderExp", 0)
|
||||
@ -117,7 +118,7 @@ public class JavaTradeListTranslator extends PacketTranslator<ServerTradeListPac
|
||||
}
|
||||
|
||||
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("1", 10).build());
|
||||
expTags.add(NbtMap.builder().putInt("2", 70).build());
|
||||
|
@ -79,6 +79,9 @@ public class InventoryUtils {
|
||||
if (openInv != null && openInv.getId() == inventory.getId()) {
|
||||
translator.openInventory(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);
|
||||
} else {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren