Java Code Examples for net.minecraftforge.common.model.TRSRTransformation#blockCenterToCorner()

The following examples show how to use net.minecraftforge.common.model.TRSRTransformation#blockCenterToCorner() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TRSRBakedModel.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
/** Rotates around the Y axis and adjusts culling appropriately. South is default. */
public TRSRBakedModel(IBakedModel original, EnumFacing facing) {
	this.original = original;
	this.override = new TRSROverride(this);

	this.faceOffset = 4 + EnumFacing.NORTH.getHorizontalIndex() - facing.getHorizontalIndex();

	double r = Math.PI * (360 - facing.getOpposite().getHorizontalIndex() * 90)/180d;
	TRSRTransformation t = new TRSRTransformation(null, null, null, TRSRTransformation.quatFromXYZ(0, (float)r, 0));
	this.transformation = TRSRTransformation.blockCenterToCorner(t);
}
 
Example 2
Source File: TRSRBakedModel.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public TRSRBakedModel(IBakedModel original, TRSRTransformation transform) {
	this.original = original;
	this.transformation = TRSRTransformation.blockCenterToCorner(transform);
	this.override = new TRSROverride(this);
	this.faceOffset = 0;
}
 
Example 3
Source File: ModelEnderBucket.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
private IModelState getTransformedModelState(IModelState state, float offZ, float scaleZ)
{
    TRSRTransformation tr = new TRSRTransformation(new Vector3f(0f, 0f, offZ), null, new Vector3f(1f, 1f, scaleZ), null);
    return new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(tr));
}
 
Example 4
Source File: ModelEnderTools.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
private IModelState getTransformedModelState(IModelState state, String module)
{
    ModuleTransforms mt = new ModuleTransforms(this, this.tool, module);
    TRSRTransformation tr = new TRSRTransformation(new Vector3f(mt.tx, mt.ty, mt.tz), null, new Vector3f(mt.sx, mt.sy, mt.sz), null);
    return new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(tr));
}
 
Example 5
Source File: ModelNullifierBaked.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void addQuads(ModelNullifierBaked nullifierModel, boolean locked, ItemStack containedStack)
{
    IBakedModel itemModel = null;
    IBakedModel textModel = null;

    if (containedStack.isEmpty() == false)
    {
        ItemType type = new ItemType(containedStack, true);
        itemModel = ITEM_MODEL_CACHE.get(type);

        if (itemModel == null)
        {
            IModel iModel = this.getItemModel(containedStack);

            if (iModel != null && iModel.getClass().getName().equals("net.minecraftforge.client.model.FancyMissingModel") == false)
            {
                TRSRTransformation trn = new TRSRTransformation(new javax.vecmath.Vector3f(-0.5f, -0.5f, -0.5f), null, null, null);
                TRSRTransformation trr = TRSRTransformation.from(ModelRotation.X0_Y180);
                TRSRTransformation trp = new TRSRTransformation(new javax.vecmath.Vector3f( 0.5f,  0.5f,  0.5f), null, null, null);
                TRSRTransformation trs = new TRSRTransformation(null, null, new javax.vecmath.Vector3f(0.6f, 0.6f, 0.6f), null);
                TRSRTransformation tr = trn.compose(trr).compose(trp).compose(trs);

                IModelState state = new ModelStateComposition(this.modelState, TRSRTransformation.blockCenterToCorner(tr));
                itemModel = iModel.bake(state, this.format, this.bakedTextureGetter);
            }
            else
            {
                Minecraft mc = Minecraft.getMinecraft();
                itemModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(containedStack);
                itemModel = itemModel.getOverrides().handleItemState(itemModel, containedStack, mc.world, mc.player);
            }

            ITEM_MODEL_CACHE.put(type, itemModel);
        }
    }

    this.addQuadsForSide(null, nullifierModel, itemModel, textModel, locked);

    for (EnumFacing side : EnumFacing.values())
    {
        this.addQuadsForSide(side, nullifierModel, itemModel, textModel, locked);
    }
}