fix air scuff
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package baritone.api.utils;
|
package baritone.api.utils;
|
||||||
|
|
||||||
import net.minecraft.block.AirBlock;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
@@ -58,10 +57,7 @@ public class BlockUtils {
|
|||||||
if (resourceCache.containsKey(name)) {
|
if (resourceCache.containsKey(name)) {
|
||||||
return null; // cached as null
|
return null; // cached as null
|
||||||
}
|
}
|
||||||
block = Registry.BLOCK.getOrDefault(ResourceLocation.tryCreate(name.contains(":") ? name : "minecraft:" + name));
|
block = Registry.BLOCK.getValue(ResourceLocation.tryCreate(name.contains(":") ? name : "minecraft:" + name)).orElse(null);
|
||||||
if (block instanceof AirBlock && !name.equals("air")) {
|
|
||||||
block = null;
|
|
||||||
}
|
|
||||||
Map<String, Block> copy = new HashMap<>(resourceCache); // read only copy is safe, wont throw concurrentmodification
|
Map<String, Block> copy = new HashMap<>(resourceCache); // read only copy is safe, wont throw concurrentmodification
|
||||||
copy.put(name, block);
|
copy.put(name, block);
|
||||||
resourceCache = copy;
|
resourceCache = copy;
|
||||||
|
|||||||
Reference in New Issue
Block a user