I is retarded

This commit is contained in:
Vincent Lee committed 2016-01-11 14:25:00 -06:00
1 parent 94d72161a9
commit 64e3a96651
1 file changed
+75 -110
@@ -166,173 +166,123 @@ public final class ModelHandler {
registerBrews();
/** Special Item Meshers **/
// Cannot use lambdas yet because FG/SS can't reobfuscate them.
// See https://github.com/MinecraftForge/ForgeGradle/issues/314
// Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper
// See https://github.com/MinecraftForge/ForgeGradle/issues/314.
ModelLoader.registerItemVariants(infiniteFruit,
new ModelResourceLocation("botania:infiniteFruit", "inventory"),
new ModelResourceLocation("botania:infiniteFruitBoot", "inventory"));
ModelLoader.setCustomMeshDefinition(infiniteFruit, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ItemInfiniteFruit.isBoot(stack)
? new ModelResourceLocation("botania:infiniteFruitBoot", "inventory")
: new ModelResourceLocation("botania:infiniteFruit", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(infiniteFruit, MesherWrapper.of(stack ->
ItemInfiniteFruit.isBoot(stack)
? new ModelResourceLocation("botania:infiniteFruitBoot", "inventory")
: new ModelResourceLocation("botania:infiniteFruit", "inventory")));
ModelLoader.registerItemVariants(magnetRing,
new ModelResourceLocation("botania:magnetRingOn", "inventory"),
new ModelResourceLocation("botania:magnetRingOff", "inventory"));
ModelLoader.setCustomMeshDefinition(magnetRing, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ItemMagnetRing.getCooldown(stack) <= 0
? new ModelResourceLocation("botania:magnetRingOn", "inventory")
: new ModelResourceLocation("botania:magnetRingOff", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(magnetRing, MesherWrapper.of(stack ->
ItemMagnetRing.getCooldown(stack) <= 0
? new ModelResourceLocation("botania:magnetRingOn", "inventory")
: new ModelResourceLocation("botania:magnetRingOff", "inventory")));
ModelLoader.registerItemVariants(magnetRingGreater,
new ModelResourceLocation("botania:magnetRingGreaterOn", "inventory"),
new ModelResourceLocation("botania:magnetRingGreaterOff", "inventory"));
ModelLoader.setCustomMeshDefinition(magnetRingGreater, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ItemMagnetRing.getCooldown(stack) <= 0
? new ModelResourceLocation("botania:magnetRingGreaterOn", "inventory")
: new ModelResourceLocation("botania:magnetRingGreaterOff", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(magnetRingGreater, MesherWrapper.of(stack ->
ItemMagnetRing.getCooldown(stack) <= 0
? new ModelResourceLocation("botania:magnetRingGreaterOn", "inventory")
: new ModelResourceLocation("botania:magnetRingGreaterOff", "inventory")));
ModelLoader.registerItemVariants(manaGun,
new ModelResourceLocation("botania:manaGun", "inventory"),
new ModelResourceLocation("botania:manaGunClip", "inventory"),
new ModelResourceLocation("botania:desuGun", "inventory"),
new ModelResourceLocation("botania:desuGunClip", "inventory"));
ModelLoader.setCustomMeshDefinition(manaGun, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
String name = ((ItemManaGun) manaGun).isSugoiKawaiiDesuNe(stack) ? "botania:desuGun" : "botania:manaGun";
return new ModelResourceLocation(name + (ItemManaGun.hasClip(stack) ? "Clip" : ""), "inventory");
}
});
ModelLoader.setCustomMeshDefinition(manaGun, MesherWrapper.of(stack -> {
String name = ((ItemManaGun) manaGun).isSugoiKawaiiDesuNe(stack) ? "botania:desuGun" : "botania:manaGun";
return new ModelResourceLocation(name + (ItemManaGun.hasClip(stack) ? "Clip" : ""), "inventory");
}));
ModelLoader.registerItemVariants(tornadoRod,
new ModelResourceLocation("botania:tornadoRod", "inventory"),
new ModelResourceLocation("botania:tornadoRod_flying", "inventory"));
ModelLoader.setCustomMeshDefinition(tornadoRod, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ((ItemTornadoRod) ModItems.tornadoRod).isFlying(stack)
? new ModelResourceLocation("botania:tornadoRod_flying", "inventory")
: new ModelResourceLocation("botania:tornadoRod", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(tornadoRod, MesherWrapper.of(stack ->
((ItemTornadoRod) ModItems.tornadoRod).isFlying(stack)
? new ModelResourceLocation("botania:tornadoRod_flying", "inventory")
: new ModelResourceLocation("botania:tornadoRod", "inventory")));
ModelLoader.registerItemVariants(twigWand,
new ModelResourceLocation("botania:twigWand", "inventory"),
new ModelResourceLocation("botania:twigWand_bind", "inventory"));
ModelLoader.setCustomMeshDefinition(twigWand, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
String path = "botania:twigWand";
return new ModelResourceLocation(path + (ItemTwigWand.getBindMode(stack) ? "_bind" : ""), "inventory");
}
});
ModelLoader.setCustomMeshDefinition(twigWand, MesherWrapper.of(stack -> {
String path = "botania:twigWand";
return new ModelResourceLocation(path + (ItemTwigWand.getBindMode(stack) ? "_bind" : ""), "inventory");
}));
ModelLoader.registerItemVariants(manaweaveBoots,
new ModelResourceLocation("botania:manaweaveBoots", "inventory"),
new ModelResourceLocation("botania:manaweaveBootsHoliday", "inventory"));
ModelLoader.setCustomMeshDefinition(manaweaveBoots, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveBootsHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveBoots", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(manaweaveBoots, MesherWrapper.of(stack ->
ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveBootsHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveBoots", "inventory")));
ModelLoader.registerItemVariants(manaweaveChest,
new ModelResourceLocation("botania:manaweaveChest", "inventory"),
new ModelResourceLocation("botania:manaweaveChestHoliday", "inventory"));
ModelLoader.setCustomMeshDefinition(manaweaveChest, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveChestHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveChest", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(manaweaveChest, MesherWrapper.of(stack ->
ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveChestHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveChest", "inventory")));
ModelLoader.registerItemVariants(manaweaveHelm,
new ModelResourceLocation("botania:manaweaveHelm", "inventory"),
new ModelResourceLocation("botania:manaweaveHelmHoliday", "inventory"));
ModelLoader.setCustomMeshDefinition(manaweaveHelm, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveHelmHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveHelm", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(manaweaveHelm, MesherWrapper.of(stack ->
ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveHelmHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveHelm", "inventory")));
ModelLoader.registerItemVariants(manaweaveLegs,
new ModelResourceLocation("botania:manaweaveLegs", "inventory"),
new ModelResourceLocation("botania:manaweaveLegsHoliday", "inventory"));
ModelLoader.setCustomMeshDefinition(manaweaveLegs, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveLegsHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveLegs", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(manaweaveLegs, MesherWrapper.of(stack ->
ClientProxy.jingleTheBells
? new ModelResourceLocation("botania:manaweaveLegsHoliday", "inventory")
: new ModelResourceLocation("botania:manaweaveLegs", "inventory")));
ModelLoader.registerItemVariants(manasteelSword,
new ModelResourceLocation("botania:manasteelSword", "inventory"),
new ModelResourceLocation("botania:elucidator", "inventory"));
ModelLoader.setCustomMeshDefinition(manasteelSword, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return "the elucidator".equals(stack.getDisplayName().toLowerCase().trim())
? new ModelResourceLocation("botania:elucidator", "inventory")
: new ModelResourceLocation("botania:manasteelSword", "inventory");
}
});
ModelLoader.setCustomMeshDefinition(manasteelSword, MesherWrapper.of(stack ->
"the elucidator".equals(stack.getDisplayName().toLowerCase().trim())
? new ModelResourceLocation("botania:elucidator", "inventory")
: new ModelResourceLocation("botania:manasteelSword", "inventory")));
ModelLoader.registerItemVariants(spawnerMover,
new ModelResourceLocation("botania:spawnerMover", "inventory"),
new ModelResourceLocation("botania:spawnerMoverFull", "inventory"));
ModelLoader.setCustomMeshDefinition(spawnerMover, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation("botania:spawnerMover" + (ItemSpawnerMover.hasData(stack) ? "Full" : ""), "inventory");
}
});
ModelLoader.setCustomMeshDefinition(spawnerMover, MesherWrapper.of(stack -> new ModelResourceLocation("botania:spawnerMover" + (ItemSpawnerMover.hasData(stack) ? "Full" : ""), "inventory")));
ModelLoader.registerItemVariants(terraPick,
new ModelResourceLocation("botania:terraPick", "inventory"),
new ModelResourceLocation("botania:terraPickEnabled", "inventory"),
new ModelResourceLocation("botania:terraPickTipped", "inventory"),
new ModelResourceLocation("botania:terraPickTippedEnabled", "inventory"));
ModelLoader.setCustomMeshDefinition(terraPick, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
String name = "botania:terraPick";
if (ItemTerraPick.isTipped(stack)) {
name += "Tipped";
}
if (ItemTerraPick.isEnabled(stack)) {
name += "Enabled";
}
return new ModelResourceLocation(name, "inventory");
ModelLoader.setCustomMeshDefinition(terraPick, MesherWrapper.of(stack -> {
String name = "botania:terraPick";
if (ItemTerraPick.isTipped(stack)) {
name += "Tipped";
}
});
if (ItemTerraPick.isEnabled(stack)) {
name += "Enabled";
}
return new ModelResourceLocation(name, "inventory");
}));
}
private static void registerSubtiles() {
@@ -698,19 +648,19 @@ public final class ModelHandler {
ModelLoader.registerItemVariants(brewFlask, new ModelResourceLocation("botania:flask1_" + i, "inventory"));
}
ModelLoader.setCustomMeshDefinition(brewFlask, stack -> {
ModelLoader.setCustomMeshDefinition(brewFlask, MesherWrapper.of(stack -> {
int swigsTaken = 6 - ((ItemBrewBase) brewFlask).getSwigsLeft(stack);
return new ModelResourceLocation("botania:flask1_" + swigsTaken, "inventory");
});
}));
for (int i = 0; i < 4; i++) {
ModelLoader.registerItemVariants(brewVial, new ModelResourceLocation("botania:vial1_" + i, "inventory"));
}
ModelLoader.setCustomMeshDefinition(brewVial, stack -> {
ModelLoader.setCustomMeshDefinition(brewVial, MesherWrapper.of(stack -> {
int swigsTaken = 4 - ((ItemBrewBase) brewVial).getSwigsLeft(stack);
return new ModelResourceLocation("botania:vial1_" + swigsTaken, "inventory");
});
}));
}
private static void registerStateMappers() {
@@ -1105,4 +1055,19 @@ public final class ModelHandler {
private ModelHandler() {}
private interface MesherWrapper extends ItemMeshDefinition {
static MesherWrapper of(MesherWrapper w) {
return w;
}
ModelResourceLocation getLocation(ItemStack stack);
@Override
default ModelResourceLocation getModelLocation(ItemStack stack) {
return getLocation(stack);
}
}
}