mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Fix and improve Ingredient invalidation (#8361)
This commit is contained in:
1 parent
15d3df2818
commit
57a916bf09
5 files changed
+125
-9
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -164,6 +164,7 @@ public class ForgeMod
|
||||
|
||||
MinecraftForge.EVENT_BUS.addListener(VillagerTradingManager::loadTrades);
|
||||
MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::mappingChanged);
|
||||
BiomeDictionary.init();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -74,9 +74,14 @@ public class CompoundIngredient extends Ingredient
|
||||
@Nonnull
|
||||
public IntList getStackingIds()
|
||||
{
|
||||
//TODO: Add a child.isInvalid()?
|
||||
if (this.itemIds == null)
|
||||
boolean childrenNeedInvalidation = false;
|
||||
for (Ingredient child : children)
|
||||
{
|
||||
childrenNeedInvalidation |= child.checkInvalidation();
|
||||
}
|
||||
if (childrenNeedInvalidation || this.itemIds == null || checkInvalidation())
|
||||
{
|
||||
this.markValid();
|
||||
this.itemIds = new IntArrayList();
|
||||
for (Ingredient child : children)
|
||||
this.itemIds.addAll(child.getStackingIds());
|
||||
@@ -100,7 +105,6 @@ public class CompoundIngredient extends Ingredient
|
||||
{
|
||||
this.itemIds = null;
|
||||
this.stacks = null;
|
||||
//Shouldn't need to invalidate children as this is only called form invalidateAll..
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user