Skip to content

Commit

Permalink
update some more yarn names to 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew6rant committed Sep 16, 2021
1 parent 6f79142 commit c6388b5
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ repositories {
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompileOnly "net.fabricmc:fabric-loader:${project.loader_version}"
modCompileOnly "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modCompileOnly "io.github.prospector:modmenu:${project.mod_menu_version}"

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 4 additions & 2 deletions out/production/tiered.main/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"name": "Tiered",
"description": "Adds tiers to tools.",
"authors": [
"Andrew6rant (Andrew Grant)",
"Draylar"
],
"contact": {
Expand All @@ -26,8 +27,9 @@
"tiered.mixins.json"
],
"depends": {
"fabricloader": ">=0.8.2+build.194",
"fabricloader": ">=0.11.3",
"fabric": "*",
"minecraft": ">=1.16"
"minecraft": ">=1.17",
"java": ">=16"
}
}
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/draylar/tiered/Tiered.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.resource.ResourceReloader;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
Expand All @@ -28,7 +29,7 @@ public class Tiered implements ModInitializer {
* Attribute Data Loader instance which handles loading attribute .json files from "data/modid/item_attributes".
* <p> This field is registered to the server's data manager in {@link ServerResourceManagerMixin}
*/
public static final AttributeDataLoader ATTRIBUTE_DATA_LOADER = new AttributeDataLoader();
public static final ResourceReloader ATTRIBUTE_DATA_LOADER = new AttributeDataLoader();

public static final UUID[] MODIFIERS = new UUID[] {
UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"),
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/draylar/tiered/mixin/ItemStackClientMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
@Mixin(ItemStack.class)
public abstract class ItemStackClientMixin {

@Shadow public abstract NbtCompound getOrCreateSubTag(String key);
@Shadow public abstract NbtCompound getOrCreateSubNbt(String key);

@Shadow public abstract boolean hasTag();
@Shadow public abstract boolean hasNbt();

@Shadow public abstract NbtCompound getSubTag(String key);
@Shadow public abstract NbtCompound getSubNbt(String key);

private boolean isTiered = false;

Expand All @@ -49,8 +49,8 @@ private void storeAttributeModifier(PlayerEntity player, TooltipContext context,

@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/text/TranslatableText;formatted(Lnet/minecraft/util/Formatting;)Lnet/minecraft/text/MutableText;", ordinal = 2), method = "getTooltip")
private MutableText getFormatting(TranslatableText translatableText, Formatting formatting) {
if(this.hasTag() && this.getSubTag(Tiered.NBT_SUBTAG_KEY) != null && isTiered) {
Identifier tier = new Identifier(this.getOrCreateSubTag(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));
if(this.hasNbt() && this.getSubNbt(Tiered.NBT_SUBTAG_KEY) != null && isTiered) {
Identifier tier = new Identifier(this.getOrCreateSubNbt(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));
PotentialAttribute attribute = Tiered.ATTRIBUTE_DATA_LOADER.getItemAttributes().get(tier);

return translatableText.setStyle(attribute.getStyle());
Expand Down Expand Up @@ -86,8 +86,8 @@ private Multimap<EntityAttribute, EntityAttributeModifier> sort(Multimap<EntityA
cancellable = true
)
private void modifyName(CallbackInfoReturnable<Text> cir) {
if(this.hasTag() && this.getSubTag("display") == null && this.getSubTag(Tiered.NBT_SUBTAG_KEY) != null) {
Identifier tier = new Identifier(getOrCreateSubTag(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));
if(this.hasNbt() && this.getSubNbt("display") == null && this.getSubNbt(Tiered.NBT_SUBTAG_KEY) != null) {
Identifier tier = new Identifier(getOrCreateSubNbt(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));

// attempt to display attribute if it is valid
PotentialAttribute potentialAttribute = Tiered.ATTRIBUTE_DATA_LOADER.getItemAttributes().get(tier);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/draylar/tiered/mixin/ItemStackMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
@Mixin(ItemStack.class)
public abstract class ItemStackMixin {

@Shadow public abstract NbtCompound getOrCreateSubTag(String key);
@Shadow public abstract NbtCompound getOrCreateSubNbt(String key);

@Shadow public abstract NbtCompound getTag();
@Shadow public abstract NbtCompound getNbt();

@Shadow public abstract boolean hasTag();
@Shadow public abstract boolean hasNbt();

@Shadow public abstract NbtCompound getSubTag(String key);
@Shadow public abstract NbtCompound getSubNbt(String key);

@Redirect(
method = "getAttributeModifiers",
Expand All @@ -40,10 +40,10 @@ private Multimap<EntityAttribute, EntityAttributeModifier> go(Item item, Equipme
Multimap<EntityAttribute, EntityAttributeModifier> newMap = LinkedListMultimap.create();
newMap.putAll(mods);

if(getSubTag(Tiered.NBT_SUBTAG_KEY) != null) {
Identifier tier = new Identifier(getOrCreateSubTag(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));
if(getSubNbt(Tiered.NBT_SUBTAG_KEY) != null) {
Identifier tier = new Identifier(getOrCreateSubNbt(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));

if(!hasTag() || !getTag().contains("AttributeModifiers", 9)) {
if(!hasNbt() || !getNbt().contains("AttributeModifiers", 9)) {
PotentialAttribute potentialAttribute = Tiered.ATTRIBUTE_DATA_LOADER.getItemAttributes().get(tier);

if(potentialAttribute != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/draylar/tiered/mixin/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public LivingEntityMixin(EntityType<?> type, World world) {
* such as bonus health are reset. This is annoying with health boosting armor.
*/
@Redirect(
method = "readCustomDataFromTag",
method = "readCustomDataFromNbt",
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;setHealth(F)V"))
private void trustOverflowHealth(LivingEntity livingEntity, float health) {
this.dataTracker.set(HEALTH, health);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.resource.ReloadableResourceManager;
import net.minecraft.resource.ServerResourceManager;
import net.minecraft.server.command.CommandManager;
import net.minecraft.util.registry.DynamicRegistryManager;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -17,7 +18,7 @@ public class ServerResourceManagerMixin {
@Shadow @Final private ReloadableResourceManager resourceManager;

@Inject(at = @At("RETURN"), method = "<init>")
private void onInit(CommandManager.RegistrationEnvironment registrationEnvironment, int i, CallbackInfo ci) {
private void onInit(DynamicRegistryManager registryManager, CommandManager.RegistrationEnvironment commandEnvironment, int functionPermissionLevel, CallbackInfo ci) {
this.resourceManager.registerReloader(Tiered.ATTRIBUTE_DATA_LOADER);
}
}
6 changes: 4 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"name": "Tiered",
"description": "Adds tiers to tools.",
"authors": [
"Andrew6rant (Andrew Grant)",
"Draylar"
],
"contact": {
Expand All @@ -26,8 +27,9 @@
"tiered.mixins.json"
],
"depends": {
"fabricloader": ">=0.8.2+build.194",
"fabricloader": ">=0.11.3",
"fabric": "*",
"minecraft": ">=1.16"
"minecraft": ">=1.17",
"java": ">=16"
}
}

0 comments on commit c6388b5

Please sign in to comment.