ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation( UVLModelLoader.this.resourceManager, armatureLocation ); ModelBlock model;
if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) float time = Animation.getWorldTime(getWorld(), partialTick); Pair<IModelState, Iterable<Event>> pair = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);
@Override public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { if (!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT)) { throw new IllegalArgumentException("can't bake vanilla models to the format that doesn't fit into the default one: " + format); } ModelBlock model = this.model; if (model == null) { return BuiltinLoader.WRAPPED_MODEL_MISSING.bake(BuiltinLoader.WRAPPED_MODEL_MISSING.getDefaultState(), format, bakedTextureGetter); } List<TRSRTransformation> newTransforms = Lists.newArrayList(); for (int i = 0; i < model.getElements().size(); i++) { BlockPart part = model.getElements().get(i); newTransforms.add(animation.getPartTransform(state, part, i)); } ItemCameraTransforms transforms = model.getAllTransforms(); Map<ItemCameraTransforms.TransformType, TRSRTransformation> tMap = Maps.newEnumMap(ItemCameraTransforms.TransformType.class); tMap.putAll(PerspectiveMapWrapper.getTransforms(transforms)); tMap.putAll(PerspectiveMapWrapper.getTransforms(state)); IModelState perState = new SimpleModelState(ImmutableMap.copyOf(tMap)); if (hasItemModel(model)) { return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter); } if (isCustomRenderer(model)) { return new BuiltInModel(transforms, model.createOverrides()); } return bakeNormal(model, perState, state, newTransforms, format, bakedTextureGetter, uvlock); }
private final ItemOverrideList overrides = new AnimationItemOverrideList(VanillaModelWrapper.this, modelState, format, bakedTextureGetter, super.getOverrides());
ClientRegistry.bindTileEntitySpecialRenderer(TilePrism.class, new RenderTilePrism()); ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaIndex.class, new RenderTileCorporeaIndex()); ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new AnimationTESR<>()); ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube()); ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
@Override public IModel loadModel(ResourceLocation modelLocation) throws Exception { // Load vanilla model ModelBlock vanillaModel; ResourceLocation vanillaModelLocation = new ResourceLocation(modelLocation.getNamespace(), modelLocation.getPath() + ".json"); try (IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(vanillaModelLocation); Reader reader = new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8)) { vanillaModel = ModelBlock.deserialize(reader); vanillaModel.name = modelLocation.toString(); } // Load armature animation (currently disabled for efficiency, see MixinModelBlockAnimation) String modelPath = modelLocation.getPath(); if (modelPath.startsWith("models/")) { modelPath = modelPath.substring("models/".length()); } ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getNamespace(), "armatures/" + modelPath + ".json"); ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(Minecraft.getMinecraft().getResourceManager(), armatureLocation); // Return the vanilla model weapped in a VanillaModelWrapper return new VanillaModelWrapper(modelLocation, vanillaModel , false, animation); }