Minor optimizations
This commit is contained in:
parent
b1b62db60c
commit
04774107b1
2 changed files with 5 additions and 5 deletions
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
|
||||
group = 'com.oitsjustjose.itemgator'
|
||||
version = "${mod_version}"
|
||||
base { archivesName = "NaturalProgression-${game_version}-${mod_version}" }
|
||||
base { archivesName = "ItemGator-${game_version}-${mod_version}" }
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
minecraft {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class ItemGator {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onOther(TickEvent.PlayerTickEvent event) {
|
||||
public void onTick(TickEvent.PlayerTickEvent event) {
|
||||
if (event.player.isCreative()) return;
|
||||
if (event.player.level().isClientSide()) return;
|
||||
|
||||
|
|
@ -42,15 +42,15 @@ public class ItemGator {
|
|||
if (stack.isEmpty()) continue;
|
||||
|
||||
// Check to see if we should be replacing this item with a substitute
|
||||
var shouldReplace = allRecipes.stream().filter(x -> x.matchesOriginal(stack) && x.appliesTo(event.player)).findFirst();
|
||||
var shouldReplace = allRecipes.parallelStream().filter(x -> x.matchesOriginal(stack) && x.appliesTo(event.player)).findFirst();
|
||||
if (shouldReplace.isPresent()) {
|
||||
var sub = shouldReplace.get().getSubstitute(stack);
|
||||
inventory.setItem(i, sub);
|
||||
continue;
|
||||
}
|
||||
|
||||
// See if this is a substitute and we should be replacing this item with its original because the player has the needed tag
|
||||
var shouldRevert = allRecipes.stream().filter(x -> x.matchesSubstitute(stack) && !x.appliesTo(event.player)).findFirst();
|
||||
// See if this is a substitute and if we should be replacing this item with its original because the player has the needed tag
|
||||
var shouldRevert = allRecipes.parallelStream().filter(x -> x.matchesSubstitute(stack) && !x.appliesTo(event.player)).findFirst();
|
||||
if (shouldRevert.isPresent()) {
|
||||
var orig = shouldRevert.get().getOriginal(stack);
|
||||
inventory.setItem(i, orig);
|
||||
|
|
|
|||
Loading…
Reference in a new issue