use of it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap in project Arclight by IzzelAliz.
the class RecipeManagerMixin method apply.
// @formatter:on
/**
* @author IzzelAluz
* @reason
*/
@Overwrite
@SuppressWarnings("unchecked")
protected void apply(Map<ResourceLocation, JsonObject> splashList, IResourceManager resourceManagerIn, IProfiler profilerIn) {
this.someRecipesErrored = false;
Map<IRecipeType<?>, Object2ObjectLinkedOpenHashMap<ResourceLocation, IRecipe<?>>> map = Maps.newHashMap();
for (IRecipeType<?> type : Registry.RECIPE_TYPE) {
map.put(type, new Object2ObjectLinkedOpenHashMap<>());
}
for (Map.Entry<ResourceLocation, JsonObject> entry : splashList.entrySet()) {
ResourceLocation resourcelocation = entry.getKey();
if (resourcelocation.getPath().startsWith("_"))
// Forge: filter anything beginning with "_" as it's used for metadata.
continue;
try {
if (!CraftingHelper.processConditions(entry.getValue(), "conditions")) {
LOGGER.info("Skipping loading recipe {} as it's conditions were not met", resourcelocation);
continue;
}
IRecipe<?> irecipe = deserializeRecipe(resourcelocation, entry.getValue());
if (irecipe == null) {
LOGGER.info("Skipping loading recipe {} as it's serializer returned null", resourcelocation);
continue;
}
map.computeIfAbsent(irecipe.getType(), (p_223391_0_) -> new Object2ObjectLinkedOpenHashMap<>()).putAndMoveToFirst(resourcelocation, irecipe);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
LOGGER.error("Parsing error loading recipe {}", resourcelocation, jsonparseexception);
}
}
this.recipes = (Map) map;
LOGGER.info("Loaded {} recipes", (int) map.size());
}
use of it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap in project Rikaishi-Nikui by zhuaidadaya.
the class MinecraftVersionInformation method getVmOptions.
public Object2ObjectLinkedOpenHashMap<String, VmOption> getVmOptions(String search) {
String filter = search.toLowerCase();
Object2ObjectLinkedOpenHashMap<String, VmOption> options = new Object2ObjectLinkedOpenHashMap<>();
for (VmOption option : vmOptions.values()) {
if (option.getDetail().equals("")) {
continue;
}
if (option.getDetail().toLowerCase().contains(filter) || textFormatter.getText(option.getDescription()).contains(filter) || (textFormatter.getText("vm.options.information.enable").contains(filter) & option.isEnable())) {
options.put(option.getId(), option);
}
}
return options;
}
use of it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelperImpl method removeRecipe.
@Override
public void removeRecipe(NamespacedKey key) {
ResourceLocation nmsKey = CraftNamespacedKey.toMinecraft(key);
RecipeManager recipeManager = ((CraftServer) Bukkit.getServer()).getServer().getRecipeManager();
try {
Map<ResourceLocation, net.minecraft.world.item.crafting.Recipe<?>> byName = (Map) RECIPE_MANAGER_BY_NAME.get(recipeManager);
byName.remove(nmsKey);
} catch (Throwable ex) {
Debug.echoError(ex);
}
for (Object2ObjectLinkedOpenHashMap<ResourceLocation, net.minecraft.world.item.crafting.Recipe<?>> recipeMap : recipeManager.recipes.values()) {
recipeMap.remove(nmsKey);
}
}
use of it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap in project Denizen by DenizenScript.
the class ItemHelperImpl method removeRecipe.
@Override
public void removeRecipe(NamespacedKey key) {
ResourceLocation nmsKey = CraftNamespacedKey.toMinecraft(key);
RecipeManager recipeManager = ((CraftServer) Bukkit.getServer()).getServer().getRecipeManager();
try {
Map<ResourceLocation, net.minecraft.world.item.crafting.Recipe<?>> byName = (Map) RECIPE_MANAGER_BY_NAME.get(recipeManager);
byName.remove(nmsKey);
} catch (Throwable ex) {
Debug.echoError(ex);
}
for (Object2ObjectLinkedOpenHashMap<ResourceLocation, net.minecraft.world.item.crafting.Recipe<?>> recipeMap : recipeManager.recipes.values()) {
recipeMap.remove(nmsKey);
}
}
use of it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap in project polymer-core by teampolymer.
the class GhostBlockUtils method initBuffers.
private static IRenderTypeBuffer.Impl initBuffers(IRenderTypeBuffer.Impl original, Supplier<Float> alphaSupplier) {
BufferBuilder fallback = ObfuscationReflectionHelper.getPrivateValue(IRenderTypeBuffer.Impl.class, original, "builder");
Map<RenderType, BufferBuilder> layerBuffers = ObfuscationReflectionHelper.getPrivateValue(IRenderTypeBuffer.Impl.class, original, "fixedBuffers");
Map<RenderType, BufferBuilder> remapped = new Object2ObjectLinkedOpenHashMap<>();
Map<RenderType, RenderType> remappedTypes = new IdentityHashMap<>();
for (Map.Entry<RenderType, BufferBuilder> e : layerBuffers.entrySet()) {
remapped.put(GhostRenderType.remap(remappedTypes, e.getKey(), alphaSupplier), e.getValue());
}
return new GhostBuffers(fallback, remapped, remappedTypes, alphaSupplier);
}
Aggregations