Skip to content

Commit

Permalink
fix unapplied mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed Jun 26, 2020
1 parent 62048f0 commit da176b0
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 24 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def yarnMappings = "1.16.1+build.9:v2"
def loaderVersion = "0.8.8+build.202"

archivesBaseName = "cotton"
version = "1.0.4"
version = "1.0.5"
group = "io.github.cottonmc.cotton"

sourceCompatibility = 1.8
Expand Down
2 changes: 1 addition & 1 deletion modules/cotton-commons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ext {
];
}

version = "1.0.0-rc.4";
version = "1.0.4";
apply from: "../module-base.gradle"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

public class CommonTags {
//auto-fillable tags for common decorative/functional blocks
public static final Tag<Item> GLASS_BLOCKS = registerItemTag("glass_blocks");
public static final Tag<Item> GLASS_PANES = registerItemTag("glass_panes");
public static final Tag<Item> TERRACOTTA = registerItemTag("terracotta");
public static final Tag<Item> PRESSURE_PLATES = registerItemTag("pressure_plates");
public static final Tag.Identified<Item> GLASS_BLOCKS = registerItemTag("glass_blocks");
public static final Tag.Identified<Item> GLASS_PANES = registerItemTag("glass_panes");
public static final Tag.Identified<Item> TERRACOTTA = registerItemTag("terracotta");
public static final Tag.Identified<Item> PRESSURE_PLATES = registerItemTag("pressure_plates");

//tags for common item categories
public static final Tag<Item> MUSHROOMS = registerItemTag("mushrooms");
public static final Tag<Item> RAW_MEAT = registerItemTag("raw_meat");
public static final Tag<Item> COOKED_MEAT = registerItemTag("cooked_meat");
public static final Tag<Item> PLANTABLES = registerItemTag("plantables");
public static final Tag.Identified<Item> MUSHROOMS = registerItemTag("mushrooms");
public static final Tag.Identified<Item> RAW_MEAT = registerItemTag("raw_meat");
public static final Tag.Identified<Item> COOKED_MEAT = registerItemTag("cooked_meat");
public static final Tag.Identified<Item> PLANTABLES = registerItemTag("plantables");

//taggs for cotton functions
public static final Tag<Block> CAULDRON_FIRE = TagRegistry.block(new Identifier(CottonCommons.MODID, "cauldron_fire"));
public static final Tag.Identified<Block> CAULDRON_FIRE = (Tag.Identified<Block>)TagRegistry.block(new Identifier(CottonCommons.MODID, "cauldron_fire"));

public static void init() {
if (CottonCommons.CONFIG.fillCommonTags) {
Expand Down Expand Up @@ -56,11 +56,11 @@ public static void init() {
}
}

private static Tag<Item> registerItemTag(String id) {
return TagRegistry.item(new Identifier(CottonDatapack.SHARED_NAMESPACE, id));
private static Tag.Identified<Item> registerItemTag(String id) {
return (Tag.Identified<Item>)TagRegistry.item(new Identifier(CottonDatapack.SHARED_NAMESPACE, id));
}

private static Tag<Block> registerBlockTag(String id) {
return TagRegistry.block(new Identifier(CottonDatapack.SHARED_NAMESPACE, id));
private static Tag.Identified<Block> registerBlockTag(String id) {
return (Tag.Identified<Block>)TagRegistry.block(new Identifier(CottonDatapack.SHARED_NAMESPACE, id));
}
}
2 changes: 1 addition & 1 deletion modules/cotton-datapack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ext {
];
}

version = "1.0.4";
version = "1.0.5";
apply from: "../module-base.gradle"

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.cottonmc.cotton.datapack.GlobalResourcePackProvider;
import io.github.cottonmc.cotton.datapack.virtual.VirtualResourcePackManager;
import net.minecraft.resource.DataPackSettings;
import net.minecraft.resource.ResourcePackManager;
import net.minecraft.resource.ResourcePackProfile;
import net.minecraft.resource.ResourceType;
Expand All @@ -13,19 +14,17 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.io.File;

@Mixin(MinecraftServer.class)
public class MixinDataPackLoad {

@Shadow
@Final
private ResourcePackManager<ResourcePackProfile> dataPackManager;

@Inject(method = "loadWorldDataPacks", at = @At(value = "HEAD"))
public void addGlobalDataPacks(File file, LevelProperties properties, CallbackInfo info) {
dataPackManager.registerProvider(new GlobalResourcePackProvider());
dataPackManager.registerProvider(VirtualResourcePackManager.INSTANCE.getCreatorForType(ResourceType.SERVER_DATA));
@Inject(method = "loadDataPacks", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;setEnabledProfiles(Ljava/util/Collection;)V"))
private static void addGlobalDataPacks(ResourcePackManager<ResourcePackProfile> resourcePackManager, DataPackSettings dataPackSettings, boolean safeMode, CallbackInfoReturnable<DataPackSettings> info) {
((ResourcePackManagerAccessor)resourcePackManager).getProviders().add(new GlobalResourcePackProvider());
((ResourcePackManagerAccessor)resourcePackManager).getProviders().add(VirtualResourcePackManager.INSTANCE.getCreatorForType(ResourceType.SERVER_DATA));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.cottonmc.cotton.datapack.mixins;

import net.minecraft.resource.ResourcePackManager;
import net.minecraft.resource.ResourcePackProvider;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Set;

@Mixin(ResourcePackManager.class)
public interface ResourcePackManagerAccessor {
@Accessor
Set<ResourcePackProvider> getProviders();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"refmap": "mixins.cotton-datapack.refmap.json",
"mixins": [
"MixinDataPackLoad",
"MixinRecipeManager"
"MixinRecipeManager",
"ResourcePackManagerAccessor"
],
"client": [
"MixinClientBuiltinResourcePackProvider"
Expand Down

0 comments on commit da176b0

Please sign in to comment.