fixed transmog mixin
This commit is contained in:
parent
2e70ead3a1
commit
597d6397b3
1 changed files with 26 additions and 29 deletions
|
@ -18,17 +18,19 @@
|
||||||
package tv.alterNERD.VaultModTweaks.integration.mixin;
|
package tv.alterNERD.VaultModTweaks.integration.mixin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import iskallia.vault.block.TransmogTableBlock;
|
import iskallia.vault.block.TransmogTableBlock;
|
||||||
import iskallia.vault.dynamodel.model.armor.ArmorPieceModel;
|
import iskallia.vault.dynamodel.model.armor.ArmorPieceModel;
|
||||||
import iskallia.vault.init.ModDynamicModels;
|
import iskallia.vault.init.ModDynamicModels.Armor;
|
||||||
|
import iskallia.vault.init.ModDynamicModels.Axes;
|
||||||
|
import iskallia.vault.init.ModDynamicModels.Swords;
|
||||||
|
import iskallia.vault.patreon.PatreonManager;
|
||||||
|
import iskallia.vault.patreon.PatreonPlayerData;
|
||||||
|
import iskallia.vault.patreon.PatreonTier;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import tv.alterNERD.VaultModTweaks.Configuration;
|
import tv.alterNERD.VaultModTweaks.Configuration;
|
||||||
import tv.alterNERD.VaultModTweaks.VaultModTweaks;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the {@link iskallia.vault.block.TransmogTableBlock} class for
|
* Changes the {@link iskallia.vault.block.TransmogTableBlock} class for
|
||||||
|
@ -38,12 +40,6 @@ import tv.alterNERD.VaultModTweaks.VaultModTweaks;
|
||||||
*/
|
*/
|
||||||
@Mixin(TransmogTableBlock.class)
|
@Mixin(TransmogTableBlock.class)
|
||||||
public abstract class MixinTransmogTableBlock {
|
public abstract class MixinTransmogTableBlock {
|
||||||
@Shadow(remap = false)
|
|
||||||
private static Set<Long> CHAMPION_LIST;
|
|
||||||
|
|
||||||
@Shadow(remap = false)
|
|
||||||
private static Set<Long> GOBLIN_LIST;
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Injects some new Goblin / Champion tier patrons into the transmogajigga
|
* Injects some new Goblin / Champion tier patrons into the transmogajigga
|
||||||
* thing.
|
* thing.
|
||||||
|
@ -56,25 +52,26 @@ public abstract class MixinTransmogTableBlock {
|
||||||
public static boolean canTransmogModel(Player player, Collection<ResourceLocation> discoveredModelIds, ResourceLocation modelId) {
|
public static boolean canTransmogModel(Player player, Collection<ResourceLocation> discoveredModelIds, ResourceLocation modelId) {
|
||||||
long id = player.getUUID().getMostSignificantBits() ^ player.getUUID().getLeastSignificantBits();
|
long id = player.getUUID().getMostSignificantBits() ^ player.getUUID().getLeastSignificantBits();
|
||||||
String name = player.getName().getString();
|
String name = player.getName().getString();
|
||||||
return ModDynamicModels.Armor.PIECE_REGISTRY.get(modelId).map(ArmorPieceModel::getArmorModel).map(armorModel -> {
|
|
||||||
VaultModTweaks.LOGGER.debug(player.getName().getString());
|
PatreonPlayerData data = PatreonManager.getInstance().getPlayerData(player.getUUID());
|
||||||
if (armorModel.equals(ModDynamicModels.Armor.CHAMPION)) {
|
return (Boolean)Armor.PIECE_REGISTRY.get(modelId).map(ArmorPieceModel::getArmorModel).map((armorModel) -> {
|
||||||
return CHAMPION_LIST.contains(id) || Configuration.CHAMPIONS.get().contains(name);
|
if (armorModel.equals(Armor.CHAMPION)) {
|
||||||
}
|
return data.isAtLeastTier(PatreonTier.CHAMPION) || Configuration.CHAMPIONS.get().contains(name);
|
||||||
if (armorModel.equals(ModDynamicModels.Armor.GOBLIN)) {
|
} else if (armorModel.equals(Armor.GOBLIN)) {
|
||||||
return GOBLIN_LIST.contains(id) || CHAMPION_LIST.contains(id) || Configuration.GOBLINS.get().contains(name) || Configuration.CHAMPIONS.get().contains(name);
|
return data.isAtLeastTier(PatreonTier.GOBLIN) || Configuration.GOBLINS.get().contains(name) || Configuration.CHAMPIONS.get().contains(name);
|
||||||
}
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}).or(() -> ModDynamicModels.Swords.REGISTRY.get(modelId).map(model -> {
|
|
||||||
if (model.equals(ModDynamicModels.Swords.GODSWORD)) {
|
|
||||||
return CHAMPION_LIST.contains(id) || Configuration.CHAMPIONS.get().contains(name);
|
|
||||||
}
|
}
|
||||||
return null;
|
}).or(() -> {
|
||||||
})).or(() -> ModDynamicModels.Axes.REGISTRY.get(modelId).map(model -> {
|
return Swords.REGISTRY.get(modelId).map((model) -> {
|
||||||
if (model.equals(ModDynamicModels.Axes.GODAXE)) {
|
return model.equals(Swords.GODSWORD) ? data.isAtLeastTier(PatreonTier.CHAMPION) || Configuration.CHAMPIONS.get().contains(name) : null;
|
||||||
return CHAMPION_LIST.contains(id) || Configuration.CHAMPIONS.get().contains(name);
|
});
|
||||||
}
|
}).or(() -> {
|
||||||
return null;
|
return Axes.REGISTRY.get(modelId).map((model) -> {
|
||||||
})).orElse(discoveredModelIds.contains(modelId));
|
return model.equals(Axes.GODAXE) ? data.isAtLeastTier(PatreonTier.CHAMPION) || Configuration.CHAMPIONS.get().contains(name) : null;
|
||||||
|
});
|
||||||
|
}).orElseGet(() -> {
|
||||||
|
return discoveredModelIds.contains(modelId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue