@Override public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { switch (cameraTransformType) { case FIRST_PERSON: GlStateManager.scale(2.0F, 2.0F, 2.0F); ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(0.0F, 0.0F, -0.35F); break; case THIRD_PERSON: GlStateManager.scale(2.0F, 2.0F, 2.0F); ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.15F, 0.25F, -0.25F); break; default: ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType); break; } return Pair.of(this, null); }
@Override public IFlexibleBakedModel 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); } ItemIconModel test = new ItemIconModel(this, state, bakedTextureGetter); return test; }
@Override public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { ForgeHooksClient.handleCameraTransforms(baseModel, cameraTransformType); if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) { return Pair.of(new ModelItemBombBagGui(baseModel, bombsHeld), null); } return Pair.of(this, null); }
public ModelItemBombBagGui(IFlexibleBakedModel baseModel, int bombsHeld) { this.baseModel = baseModel; int tens = (bombsHeld / 10); int ones = (bombsHeld % 10); String digit = ModInfo.ID + ":items/digits/"; this.tensSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(digit + tens); this.onesSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(digit + ones); }
public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> textures) { return new VCraftBakedModel(textures.apply(dummyTexture)); }
public ModelItemBomb(IBakedModel baseModel) { bombModel = new ModelBomb(); this.baseModel = (baseModel instanceof IFlexibleBakedModel ? (IFlexibleBakedModel) baseModel : new IFlexibleBakedModel.Wrapper(baseModel, DefaultVertexFormats.ITEM)); }
@Override public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { // Render as 2D sprite when in GUI if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) { ForgeHooksClient.handleCameraTransforms(baseModel, cameraTransformType); return Pair.of(this, null); } GlStateManager.pushMatrix(); switch (cameraTransformType) { case FIRST_PERSON: GlStateManager.translate(0.5F, 0.5F, 0.5F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); GlStateManager.translate(-0.75F, -0.5F, 0.5F); if (isFlashing) { GlStateManager.scale(1.2F, 1.2F, 1.2F); } break; case THIRD_PERSON: GlStateManager.rotate(80.0F, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0.0F, -0.525F, -0.1F); GlStateManager.scale(0.5F, 0.5F, 0.5F); if (isFlashing) { GlStateManager.scale(1.2F, 1.2F, 1.2F); } break; case GROUND: GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0.0F, -0.725F, 0.0F); GlStateManager.scale(0.825F, 0.825F, 0.825F); break; case FIXED: // e.g. inside a ceramic jar GlStateManager.rotate(90.0F, 1.0F, 1.0F, 0.0F); GlStateManager.translate(0F, -0.325F, 0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); break; default: } Minecraft.getMinecraft().getTextureManager().bindTexture(getTexture(type, isFlashing)); // first Entity parameter not used for anything in ModelBomb, so null is safe bombModel.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0475F); GlStateManager.popMatrix(); if (this.emptyModel == null) { ModelResourceLocation resource = new ModelResourceLocation(ModInfo.ID + ":empty", "inventory"); this.emptyModel = new IFlexibleBakedModel.Wrapper(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager().getModel(resource), DefaultVertexFormats.ITEM); } // return empty model to render nothing - bomb model already rendered return Pair.of(emptyModel, null); }
public ModelItemShield(IBakedModel shieldFront) { this.shieldFront = (shieldFront instanceof IFlexibleBakedModel ? (IFlexibleBakedModel) shieldFront : new IFlexibleBakedModel.Wrapper(shieldFront, DefaultVertexFormats.ITEM)); if (ZSSMain.isBG2Enabled) { BattlegearUtils.RENDER_BUS.register(this); } }
@Override public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { ForgeHooksClient.handleCameraTransforms(shieldFront, cameraTransformType); return Pair.of(this, null); }
public ModelItemBombBag(IBakedModel baseModel) { this.baseModel = (baseModel instanceof IFlexibleBakedModel ? (IFlexibleBakedModel) baseModel : new IFlexibleBakedModel.Wrapper(baseModel, DefaultVertexFormats.ITEM)); }