Skip to content

Commit

Permalink
46 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaMode committed Feb 29, 2024
1 parent aae48f0 commit 38581b3
Show file tree
Hide file tree
Showing 41 changed files with 133 additions and 141 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ dependencies {
exclude(group: "net.fabricmc.fabric-api")
}

modCompileOnly("curse.maven:diet-443570:4813902")

// Sodium
// modImplementation "maven.modrinth:sodium:mc1.20.1-0.5.2"
// modImplementation("maven.modrinth:indium:1.0.25+mc1.20.1")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ loader_version=0.14.21
parchment_version=2023.03.12

# Build Dependencies
mantle_version=1.9.264
mantle_version=1.9.267
mantle_range=[1.9.264,)
milk_lib_version=1.2.58
dripstone_fluid_lib_version=3.0.1
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/slimeknights/tconstruct/TConstruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
Expand Down Expand Up @@ -123,7 +124,7 @@ public void onInitialize() {
// if (modList.isLoaded("jsonthings")) {
// JsonThingsPlugin.onConstruct();
// }
if (modList.isLoaded("diet")) {
if (FabricLoader.getInstance().isModLoaded("diet")) {
DietPlugin.onConstruct();
}

Expand Down
20 changes: 9 additions & 11 deletions src/main/java/slimeknights/tconstruct/common/config/Config.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package slimeknights.tconstruct.common.config;

import com.google.common.collect.ImmutableList;
import io.github.fabricators_of_create.porting_lib.config.ConfigRegistry;
import io.github.fabricators_of_create.porting_lib.config.ConfigType;
import io.github.fabricators_of_create.porting_lib.config.ModConfigSpec;
import io.github.fabricators_of_create.porting_lib.config.ModConfigSpec.BooleanValue;
import io.github.fabricators_of_create.porting_lib.config.ModConfigSpec.ConfigValue;
import io.github.fabricators_of_create.porting_lib.config.ModConfigSpec.DoubleValue;
import io.github.fabricators_of_create.porting_lib.config.ModConfigSpec.EnumValue;
import io.github.fabricators_of_create.porting_lib.config.ModConfigSpec.IntValue;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
import net.minecraftforge.common.ForgeConfigSpec.DoubleValue;
import net.minecraftforge.common.ForgeConfigSpec.EnumValue;
import net.minecraftforge.common.ForgeConfigSpec.IntValue;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.commons.lang3.tuple.Pair;
import slimeknights.tconstruct.TConstruct;
import slimeknights.tconstruct.library.recipe.melting.IMeltingContainer.IOreRate;
Expand Down Expand Up @@ -281,7 +279,7 @@ public enum LogInvalidToolStack { STACKTRACE, WARNING, IGNORED };
* Client specific configuration - only loaded clientside from tconstruct-client.toml
*/
public static class Client {
//public final ForgeConfigSpec.BooleanValue temperatureInCelsius;
// public final ModConfigSpec.BooleanValue temperatureInCelsius;
public final ModConfigSpec.BooleanValue tankFluidModel;
public final ModConfigSpec.BooleanValue extraToolTips; // TODO: do we even need this config option? who would turn it off?
public final ModConfigSpec.BooleanValue logMissingMaterialTextures;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import com.google.common.collect.Lists;
import com.google.gson.annotations.SerializedName;
import io.github.fabricators_of_create.porting_lib.util.ForgeI18n;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.ForgeI18n;
import slimeknights.mantle.client.book.data.BookData;
import slimeknights.mantle.client.book.data.content.PageContent;
import slimeknights.mantle.client.book.data.element.ImageData;
Expand Down Expand Up @@ -109,7 +110,7 @@ public TagKey<Item> getToolFilterTag() {
return null;
}
if (this.toolFilterTag == null) {
this.toolFilterTag = TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(toolFilter));
this.toolFilterTag = TagKey.create(Registries.ITEM, new ResourceLocation(toolFilter));
}
return this.toolFilterTag;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
import slimeknights.tconstruct.library.materials.stats.MaterialStatsId;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

/** Generates the file that tells the part generator command which parts are needed for your tools */
public class GeneratorPartTextureJsonGenerator extends GenericDataProvider {
Expand All @@ -39,10 +42,10 @@ public class GeneratorPartTextureJsonGenerator extends GenericDataProvider {
private final StatOverride overrides;

public GeneratorPartTextureJsonGenerator(FabricDataOutput output, String modId, AbstractPartSpriteProvider spriteProvider) {
this(generator, modId, spriteProvider, StatOverride.EMPTY);
this(output, modId, spriteProvider, StatOverride.EMPTY);
}

public GeneratorPartTextureJsonGenerator(DataGenerator generator, String modId, AbstractPartSpriteProvider spriteProvider, StatOverride overrides) {
public GeneratorPartTextureJsonGenerator(FabricDataOutput output, String modId, AbstractPartSpriteProvider spriteProvider, StatOverride overrides) {
super(output, PackType.CLIENT_RESOURCES, "tinkering", GSON);
this.modId = modId;
this.spriteProvider = spriteProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public class MaterialPartTextureGenerator extends GenericTextureGenerator {
private final StatOverride overrides;

public MaterialPartTextureGenerator(FabricDataOutput output, ExistingFileHelper existingFileHelper, AbstractPartSpriteProvider spriteProvider, AbstractMaterialSpriteProvider... materialProviders) {
this(generator, existingFileHelper, spriteProvider, StatOverride.EMPTY, materialProviders);
this(output, existingFileHelper, spriteProvider, StatOverride.EMPTY, materialProviders);
}

public MaterialPartTextureGenerator(DataGenerator generator, ExistingFileHelper existingFileHelper, AbstractPartSpriteProvider spriteProvider, StatOverride overrides, AbstractMaterialSpriteProvider... materialProviders) {
public MaterialPartTextureGenerator(FabricDataOutput output, ExistingFileHelper existingFileHelper, AbstractPartSpriteProvider spriteProvider, StatOverride overrides, AbstractMaterialSpriteProvider... materialProviders) {
super(output, FOLDER);
this.spriteReader = new DataGenSpriteReader(existingFileHelper, FOLDER);
this.existingFileHelper = existingFileHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import net.minecraft.core.Registry;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.data.GenericLoaderRegistry.IHaveLoader;
import slimeknights.mantle.util.JsonHelper;
Expand All @@ -21,13 +20,13 @@
* @param <R> Registry type
* @param <T> Loader object type
*/
public record RegistrySetLoader<R extends IForgeRegistryEntry<R>, T extends IHaveLoader<?>>(IForgeRegistry<R> registry, Function<Set<R>, T> constructor, Function<T, Set<R>> getter, String name) implements IGenericLoader<T> {
public record RegistrySetLoader<R, T extends IHaveLoader<?>>(Registry<R> registry, Function<Set<R>, T> constructor, Function<T, Set<R>> getter, String name) implements IGenericLoader<T> {
@Override
public T deserialize(JsonObject json) {
Set<R> set = ImmutableSet.copyOf(JsonHelper.parseList(json, name, (element, jsonKey) -> {
ResourceLocation objectKey = JsonHelper.convertToResourceLocation(element, jsonKey);
if (registry.containsKey(objectKey)) {
return registry.getValue(objectKey);
return registry.get(objectKey);
}
throw new JsonSyntaxException("Unknown " + name + " '" + objectKey + "'");
}));
Expand All @@ -38,7 +37,7 @@ public T deserialize(JsonObject json) {
public void serialize(T object, JsonObject json) {
JsonArray array = new JsonArray();
for (R entry : getter.apply(object)) {
array.add(Objects.requireNonNull(entry.getRegistryName()).toString());
array.add(Objects.requireNonNull(registry.getKey(entry)).toString());
}
json.add(name, array);
}
Expand All @@ -48,7 +47,7 @@ public T fromNetwork(FriendlyByteBuf buffer) {
ImmutableSet.Builder<R> builder = ImmutableSet.builder();
int max = buffer.readVarInt();
for (int i = 0; i < max; i++) {
builder.add(buffer.readRegistryIdUnsafe(registry));
builder.add(registry.byId(buffer.readVarInt()));
}
return constructor.apply(builder.build());
}
Expand All @@ -58,7 +57,7 @@ public void toNetwork(T object, FriendlyByteBuf buffer) {
Set<R> set = getter.apply(object);
buffer.writeVarInt(set.size());
for (R entry : set) {
buffer.writeRegistryIdUnsafe(registry, entry);
buffer.writeVarInt(registry.getId(entry));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public record EntityLightVariable(LightLayer lightLayer) implements EntityVariab

@Override
public float getValue(LivingEntity entity) {
return entity.level.getBrightness(lightLayer, entity.blockPosition());
return entity.level().getBrightness(lightLayer, entity.blockPosition());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.util.GsonHelper;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.LightLayer;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import io.github.fabricators_of_create.porting_lib.entity.events.PlayerEvents.BreakSpeed;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.util.JsonHelper;
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import io.github.fabricators_of_create.porting_lib.entity.events.PlayerEvents.BreakSpeed;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.tconstruct.library.json.variable.NestedFallbackLoader;
import slimeknights.tconstruct.library.json.variable.NestedFallbackLoader.NestedFallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import io.github.fabricators_of_create.porting_lib.entity.events.PlayerEvents.BreakSpeed;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.tconstruct.library.json.variable.NestedFallbackLoader;
import slimeknights.tconstruct.library.json.variable.NestedFallbackLoader.NestedFallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import io.github.fabricators_of_create.porting_lib.entity.events.PlayerEvents.BreakSpeed;
import slimeknights.mantle.data.GenericLoaderRegistry;
import slimeknights.tconstruct.library.json.math.ModifierFormula;
import slimeknights.tconstruct.library.json.variable.VariableFormula;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import io.github.fabricators_of_create.porting_lib.entity.events.PlayerEvents.BreakSpeed;
import slimeknights.mantle.data.GenericLoaderRegistry;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.data.GenericLoaderRegistry.IHaveLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import io.github.fabricators_of_create.porting_lib.entity.events.PlayerEvents.BreakSpeed;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.data.loader.NestedLoader;
import slimeknights.tconstruct.library.json.variable.tool.ToolVariable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import slimeknights.tconstruct.library.utils.IdParser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package slimeknights.tconstruct.library.modifiers.hook.combat;

import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.EntityDamageSource;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraftforge.common.util.LazyOptional;
import slimeknights.tconstruct.library.modifiers.ModifierEntry;
import slimeknights.tconstruct.library.tools.capability.TinkerDataCapability;
import slimeknights.tconstruct.library.tools.capability.TinkerDataKeys;
import slimeknights.tconstruct.library.tools.context.EquipmentContext;
import slimeknights.tconstruct.library.tools.nbt.IToolStackView;

import java.util.Collection;
import java.util.Optional;

/**
* Hook for increasing or decreasing protection from a given damage source.
Expand All @@ -35,8 +35,8 @@ public interface ProtectionModifierHook {
float getProtectionModifier(IToolStackView tool, ModifierEntry modifier, EquipmentContext context, EquipmentSlot slotType, DamageSource source, float modifierValue);

/** Gets the maximum protection amount on the given entity */
static float getProtectionCap(LazyOptional<TinkerDataCapability.Holder> capability) {
return Math.min(20 + capability.resolve().map(data -> data.get(TinkerDataKeys.PROTECTION_CAP)).orElse(0f), 25 * 0.95f);
static float getProtectionCap(Optional<TinkerDataCapability.Holder> capability) {
return Math.min(20 + capability.map(data -> data.get(TinkerDataKeys.PROTECTION_CAP)).orElse(0f), 25 * 0.95f);
}

/** Merger that combines all values */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraftforge.registries.ForgeRegistries;
import slimeknights.mantle.client.TooltipKey;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.data.predicate.IJsonPredicate;
Expand Down Expand Up @@ -78,13 +76,13 @@ public float getProtectionModifier(IToolStackView tool, ModifierEntry modifier,
public static void addResistanceTooltip(IToolStackView tool, Modifier modifier, float amount, @Nullable Player player, List<Component> tooltip) {
float cap;
if (player != null) {
cap = ProtectionModifierHook.getProtectionCap(player.getCapability(TinkerDataCapability.CAPABILITY));
cap = ProtectionModifierHook.getProtectionCap(TinkerDataCapability.CAPABILITY.maybeGet(player));
} else {
cap = Math.min(20f + tool.getModifierLevel(TinkerModifiers.boundless.getId()) * 2.5f, 20 * 0.95f);
}
tooltip.add(modifier.applyStyle(
new TextComponent(Util.PERCENT_BOOST_FORMAT.format(Math.min(amount, cap) / 25f))
.append(" ").append(new TranslatableComponent(modifier.getTranslationKey() + ".resistance"))));
Component.literal(Util.PERCENT_BOOST_FORMAT.format(Math.min(amount, cap) / 25f))
.append(" ").append(Component.translatable(modifier.getTranslationKey() + ".resistance"))));
}

@Override
Expand All @@ -104,7 +102,7 @@ public IGenericLoader<? extends ModifierModule> getLoader() {
public ProtectionModule deserialize(JsonObject json) {
Enchantment enchantment = null;
if (json.has("subtract_enchantment")) {
enchantment = JsonHelper.getAsEntry(ForgeRegistries.ENCHANTMENTS, json, "subtract_enchantment");
enchantment = JsonHelper.getAsEntry(BuiltInRegistries.ENCHANTMENT, json, "subtract_enchantment");
}
return new ProtectionModule(
DamageSourcePredicate.LOADER.getAndDeserialize(json, "damage_source"),
Expand All @@ -119,15 +117,15 @@ public void serialize(ProtectionModule object, JsonObject json) {
json.add("wearing_entity", LivingEntityPredicate.LOADER.serialize(object.entity));
object.amount.serialize(json);
if (object.subtract != null) {
json.addProperty("subtract_enchantment", Objects.requireNonNull(object.subtract.getRegistryName()).toString());
json.addProperty("subtract_enchantment", Objects.requireNonNull(BuiltInRegistries.ENCHANTMENT.getKey(object.subtract)).toString());
}
}

@Override
public ProtectionModule fromNetwork(FriendlyByteBuf buffer) {
Enchantment enchantment = null;
if (buffer.readBoolean()) {
enchantment = buffer.readRegistryIdUnsafe(ForgeRegistries.ENCHANTMENTS);
enchantment = BuiltInRegistries.ENCHANTMENT.byId(buffer.readVarInt());
}
return new ProtectionModule(
DamageSourcePredicate.LOADER.fromNetwork(buffer), LivingEntityPredicate.LOADER.fromNetwork(buffer),
Expand All @@ -138,7 +136,7 @@ public ProtectionModule fromNetwork(FriendlyByteBuf buffer) {
public void toNetwork(ProtectionModule object, FriendlyByteBuf buffer) {
if (object.subtract != null) {
buffer.writeBoolean(true);
buffer.writeRegistryIdUnsafe(ForgeRegistries.ENCHANTMENTS, object.subtract);
buffer.writeVarInt(BuiltInRegistries.ENCHANTMENT.getId(object.subtract));
} else {
buffer.writeBoolean(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.event.ForgeEventFactory;
import slimeknights.mantle.data.GenericLoaderRegistry.IGenericLoader;
import slimeknights.mantle.data.predicate.IJsonPredicate;
import slimeknights.mantle.data.predicate.block.BlockPredicate;
Expand Down
Loading

0 comments on commit 38581b3

Please sign in to comment.