use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project SilentGems by SilentChaos512.
the class ItemFoodSG method getModels.
@Override
public void getModels(Map<Integer, ModelResourceLocation> models) {
for (int i = 0; i < NAMES.length; ++i) {
String name = (SilentGems.RESOURCE_PREFIX + NAMES[i]).toLowerCase();
models.put(i, new ModelResourceLocation(name, "inventory"));
}
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Charset by CharsetMC.
the class ProxyClient method bakeModels.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void bakeModels(ModelBakeEvent event) {
if (prismModel != null) {
for (Orientation o : Orientation.values()) {
ModelResourceLocation location = new ModelResourceLocation("charset:laser_prism", "orientation=" + o.name().toLowerCase());
IBakedModel model = prismModel.bake(o.toTransformation(), DefaultVertexFormats.BLOCK, ModelLoader.defaultTextureGetter());
event.getModelRegistry().putObject(location, model);
}
}
// Patch jars to glow
for (EnumFacing facing : EnumFacing.VALUES) {
for (LaserColor color : LaserColor.VALUES) {
if (color == LaserColor.NONE)
continue;
IBlockState state = CharsetLaser.blockJar.getDefaultState().withProperty(CharsetLaser.LASER_COLOR, color).withProperty(Properties.FACING, facing);
ModelResourceLocation location = new ModelResourceLocation("charset:light_jar", "color=" + color.getName() + ",facing=" + facing.getName());
IBakedModel model = event.getModelRegistry().getObject(location);
VertexFormat format = new VertexFormat(DefaultVertexFormats.ITEM);
format.addElement(DefaultVertexFormats.TEX_2S);
if (model != null) {
SimpleMultiLayerBakedModel result = new SimpleMultiLayerBakedModel(model);
BlockRenderLayer layerPre = MinecraftForgeClient.getRenderLayer();
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
if (CharsetLaser.blockJar.canRenderInLayer(CharsetLaser.blockJar.getDefaultState(), layer)) {
ForgeHooksClient.setRenderLayer(layer);
for (int i = 0; i <= 6; i++) {
EnumFacing facingIn = (i < 6) ? EnumFacing.getFront(i) : null;
for (BakedQuad quadIn : model.getQuads(state, facingIn, 0)) {
result.addQuad(layer, facingIn, ModelTransformer.transform(quadIn, (quad, element, data) -> {
if (quad.getTintIndex() == 1 && element == DefaultVertexFormats.TEX_2S) {
return new float[] { 15f * 0x20 / 0xFFFF, 0, 0, 0 };
}
return data;
}, (bakedQuad -> {
if (bakedQuad.getTintIndex() == 1) {
return format;
} else {
return bakedQuad.getFormat();
}
})));
}
}
}
}
ForgeHooksClient.setRenderLayer(layerPre);
event.getModelRegistry().putObject(location, result);
}
}
}
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Charset by CharsetMC.
the class CharsetMiscShelf method onPostBake.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPostBake(ModelBakeEvent event) {
for (Boolean backValue : BlockShelf.BACK.getAllowedValues()) {
for (EnumFacing facingValue : Properties.FACING4.getAllowedValues()) {
event.getModelRegistry().putObject(new ModelResourceLocation("charset:shelf", "back=" + BlockShelf.BACK.getName(backValue) + ",facing=" + Properties.FACING4.getName(facingValue)), ModelShelf.INSTANCE);
}
}
event.getModelRegistry().putObject(new ModelResourceLocation("charset:shelf", "inventory"), ModelShelf.INSTANCE);
ModelShelf.shelfModel = RenderUtils.getModel(new ResourceLocation("charset:block/shelf"));
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Charset by CharsetMC.
the class CharsetPowerMechanical method onModelRegistry.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onModelRegistry(ModelRegistryEvent event) {
RegistryUtils.registerModel(itemAxle, 0, "charset:axle");
RegistryUtils.registerModel(itemCreativeGenerator, 0, "charset:creative_generator_mechanical");
RegistryUtils.registerModel(itemGearbox, 0, "charset:gearbox");
RegistryUtils.registerModel(itemSocket, 0, "charset:socket_mechanical");
ModelLoader.setCustomStateMapper(blockGearbox, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return new ModelResourceLocation("charset:gearbox", "inventory");
}
});
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project Charset by CharsetMC.
the class TileAxleRenderer method onModelBake.
@SubscribeEvent
public void onModelBake(ModelBakeEvent event) {
for (int i = 0; i < 3; i++) {
bakedModels[i] = event.getModelRegistry().getObject(new ModelResourceLocation("charset:axle", TAGS[i]));
}
ModelResourceLocation invLoc = new ModelResourceLocation("charset:axle", "inventory");
event.getModelRegistry().putObject(invLoc, new AxleItemModel(event.getModelRegistry().getObject(invLoc)));
}
Aggregations