Created
December 30, 2015 15:58
-
-
Save marchermans/39a6e06eb8c28c7c8a7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.AbstractMethodError | |
at net.minecraftforge.client.model.ItemLayerModel.bake(ItemLayerModel.java:85) | |
at com.SmithsModding.Armory.Client.Model.Item.Unbaked.MultiLayeredArmorItemModel.bake(MultiLayeredArmorItemModel.java:46) | |
at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) | |
at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:28) | |
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:130) | |
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:111) | |
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:772) | |
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:323) | |
at net.minecraft.client.Minecraft.startGame(Minecraft.java:532) | |
at net.minecraft.client.Minecraft.run(Minecraft.java:360) | |
at net.minecraft.client.main.Main.main(Main.java:116) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:606) | |
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) | |
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:606) | |
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) | |
at GradleStart.main(Unknown Source) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.SmithsModding.Armory.Client.Model.Item.Unbaked; | |
import com.SmithsModding.Armory.API.Armor.*; | |
import com.SmithsModding.Armory.*; | |
import com.SmithsModding.Armory.Client.Model.Item.Baked.*; | |
import com.SmithsModding.Armory.Client.Model.Item.Baked.Components.*; | |
import com.SmithsModding.Armory.Client.Model.Item.Unbaked.Components.*; | |
import com.SmithsModding.SmithsCore.Util.Client.*; | |
import com.SmithsModding.SmithsCore.Util.Common.*; | |
import com.google.common.base.*; | |
import com.google.common.collect.*; | |
import net.minecraft.client.renderer.texture.*; | |
import net.minecraft.client.renderer.vertex.*; | |
import net.minecraft.util.*; | |
import net.minecraftforge.client.model.*; | |
import java.util.*; | |
/** | |
* Created by Marc on 06.12.2015. | |
*/ | |
public class MultiLayeredArmorItemModel extends ItemLayerModel { | |
private final MultiLayeredArmor armor; | |
private final ArmorComponentModel baseLayer; | |
private final HashMap<String, ArmorComponentModel> parts; | |
private final HashMap<String, ArmorComponentModel> brokenParts; | |
public MultiLayeredArmorItemModel (MultiLayeredArmor armor, ImmutableList<ResourceLocation> defaultTextures, ArmorComponentModel baseLayer, HashMap<String, ArmorComponentModel> parts, HashMap<String, ArmorComponentModel> brokenPartBlocks) { | |
super(defaultTextures); | |
this.armor = armor; | |
this.baseLayer = baseLayer; | |
this.parts = parts; | |
this.brokenParts = brokenPartBlocks; | |
} | |
@Override | |
public Collection<ResourceLocation> getDependencies () { | |
return ImmutableList.of(); | |
} | |
@Override | |
public IFlexibleBakedModel bake (IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { | |
//Get ourselfs the base model to use. | |
IFlexibleBakedModel base = super.bake(state, format, bakedTextureGetter); | |
//Setup the maps that contain the converted baked sub models. | |
Pair<String, BakedComponentModel> mappedBaseLayer = null; | |
HashMap<String, BakedComponentModel> mappedParts = new HashMap<String, BakedComponentModel>(); | |
HashMap<String, BakedComponentModel> mappedBrokenParts = new HashMap<String, BakedComponentModel>(); | |
//Check every possible addon for a texture and register it accordingly | |
for (final MLAAddon addon : armor.getAllowedAddons()) { | |
String addonID = addon.getUniqueID(); | |
if (addon.isMaterialDependent()) { | |
addonID = ((MaterialDependentMLAAddon) addon).getMaterialIndependentID(); | |
} | |
if (addon.getItemWholeTextureLocation().equals(baseLayer.getTexture()) && mappedBaseLayer == null) { | |
mappedBaseLayer = new Pair<String, BakedComponentModel>(addonID, baseLayer.generateBackedComponentModel(state, format, bakedTextureGetter)); | |
} else if (parts.containsKey(addon.getItemWholeTextureLocation().toString())) { | |
mappedParts.put(addonID, parts.get(addon.getItemWholeTextureLocation().toString()).generateBackedComponentModel(state, format, bakedTextureGetter)); | |
//If a part was found, also check for its broken counterpart. | |
if (brokenParts.containsKey(addon.getItemBrokenTextureLocation().toString())) { | |
mappedBrokenParts.put(addonID, parts.get(addon.getItemBrokenTextureLocation().toString()).generateBackedComponentModel(state, format, bakedTextureGetter)); | |
} | |
} else if (!addon.getItemWholeTextureLocation().equals(baseLayer.getTexture())) { | |
//For a given MLAAddon on the armor was no texture found. | |
Armory.getLogger().error("A given Armor: " + armor.getUniqueID() + " has a MLAAddon: " + addon.getUniqueID() + " that has no texture registered in the model. It is being skipped."); | |
} | |
} | |
//Bake the model. | |
return new BakedMultiLayeredArmorItemModel(base, mappedBaseLayer, mappedParts, mappedBrokenParts); | |
} | |
@Override | |
public IModelState getDefaultState () { | |
return ModelHelper.DEFAULT_ITEM_STATE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment