fix reloadable server resources
This commit is contained in:
parent
0858c7664f
commit
7eea96ec60
1 changed files with 18 additions and 15 deletions
|
@ -12,12 +12,13 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@Mixin(ReloadableServerResources.class)
|
@Mixin(ReloadableServerResources.class)
|
||||||
public class MixinReloadableServerResources {
|
public class MixinReloadableServerResources {
|
||||||
@Inject(method = "lambda$loadResources$0", at = @At("RETURN"))
|
@Inject(method = "loadResources", at = @At("RETURN"), cancellable = true)
|
||||||
private static void onLoadResources(ReloadableServerResources rsr, Object whoKnows,
|
private static void onLoadResources(CallbackInfoReturnable<CompletableFuture<ReloadableServerResources>> cir) {
|
||||||
CallbackInfoReturnable<ReloadableServerResources> cir) {
|
cir.setReturnValue(cir.getReturnValue().thenApply((rsr) -> {
|
||||||
var amethystTable = rsr.getLootTables().get(Blocks.AMETHYST_CLUSTER.getLootTable());
|
var amethystTable = rsr.getLootTables().get(Blocks.AMETHYST_CLUSTER.getLootTable());
|
||||||
var theCoolerAmethystTable = (AccessorLootTable) amethystTable;
|
var theCoolerAmethystTable = (AccessorLootTable) amethystTable;
|
||||||
var oldFuncs = theCoolerAmethystTable.hex$getFunctions();
|
var oldFuncs = theCoolerAmethystTable.hex$getFunctions();
|
||||||
|
@ -30,5 +31,7 @@ public class MixinReloadableServerResources {
|
||||||
} else {
|
} else {
|
||||||
HexAPI.LOGGER.warn("{} was not found?", HexLootHandler.FUNC_AMETHYST_SHARD_REDUCER);
|
HexAPI.LOGGER.warn("{} was not found?", HexLootHandler.FUNC_AMETHYST_SHARD_REDUCER);
|
||||||
}
|
}
|
||||||
|
return rsr;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue