13
0
geforkt von Mirrors/Paper

SPIGOT-7853: AnvilInventory#getRepairCost() always returns 0

By: Miles Holder <mwholder2005@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-07-30 07:11:55 +10:00
Ursprung 9a7508c3ab
Commit 3fb8f4b1d1

Datei anzeigen

@ -16,16 +16,16 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
private final Location location; private final Location location;
private String renameText; private String renameText;
private int costAmount; private int repairCost;
private int repairAmount; private int repairCostAmount;
private int maximumRepairCost; private int maximumRepairCost;
public CraftInventoryAnvil(Location location, IInventory inventory, IInventory resultInventory) { public CraftInventoryAnvil(Location location, IInventory inventory, IInventory resultInventory) {
super(inventory, resultInventory); super(inventory, resultInventory);
this.location = location; this.location = location;
this.renameText = null; this.renameText = null;
this.costAmount = DEFAULT_REPAIR_COST_AMOUNT; this.repairCost = DEFAULT_REPAIR_COST;
this.repairAmount = DEFAULT_REPAIR_COST; this.repairCostAmount = DEFAULT_REPAIR_COST_AMOUNT;
this.maximumRepairCost = DEFAULT_MAXIMUM_REPAIR_COST; this.maximumRepairCost = DEFAULT_MAXIMUM_REPAIR_COST;
} }
@ -42,25 +42,25 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
@Override @Override
public int getRepairCostAmount() { public int getRepairCostAmount() {
syncWithArbitraryViewValue((cav) -> this.costAmount = cav.getRepairItemCountCost()); syncWithArbitraryViewValue((cav) -> this.repairCostAmount = cav.getRepairItemCountCost());
return this.repairAmount; return this.repairCostAmount;
} }
@Override @Override
public void setRepairCostAmount(int amount) { public void setRepairCostAmount(int amount) {
this.repairAmount = amount; this.repairCostAmount = amount;
syncViews((cav) -> cav.setRepairItemCountCost(amount)); syncViews((cav) -> cav.setRepairItemCountCost(amount));
} }
@Override @Override
public int getRepairCost() { public int getRepairCost() {
syncWithArbitraryViewValue((cav) -> this.repairAmount = cav.getRepairCost()); syncWithArbitraryViewValue((cav) -> this.repairCost = cav.getRepairCost());
return this.costAmount; return this.repairCost;
} }
@Override @Override
public void setRepairCost(int i) { public void setRepairCost(int i) {
this.costAmount = i; this.repairCost = i;
syncViews((cav) -> cav.setRepairCost(i)); syncViews((cav) -> cav.setRepairCost(i));
} }
@ -78,11 +78,11 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
} }
public boolean isRepairCostSet() { public boolean isRepairCostSet() {
return this.costAmount != DEFAULT_REPAIR_COST; return this.repairCost != DEFAULT_REPAIR_COST;
} }
public boolean isRepairCostAmountSet() { public boolean isRepairCostAmountSet() {
return this.repairAmount != DEFAULT_REPAIR_COST_AMOUNT; return this.repairCostAmount != DEFAULT_REPAIR_COST_AMOUNT;
} }
public boolean isMaximumRepairCostSet() { public boolean isMaximumRepairCostSet() {