Add ignore discounts API
This commit is contained in:
@@ -24,25 +24,25 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -216,7 +224,18 @@
|
||||
return this.assignProfessionWhenSpawned;
|
||||
}
|
||||
@@ -214,7 +222,18 @@
|
||||
|
||||
public boolean assignProfessionWhenSpawned() {
|
||||
return this.assignProfessionWhenSpawned;
|
||||
+ }
|
||||
+
|
||||
+ // Spigot Start
|
||||
@Override
|
||||
+ @Override
|
||||
+ public void inactiveTick() {
|
||||
+ // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
|
||||
+ if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
|
||||
+ this.customServerAiStep((ServerLevel) this.level());
|
||||
+ }
|
||||
+ super.inactiveTick();
|
||||
+ }
|
||||
}
|
||||
+ // Spigot End
|
||||
+
|
||||
+ @Override
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
@Override
|
||||
protected void customServerAiStep(ServerLevel world) {
|
||||
@@ -235,7 +254,7 @@
|
||||
this.increaseProfessionLevelOnUpdate = false;
|
||||
}
|
||||
@@ -82,7 +82,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +520,7 @@
|
||||
@@ -459,6 +490,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
|
||||
+ if (merchantrecipe.ignoreDiscounts) continue; // Paper - Add ignore discounts API
|
||||
|
||||
merchantrecipe.addToSpecialPriceDiff(-Mth.floor((float) i * merchantrecipe.getPriceMultiplier()));
|
||||
}
|
||||
@@ -471,6 +503,7 @@
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
MerchantOffer merchantrecipe1 = (MerchantOffer) iterator1.next();
|
||||
+ if (merchantrecipe1.ignoreDiscounts) continue; // Paper - Add ignore discounts API
|
||||
double d0 = 0.3D + 0.0625D * (double) j;
|
||||
int k = (int) Math.floor(d0 * (double) merchantrecipe1.getBaseCostA().getCount());
|
||||
|
||||
@@ -489,7 +522,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
@@ -91,7 +107,7 @@
|
||||
Logger logger = Villager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -512,7 +543,7 @@
|
||||
@@ -512,7 +545,7 @@
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
if (nbt.contains("VillagerData", 10)) {
|
||||
@@ -100,7 +116,7 @@
|
||||
Logger logger = Villager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -599,7 +630,7 @@
|
||||
@@ -599,7 +632,7 @@
|
||||
}
|
||||
|
||||
if (offer.shouldRewardExp()) {
|
||||
@@ -109,7 +125,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -618,7 +649,7 @@
|
||||
@@ -618,7 +651,7 @@
|
||||
|
||||
@Override
|
||||
public void die(DamageSource damageSource) {
|
||||
@@ -118,7 +134,7 @@
|
||||
Entity entity = damageSource.getEntity();
|
||||
|
||||
if (entity != null) {
|
||||
@@ -803,12 +834,19 @@
|
||||
@@ -803,12 +836,19 @@
|
||||
@Override
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
if (world.getDifficulty() != Difficulty.PEACEFUL) {
|
||||
@@ -140,7 +156,7 @@
|
||||
|
||||
if (entitywitch == null) {
|
||||
super.thunderHit(world, lightning);
|
||||
@@ -906,7 +944,7 @@
|
||||
@@ -906,7 +946,7 @@
|
||||
}).limit(5L).toList();
|
||||
|
||||
if (list1.size() >= requiredCount) {
|
||||
@@ -149,7 +165,7 @@
|
||||
list.forEach(GolemSensor::golemDetected);
|
||||
}
|
||||
}
|
||||
@@ -963,7 +1001,7 @@
|
||||
@@ -963,7 +1003,7 @@
|
||||
@Override
|
||||
public void startSleeping(BlockPos pos) {
|
||||
super.startSleeping(pos);
|
||||
@@ -158,7 +174,7 @@
|
||||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
@@ -971,7 +1009,7 @@
|
||||
@@ -971,7 +1011,7 @@
|
||||
@Override
|
||||
public void stopSleeping() {
|
||||
super.stopSleeping();
|
||||
|
||||
Reference in New Issue
Block a user