本文整理汇总了Java中net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType.values方法的典型用法代码示例。如果您正苦于以下问题:Java TransformType.values方法的具体用法?Java TransformType.values怎么用?Java TransformType.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType
的用法示例。
在下文中一共展示了TransformType.values方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseViewMapping
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
private ImmutableMap<TransformType, TRSRTransformation> parseViewMapping(
JsonObject parentObject,
JsonDeserializationContext context) {
if (!parentObject.has("transforms")) {
return EMPTY_MAP;
}
JsonElement viewElement = parentObject.get("transforms");
if (viewElement.isJsonPrimitive() && viewElement.getAsJsonPrimitive().isString()) {
String viewString = viewElement.getAsString();
ResourceLocation id = new ResourceLocation(viewString);
return PREDEFINED_TRANSFORMS.getOrDefault(id, EMPTY_MAP);
}
if (viewElement.isJsonObject()) {
JsonObject viewObject = viewElement.getAsJsonObject();
return parseTransformObject(context, viewObject);
}
ImmutableMap.Builder<TransformType, TRSRTransformation> result = ImmutableMap.builder();
TRSRTransformation onlyTransformation = context.deserialize(viewElement, TRSRTransformation.class);
for (TransformType transformType : TransformType.values()) {
result.put(transformType, onlyTransformation);
}
return result.build();
}
示例2: parseTransformObject
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
private ImmutableMap<TransformType, TRSRTransformation> parseTransformObject(
JsonDeserializationContext context,
JsonObject viewObject) {
ListMultimap<String, JsonElement> transformEntries = MultimapBuilder.hashKeys().arrayListValues(1).build();
for (Map.Entry<String, JsonElement> entry : viewObject.entrySet()) {
transformEntries.put(entry.getKey().toUpperCase(Locale.ROOT), entry.getValue());
}
ImmutableMap.Builder<TransformType, TRSRTransformation> result = ImmutableMap.builder();
for (TransformType transformType : TransformType.values()) {
String transformName = transformType.name().toUpperCase(Locale.ROOT);
List<JsonElement> entryList = transformEntries.get(transformName);
if (entryList.isEmpty()) {
continue;
}
if (entryList.size() > 1) {
throw new JsonParseException("Two transform entries for " + transformName);
}
JsonElement onlyElement = entryList.get(0);
result.put(transformType, context.deserialize(onlyElement, TRSRTransformation.class));
}
return result.build();
}
示例3: extractInventoryTransformsFromState
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
private static Map<TransformType, Matrix4f> extractInventoryTransformsFromState(IModelState state) {
final Map<TransformType, Matrix4f> output = Maps.newHashMap();
for (TransformType type : TransformType.values()) {
Matrix4f mat = null;
final Optional<TRSRTransformation> maybeTransform = state.apply(Optional.of(type));
if (maybeTransform.isPresent()) {
final TRSRTransformation transform = maybeTransform.get();
if (!transform.equals(TRSRTransformation.identity())) {
mat = TRSRTransformation.blockCornerToCenter(transform).getMatrix();
}
}
output.put(type, mat);
}
return output;
}
示例4: getTransforms
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
public static ImmutableMap<TransformType, TRSRTransformation> getTransforms(IModelState state)
{
ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();
for(TransformType type : TransformType.values())
{
Optional<TRSRTransformation> tr = state.apply(Optional.of(type));
if(tr.isPresent())
{
builder.put(type, tr.get());
}
}
return builder.build();
}
示例5: Baked
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
public Baked(ResourceLocation location, boolean perspective, IBakedModel base, ImmutableMap<String, IBakedModel> parts)
{
this.location = location;
this.base = base;
this.parts = parts;
if (base != null)
internalBase = base;
else
{
Iterator<IBakedModel> iter = parts.values().iterator();
if (iter.hasNext())
internalBase = iter.next();
else
throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + ".");
}
// Only changes the base model based on perspective, may recurse for parts in the future.
if(perspective && base instanceof IPerspectiveAwareModel)
{
IPerspectiveAwareModel perBase = (IPerspectiveAwareModel)base;
ImmutableMap.Builder<TransformType, Pair<Baked, TRSRTransformation>> builder = ImmutableMap.builder();
for(TransformType type : TransformType.values())
{
Pair<? extends IBakedModel, Matrix4f> p = perBase.handlePerspective(type);
IBakedModel newBase = p.getLeft();
builder.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(p.getRight())));
}
transforms = builder.build();
}
else
{
transforms = ImmutableMap.of();
}
}
示例6: bake
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
public BakedModelParams bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
final IModel modelNormal = getModel(normal);
final IBakedModel bakedNormal = modelNormal.bake(modelNormal.getDefaultState(), format, bakedTextureGetter);
final IModel modelOveflow = getModel(overflow);
final IBakedModel bakedOverflow = modelOveflow.bake(modelOveflow.getDefaultState(), format, bakedTextureGetter);
final Map<TransformType, Matrix4f> transforms = Maps.newHashMap();
for (TransformType tt : TransformType.values())
transforms.put(tt, bakedNormal.handlePerspective(tt).getRight());
return new BakedModelParams(transforms, bakedNormal, bakedOverflow, scaleFactor);
}
示例7: extractInventoryTransformsFromModel
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
private static Map<TransformType, Matrix4f> extractInventoryTransformsFromModel(IBakedModel model) {
final Map<TransformType, Matrix4f> output = Maps.newHashMap();
for (TransformType type : TransformType.values()) {
final Pair<? extends IBakedModel, Matrix4f> transform = model.handlePerspective(type);
output.put(type, transform.getRight());
}
return output;
}
示例8: process
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入方法依赖的package包/类
@Override
public PerspectiveAwareModel process(ImmutableMap<String, String> customData) {
final ModelUpdater updater = new ModelUpdater(customData);
final Optional<ResourceLocation> base = updater.get("base", ModelUpdater.MODEL_LOCATION, this.base);
final Map<TransformType, ResourceLocation> models = Maps.newHashMap();
for (TransformType layer : TransformType.values()) {
final ResourceLocation result = updater.get(layer.toString(), ModelUpdater.MODEL_LOCATION, this.models.get(layer));
if (result != null) models.put(layer, result);
}
return updater.hasChanged()? new PerspectiveAwareModel(base, models) : this;
}