Skip to content

Commit

Permalink
perf: reorder recipe biome checks (The-Aether-Team#1959)
Browse files Browse the repository at this point in the history
  • Loading branch information
bconlon1 authored Jan 9, 2024
1 parent 7cbdbdb commit f341c4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public AbstractPlacementBanRecipe(RecipeType<?> type, ResourceLocation id, @Null
public boolean matches(Level level, BlockPos pos, T object) {
if (this.bypassBlock.isEmpty() || !this.bypassBlock.test(level.getBlockState(pos))) {
if (this.biomeKey != null) {
return level.getBiome(pos).is(this.biomeKey) && this.getIngredient().test(object);
return this.getIngredient().test(object) && level.getBiome(pos).is(this.biomeKey);
} else if (this.biomeTag != null) {
return level.getBiome(pos).is(this.biomeTag) && this.getIngredient().test(object);
return this.getIngredient().test(object) && level.getBiome(pos).is(this.biomeTag);
} else {
return this.getIngredient().test(object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public AbstractBiomeParameterRecipe(RecipeType<?> type, ResourceLocation id, @Nu
@Override
public boolean matches(Level level, BlockPos pos, BlockState state) {
if (this.biomeKey != null) {
return level.getBiome(pos).is(this.biomeKey) && super.matches(level, pos, state);
return super.matches(level, pos, state) && level.getBiome(pos).is(this.biomeKey);
} else if (this.biomeTag != null) {
return level.getBiome(pos).is(this.biomeTag) && super.matches(level, pos, state);
return super.matches(level, pos, state) && level.getBiome(pos).is(this.biomeTag);
} else {
return super.matches(level, pos, state);
}
Expand Down

0 comments on commit f341c4e

Please sign in to comment.