Java 类net.minecraft.client.renderer.block.model.VariantList 实例源码
项目:Backmemed
文件:Selector.java
public Selector(ICondition conditionIn, VariantList variantListIn)
{
if (conditionIn == null)
{
throw new IllegalArgumentException("Missing condition for selector");
}
else if (variantListIn == null)
{
throw new IllegalArgumentException("Missing variant for selector");
}
else
{
this.condition = conditionIn;
this.variantList = variantListIn;
}
}
项目:CustomWorldGen
文件:ModelLoader.java
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
ModelResourceLocation variant = (ModelResourceLocation) modelLocation;
ModelBlockDefinition definition = loader.getModelBlockDefinition(variant);
try
{
VariantList variants = definition.getVariant(variant.getVariant());
return new WeightedRandomModel(variant, variants);
}
catch(MissingVariantException e)
{
if(definition.hasMultipartData())
{
return new MultipartModel(new ResourceLocation(variant.getResourceDomain(), variant.getResourcePath()), definition.getMultipartData());
}
throw e;
}
}
项目:CustomWorldGen
文件:Selector.java
public Selector(ICondition conditionIn, VariantList variantListIn)
{
if (conditionIn == null)
{
throw new IllegalArgumentException("Missing condition for selector");
}
else if (variantListIn == null)
{
throw new IllegalArgumentException("Missing variant for selector");
}
else
{
this.condition = conditionIn;
this.variantList = variantListIn;
}
}
项目:ExpandedRailsMod
文件:Selector.java
public Selector(ICondition conditionIn, VariantList variantListIn)
{
if (conditionIn == null)
{
throw new IllegalArgumentException("Missing condition for selector");
}
else if (variantListIn == null)
{
throw new IllegalArgumentException("Missing variant for selector");
}
else
{
this.condition = conditionIn;
this.variantList = variantListIn;
}
}
项目:Backmemed
文件:Multipart.java
public Set<VariantList> getVariants()
{
Set<VariantList> set = Sets.<VariantList>newHashSet();
for (Selector selector : this.selectors)
{
set.add(selector.getVariantList());
}
return set;
}
项目:CustomWorldGen
文件:Multipart.java
public Set<VariantList> getVariants()
{
Set<VariantList> set = Sets.<VariantList>newHashSet();
for (Selector selector : this.selectors)
{
set.add(selector.getVariantList());
}
return set;
}
项目:ExpandedRailsMod
文件:Multipart.java
public Set<VariantList> getVariants()
{
Set<VariantList> set = Sets.<VariantList>newHashSet();
for (Selector selector : this.selectors)
{
set.add(selector.getVariantList());
}
return set;
}
项目:Backmemed
文件:Selector.java
public VariantList getVariantList()
{
return this.variantList;
}
项目:Backmemed
文件:Selector.java
public Selector deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
return new Selector(this.getWhenCondition(jsonobject), (VariantList)p_deserialize_3_.deserialize(jsonobject.get("apply"), VariantList.class));
}
项目:CustomWorldGen
文件:ModelLoader.java
public WeightedRandomModel(ResourceLocation parent, VariantList variants) throws Exception
{
this.variants = variants.getVariantList();
ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder();
for (Variant v : this.variants)
{
ResourceLocation loc = v.getModelLocation();
locations.add(loc);
/*
* Vanilla eats this, which makes it only show variants that have models.
* But that doesn't help debugging, so throw the exception
*/
IModel model;
if(loc.equals(MODEL_MISSING))
{
// explicit missing location, happens if blockstate has "model"=null
model = ModelLoaderRegistry.getMissingModel();
}
else
{
model = ModelLoaderRegistry.getModel(loc);
}
// FIXME: is this the place? messes up dependency and texture resolution
model = v.process(model);
for(ResourceLocation location : model.getDependencies())
{
ModelLoaderRegistry.getModelOrMissing(location);
}
//FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e);
textures.addAll(model.getTextures()); // Kick this, just in case.
models.add(model);
builder.add(Pair.of(model, v.getState()));
}
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
{
// FIXME: log this?
IModel missing = ModelLoaderRegistry.getMissingModel();
models.add(missing);
builder.add(Pair.<IModel, IModelState>of(missing, TRSRTransformation.identity()));
}
defaultState = new MultiModelState(builder.build());
}
项目:CustomWorldGen
文件:Selector.java
public VariantList getVariantList()
{
return this.variantList;
}
项目:CustomWorldGen
文件:Selector.java
public Selector deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
return new Selector(this.getWhenCondition(jsonobject), (VariantList)p_deserialize_3_.deserialize(jsonobject.get("apply"), VariantList.class));
}
项目:Alchemy
文件:WardrobeModelLoader.java
@Alpha
@Override
public IModel loadModel(ResourceLocation resourceLocation) throws Exception {
try {
ModelResourceLocation modelLocation;
if (resourceLocation instanceof ModelResourceLocation)
modelLocation = (ModelResourceLocation) resourceLocation;
else
return null;
if (!modelLocation.getVariant().equals("inventory") && !modelLocation.getResourcePath().endsWith("_loc")) {
List<Variant> list = Lists.newLinkedList();
ModelRotation rotation = ModelRotation.X0_Y0;
switch (Tool.get(modelLocation.getVariant(), "facing=([a-z]*)")) {
case "east":
rotation = ModelRotation.X0_Y270;
break;
case "north":
rotation = ModelRotation.X0_Y180;
break;
case "west":
rotation = ModelRotation.X0_Y90;
break;
}
list.add(new Variant(new ModelResourceLocation(modelLocation.getResourceDomain() + ":" +
modelLocation.getResourcePath() + "_loc", modelLocation.getVariant()),
rotation, false, 1));
VariantList variantList = new VariantList(list);
return new ModelLoader.WeightedRandomModel(modelLocation, variantList);
}
modelLocation = new ModelResourceLocation(modelLocation.getResourceDomain() +
modelLocation.getResourcePath().replace("_loc", ""), modelLocation.getVariant());
String name = modelLocation.getVariant().contains("part=head") ? "head" : "foot";
String rely = Tool.isEmptyOr(Tool.get(modelLocation.getVariant(), "rely=([a-z]*)"), "null");
try (IResource resource = Minecraft.getMinecraft().getResourceManager()
.getResource(new ResourceLocation("skin:models/wardrobe_" + rely + "_" + name + ".json"))) {
String json = Joiner.on('\n').join(IOUtils.readLines(resource.getInputStream(), Charsets.UTF_8));
try (Reader reader = new StringReader(WoodType.conversion.apply(json, Tool.get(
modelLocation.getResourcePath(), "_(.*?_T_.*?_T_[0-9]*_T_.*?_T_.*?_T_[0-9]*)")))) {
ModelBlock modelBlock = ModelBlock.deserialize(reader);
return modelLocation.getVariant().equals("inventory") ? new ItemLayerModel(modelBlock) :
ModelLoader.VanillaLoader.INSTANCE.getLoader().new VanillaModelWrapper(modelLocation,
modelBlock, false, ModelBlockAnimation.defaultModelBlockAnimation);
}
}
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
项目:ExpandedRailsMod
文件:Selector.java
public VariantList getVariantList()
{
return this.variantList;
}
项目:ExpandedRailsMod
文件:Selector.java
public Selector deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
return new Selector(this.getWhenCondition(jsonobject), (VariantList)p_deserialize_3_.deserialize(jsonobject.get("apply"), VariantList.class));
}