Java 类net.minecraftforge.client.model.Attributes 实例源码
项目:CrystalMod
文件:DynamicBaseModel.java
/**
* Add a given rotated quad to a list of quads.
* @param quads The quads to append to.
* @param x1 Start X
* @param x2 End X
* @param z1 Start Z
* @param z2 End Z
* @param y Y
* @param texture The base texture
* @param side The side to add render quad at.
* @param rotation The rotation index to rotate by.
* @param isColored When set to true a colored baked quad will be made, otherwise a regular baked quad is used.
* @param shadeColor The shade color
* @param uvs A double array of 4 uv pairs
*/
public static void addBakedQuadRotated(List<BakedQuad> quads, float x1, float x2, float z1, float z2, float y,
TextureAtlasSprite texture, EnumFacing side, int rotation,
boolean isColored, int shadeColor, float[][] uvs) {
Vec3d v1 = rotate(new Vec3d(x1 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5);
Vec3d v2 = rotate(new Vec3d(x1 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5);
Vec3d v3 = rotate(new Vec3d(x2 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5);
Vec3d v4 = rotate(new Vec3d(x2 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5);
int[] data = Ints.concat(
vertexToInts((float) v1.xCoord, (float) v1.yCoord, (float) v1.zCoord, shadeColor, texture, uvs[(0 + rotation) % 4][0] * 16, uvs[(0 + rotation) % 4][1] * 16),
vertexToInts((float) v2.xCoord, (float) v2.yCoord, (float) v2.zCoord, shadeColor, texture, uvs[(1 + rotation) % 4][0] * 16, uvs[(1 + rotation) % 4][1] * 16),
vertexToInts((float) v3.xCoord, (float) v3.yCoord, (float) v3.zCoord, shadeColor, texture, uvs[(2 + rotation) % 4][0] * 16, uvs[(2 + rotation) % 4][1] * 16),
vertexToInts((float) v4.xCoord, (float) v4.yCoord, (float) v4.zCoord, shadeColor, texture, uvs[(3 + rotation) % 4][0] * 16, uvs[(3 + rotation) % 4][1] * 16)
);
ForgeHooksClient.fillNormal(data, side); // This fixes lighting issues when item is rendered in hand/inventory
quads.add(new BakedQuad(data, -1, side, texture, false, Attributes.DEFAULT_BAKED_FORMAT));
}
项目:TombManyGraves
文件:GoodGraveModel.java
protected IBakedModel getActualModel(String texture)
{
IBakedModel bakedModel = standard;
if (texture!=null)
{
if (cache.containsKey(texture))
{
bakedModel = cache.get(texture);
}
else if (retexturableModel != null)
{
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.put("bottom", texture);
builder.put("top", texture);
builder.put("side", texture);
IModel retexturedModel = retexturableModel.retexture(builder.build());
bakedModel = retexturedModel.bake(TRSRTransformation.identity(), Attributes.DEFAULT_BAKED_FORMAT, ModelLoader.defaultTextureGetter());
cache.put(texture, bakedModel);
}
}
return bakedModel;
}
项目:Kingdom-Keys-Re-Coded
文件:ModelHelper.java
public static HashMap<String, IBakedModel> getModelsForGroups (OBJModel objModel) {
HashMap<String, IBakedModel> modelParts = new HashMap<String, IBakedModel>();
if (!objModel.getMatLib().getGroups().keySet().isEmpty()) {
for (String key : objModel.getMatLib().getGroups().keySet()) {
if (!modelParts.containsKey(key)) {
modelParts.put(key, objModel.bake(new OBJModel.OBJState(ImmutableList.of(key), false), Attributes.DEFAULT_BAKED_FORMAT, ModelHelper.textureGetterFlipV));
}
}
}
modelParts.put(ALL_PARTS, objModel.bake(objModel.getDefaultState(), Attributes.DEFAULT_BAKED_FORMAT, textureGetterFlipV));
return modelParts;
}
项目:SasaLib
文件:SimpleIconModel.java
@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;
}
项目:SasaLib
文件:ItemIconModel.java
public ItemIconModel(IModel modelCls, IModelState state, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
super(false, false, null, Attributes.DEFAULT_BAKED_FORMAT, bakedTextureGetter);
this.textureLocation = null;
this.state = state;
this.iModel = modelCls;
}
项目:EnderIO
文件:PaintRegistry.java
@SideOnly(Side.CLIENT)
private IBakedModel paintModel(IModel sourceModel, final @Nullable IBlockState paintSource, IModelState rotation, final PaintMode paintMode) {
IModelState state = sourceModel.getDefaultState();
state = combine(state, rotation);
if (state instanceof UVLock) {
sourceModel = ModelProcessingHelper.uvlock(sourceModel, true);
state = ((UVLock) state).getParent();
}
return sourceModel.bake(state, Attributes.DEFAULT_BAKED_FORMAT, new Function<ResourceLocation, TextureAtlasSprite>() {
@Override
public TextureAtlasSprite apply(@Nullable ResourceLocation location) {
String locationString = location == null ? "" : location.toString();
if (paintMode != PaintMode.TAGGED_TEXTURES || locationString.endsWith("PAINT")) {
if (paintSource == null) {
return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
} else {
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(paintSource);
}
} else {
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(locationString);
}
}
@Override
public boolean equals(@Nullable Object obj) {
return super.equals(obj);
}
@Override
public int hashCode() {
return super.hashCode();
}
});
}
项目:Thelta
文件:TileEntityRendererMachineArm.java
public static IBakedModel bake(IModel model) {
return model.bake(TRSRTransformation.identity(), Attributes.DEFAULT_BAKED_FORMAT,
ModelLoader.defaultTextureGetter());
}
项目:TombManyGraves
文件:ModelHelper.java
public static IBakedModel bake(IModel model)
{
return model.bake(TRSRTransformation.identity(), Attributes.DEFAULT_BAKED_FORMAT, ModelLoader.defaultTextureGetter());
}
项目:CommonUtils
文件:BakerUtil.java
public static IBakedModel bake(IModel model, IModelState modelState) {
return bake(model, modelState, Attributes.DEFAULT_BAKED_FORMAT);
}
项目:CommonUtils
文件:BakerUtil.java
public static IBakedModel bake(IModel model, IModelState modelState,
Map<ResourceLocation, TextureAtlasSprite> textures) {
return bake(model, modelState, Attributes.DEFAULT_BAKED_FORMAT, textures);
}
项目:vintagecraft
文件:VCraftModelLoader.java
public VertexFormat getFormat()
{
return Attributes.DEFAULT_BAKED_FORMAT;
}