maintenance of unused and old code

This commit is contained in:
Relentless 2023-04-01 00:31:46 +02:00
parent 79b9013d46
commit b2ce017fc0
No known key found for this signature in database
GPG key ID: 50C5FD225130D790
6 changed files with 8 additions and 43 deletions

View file

@ -24,10 +24,10 @@ public class StoneStrataHandler {
public static StoneStrataHandler create(List<String> stoneStrataIds, Set<UnifyTag<Item>> stoneStrataTags, TagMap tagMap) {
TagMap stoneStrataTagMap = tagMap.filtered(stoneStrataTags::contains, item -> true);
Pattern tagMatcher = switch (AlmostUnifiedPlatform.INSTANCE.getPlatform()) {
case FORGE -> Pattern.compile("forge:ores/.+");
case FABRIC -> Pattern.compile("(c:ores/.+|c:.+_ore)");
};
Pattern tagMatcher = Pattern.compile(switch (AlmostUnifiedPlatform.INSTANCE.getPlatform()) {
case FORGE -> "forge:ores/.+";
case FABRIC -> "(c:ores/.+|c:.+_ore)";
});
return new StoneStrataHandler(stoneStrataIds, tagMatcher, stoneStrataTagMap);
}

View file

@ -1,23 +0,0 @@
package com.almostreliable.unified.api.recipe;
import com.almostreliable.unified.utils.TagMap;
import com.almostreliable.unified.utils.UnifyTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import javax.annotation.Nullable;
import java.util.Collection;
public interface ReplacementFallbackStrategy {
/**
* Determine a fallback for the given item.
*
* @param tag the tag to replace the item with
* @param potentialItems the potential items to replace with
* @param tags the tag map to use for lookup
* @return the fallback item, or null if no fallback is available
* @throws IllegalStateException if returning the lookupItem
*/
@Nullable
ResourceLocation getFallback(UnifyTag<Item> tag, Collection<ResourceLocation> potentialItems, TagMap tags);
}

View file

@ -1,16 +1,11 @@
package com.almostreliable.unified.compat;
import com.almostreliable.unified.AlmostUnified;
import com.almostreliable.unified.AlmostUnifiedPlatform;
import com.almostreliable.unified.AlmostUnifiedRuntime;
import com.almostreliable.unified.api.StoneStrataHandler;
import com.almostreliable.unified.config.UnifyConfig;
import com.almostreliable.unified.utils.ReplacementMap;
import com.almostreliable.unified.utils.TagMap;
import com.almostreliable.unified.utils.UnifyTag;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import java.util.*;
@ -49,10 +44,4 @@ public class HideHelper {
return toHide.stream().flatMap(rl -> Registry.ITEM.getOptional(rl).stream()).map(ItemStack::new).toList();
}).flatMap(Collection::stream).toList();
}
private static StoneStrataHandler getStoneStrataHandler(UnifyConfig config) {
Set<UnifyTag<Item>> stoneStrataTags = AlmostUnifiedPlatform.INSTANCE.getStoneStrataTags(config.getStoneStrata());
TagMap stoneStrataTagMap = TagMap.create(stoneStrataTags);
return StoneStrataHandler.create(config.getStoneStrata(), stoneStrataTags, stoneStrataTagMap);
}
}

View file

@ -27,7 +27,7 @@ public class AlmostMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {}
@SuppressWarnings("ReturnOfNull")
@SuppressWarnings({ "ReturnOfNull", "DataFlowIssue" })
@Override
public String getRefMapperConfig() {
return null;
@ -41,7 +41,7 @@ public class AlmostMixinPlugin implements IMixinConfigPlugin {
@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
@SuppressWarnings("ReturnOfNull")
@SuppressWarnings({ "ReturnOfNull", "DataFlowIssue" })
@Override
public List<String> getMixins() {
return null;

View file

@ -18,7 +18,7 @@ import java.util.Map;
public class RecipeManagerMixin {
@Inject(method = "apply(Ljava/util/Map;Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)V", at = @At("HEAD"))
public void runTransformation(Map<ResourceLocation, JsonElement> recipes, ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfo ci) {
private void runTransformation(Map<ResourceLocation, JsonElement> recipes, ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfo ci) {
try {
AlmostUnified.reloadRuntime();
AlmostUnified.getRuntime().run(recipes, AlmostUnified.getStartupConfig().isServerOnly());

View file

@ -5,7 +5,6 @@ import com.almostreliable.unified.utils.FileUtils;
import net.minecraft.resources.ResourceLocation;
import org.apache.commons.lang3.StringUtils;
import java.nio.file.Path;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
@ -139,7 +138,7 @@ public class RecipeDumper {
getSortedUnifiedRecipes(type).forEach(recipe -> {
stringBuilder
.append("\t- ")
.append(recipe.getId().toString())
.append(recipe.getId())
.append("\n")
.append("\t\t Original: ")
.append(recipe.getOriginal().toString())