public AnimationItemOverrideList(IModel model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides) { super(overrides); this.model = model; this.state = state; this.format = format; this.bakedTextureGetter = bakedTextureGetter; }
@Override public ItemOverrideList getOverrides() { return new ItemOverrideList(new ArrayList<ItemOverride>()){ @Override public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) { if( !( stack.getItem() == Item.getItemFromBlock(ModBlocks.crystalPipe)) ) { return originalModel; } return new ModelPipeBaked( stack ); } }; }
private List<ItemOverride> getItemOverrides( JsonObject object, JsonDeserializationContext deserializationContext) { List<ItemOverride> list = Lists.<ItemOverride>newArrayList(); if (object.has("overrides")) { for (JsonElement jsonelement : JsonUtils.getJsonArray(object, "overrides")) { list.add((ItemOverride) deserializationContext.deserialize(jsonelement, ItemOverride.class)); } } return list; }
@Override public ModelDescription deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); int version = jsonObject.get("version").getAsInt(); // Currently version is ignored if (version != 0 && version != 1) { throw new JsonParseException("Unsupported model version"); } boolean isLegacy = version == 0; ISkeleton skeleton = loadSkeleton(isLegacy, jsonObject); ResourceLocation modelLocation = new ResourceLocation(jsonObject.get("mesh").getAsString()); ModelMCMD mesh = ClientLoader.loadModel(modelLocation, skeleton); ImmutableMap<String, ResourceLocation> textureLocatons = ImmutableMap.of(); if (version != 0) { Builder<String, ResourceLocation> builder = ImmutableMap.builder(); JsonObject textureMap = jsonObject.getAsJsonObject("textures"); for (Entry<String, JsonElement> texEntry : textureMap.entrySet()) { String slotName = texEntry.getKey(); if (!slotName.startsWith("#")) { throw new JsonParseException("Slot names must begin with '#'"); } ResourceLocation textureLocation = new ResourceLocation(texEntry.getValue().getAsString()); builder.put(slotName, textureLocation); } textureLocatons = builder.build(); } ImmutableMap<TransformType, TRSRTransformation> viewMapping = parseViewMapping(jsonObject, context); List<ItemOverride> itemOverrides = getItemOverrides(jsonObject, context); return new ModelDescription(mesh, skeleton, textureLocatons, viewMapping, itemOverrides); }
private ModelDescription( ModelMCMD model, ISkeleton skeleton, ImmutableMap<String, ResourceLocation> textureMapping, ImmutableMap<TransformType, TRSRTransformation> viewMapping, List<ItemOverride> itemOverrides) { this.model = Objects.requireNonNull(model); this.skeleton = Objects.requireNonNull(skeleton); this.textureMapping = Objects.requireNonNull(textureMapping); this.viewMapping = Objects.requireNonNull(viewMapping); this.itemOverrides = new ItemOverrideList(itemOverrides); }
private static Set<ResourceLocation> getDependencies(BakedModelWrapper bakedModel) { Set<ResourceLocation> overrideLocations = new HashSet<>(); for (ItemOverride override : bakedModel.getOverrides().getOverrides()) { ResourceLocation overrideLocation = override.getLocation(); overrideLocations.add(overrideLocation); } return overrideLocations; }
public StencilItemOverride(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { super(Collections.<ItemOverride> emptyList()); this.state = state; this.format = format; this.bakedTextureGetter = bakedTextureGetter; final ResourceLocation emptyStencilTexture = StencilTextureManager.INSTANCE.getEmptyStencilTextureLocation(BACKGROUND_TEXTURE); this.emptyBakedModel = createItemModel(emptyStencilTexture); }
public TexturedItemOverrides(IBakedModel untexturedModel, IModel texturedModel, List<ItemOverride> texturedModelOverrides, Set<String> texturesToReplace, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { super(Lists.reverse(texturedModelOverrides)); this.untexturedModel = untexturedModel; this.texturedModel = texturedModel; this.texturesToReplace = ImmutableSet.copyOf(texturesToReplace); this.state = state; this.format = format; this.bakedTextureGetter = bakedTextureGetter; }
public SpellPageOverrideList() { super(ImmutableList.<ItemOverride>of()); this.cache = new HashMap<String, IBakedModel>(); }
public KnowledgeBookOverrideList() { super(ImmutableList.<ItemOverride>of()); this.cache = new HashMap<String, IBakedModel>(); }
private BakedMaceOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedDaggerOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedHoeOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedPickaxeOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedAxeOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedHammerOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedShovelOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedSwordOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedHandpickOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedDynBucketOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedSeedOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
public ModelOverride() { super(new ArrayList<ItemOverride>()); }
public ItemOverrides() { super(Collections.<ItemOverride>emptyList()); }
private ExtractorItemOverrides() { super(ImmutableList.<ItemOverride>of()); }
public ItemHandler () { super(ImmutableList.<ItemOverride>of()); }
@Override public ItemOverrideList getOverrides() { return new ItemOverrideList(Collections.<ItemOverride>emptyList()); }
@Override public ItemOverrideList getOverrides() { return new ItemOverrideList(Lists.<ItemOverride>newArrayList()); }
public BlockPlacerOverrideList(List<ItemOverride> overridesIn) { super(ImmutableList.<ItemOverride>of()); }
public SuperModelItemOverrideList(SuperDispatcher dispatcher) { super(Lists.<ItemOverride>newArrayList()); this.dispatcher = dispatcher; }
private BakedEnderBucketOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private BakedEnderToolOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
private ModelNullifierBakedOverrideHandler() { super(ImmutableList.<ItemOverride>of()); }
public ItemStateOverrideList(Map<State, IBakedModel> models) { super(ImmutableList.<ItemOverride> of()); this.models = ImmutableMap.copyOf(models); }
public EnderItemOverrideList() { super(Collections.<ItemOverride> emptyList()); }