use of net.minecraft.client.resources.model.ModelResourceLocation in project Galacticraft by micdoodle8.
the class ClientProxyCore method registerVariants.
@Override
public void registerVariants() {
Item fuel = Item.getItemFromBlock(GCBlocks.fuel);
ModelBakery.registerItemVariants(fuel, new ResourceLocation("galacticraftcore:fuel"));
ModelLoader.setCustomMeshDefinition(fuel, IItemMeshDefinitionCustom.create((ItemStack stack) -> fuelLocation));
ModelLoader.setCustomStateMapper(GCBlocks.fuel, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return fuelLocation;
}
});
Item oil = Item.getItemFromBlock(GCBlocks.crudeOil);
ModelBakery.registerItemVariants(oil, new ResourceLocation("galacticraftcore:oil"));
ModelLoader.setCustomMeshDefinition(oil, IItemMeshDefinitionCustom.create((ItemStack stack) -> oilLocation));
ModelLoader.setCustomStateMapper(GCBlocks.crudeOil, new StateMapperBase() {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return oilLocation;
}
});
Item nasaWorkbench = Item.getItemFromBlock(GCBlocks.nasaWorkbench);
ModelResourceLocation modelResourceLocation = new ModelResourceLocation("galacticraftcore:rocket_workbench", "inventory");
ModelLoader.setCustomModelResourceLocation(nasaWorkbench, 0, modelResourceLocation);
modelResourceLocation = new ModelResourceLocation("galacticraftcore:rocket_t1", "inventory");
for (int i = 0; i < 5; ++i) {
ModelLoader.setCustomModelResourceLocation(GCItems.rocketTier1, i, modelResourceLocation);
}
for (int i = 0; i < 4; ++i) {
modelResourceLocation = new ModelResourceLocation("galacticraftcore:buggy" + (i > 0 ? "_" + i : ""), "inventory");
ModelLoader.setCustomModelResourceLocation(GCItems.buggy, i, modelResourceLocation);
}
// for (PartialCanister container : ClientProxyCore.canisters)
// {
// modelResourceLocation = new ModelResourceLocation(container.getModID() + ":" + container.getBaseName() + "_0", "inventory");
// for (int i = 0; i < container.getItem().getMaxDamage(); ++i)
// {
// ModelLoader.setCustomModelResourceLocation(container.getItem(), i, modelResourceLocation);
// }
// }
modelResourceLocation = new ModelResourceLocation("galacticraftcore:flag", "inventory");
ModelLoader.setCustomModelResourceLocation(GCItems.flag, 0, modelResourceLocation);
ModelLoader.setCustomStateMapper(GCBlocks.oxygenDetector, new StateMap.Builder().ignore(BlockOxygenDetector.ACTIVE).build());
ModelLoader.setCustomStateMapper(GCBlocks.panelLighting, new StateMap.Builder().ignore(BlockPanelLighting.TYPE).build());
ModelLoader.setCustomStateMapper(GCBlocks.concealedRedstone, new StateMap.Builder().ignore(BlockConcealedRedstone.POWER).build());
ModelLoader.setCustomStateMapper(GCBlocks.concealedRepeater_Powered, new StateMap.Builder().ignore(BlockConcealedRepeater.FACING, BlockConcealedRepeater.DELAY, BlockConcealedRepeater.LOCKED).build());
ModelLoader.setCustomStateMapper(GCBlocks.concealedRepeater_Unpowered, new StateMap.Builder().ignore(BlockConcealedRepeater.FACING, BlockConcealedRepeater.DELAY, BlockConcealedRepeater.LOCKED).build());
ModelLoader.setCustomStateMapper(GCBlocks.concealedDetector, new StateMap.Builder().ignore(BlockConcealedDetector.FACING, BlockConcealedDetector.DETECTED).build());
}
use of net.minecraft.client.resources.model.ModelResourceLocation in project Galacticraft by micdoodle8.
the class RenderTier3Rocket method updateModel.
private void updateModel() {
if (rocketModel == null) {
Function<ResourceLocation, TextureAtlasSprite> textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
@Override
public TextureAtlasSprite apply(ResourceLocation input) {
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString());
}
};
ModelResourceLocation modelResourceLocation = new ModelResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "rocket_t3", "inventory");
rocketModel = (ItemModelRocketT3) FMLClientHandler.instance().getClient().getRenderItem().getItemModelMesher().getModelManager().getModel(modelResourceLocation);
}
}
use of net.minecraft.client.resources.model.ModelResourceLocation in project Galacticraft by micdoodle8.
the class ClientUtil method replaceModel.
public static void replaceModel(String modid, ModelBakeEvent event, String resLoc, String objLoc, List<String> visibleGroups, Class<? extends ModelTransformWrapper> clazz, IModelState parentState, String... variants) {
if (variants.length == 0) {
variants = new String[] { "inventory" };
}
IBakedModel newModel;
try {
newModel = modelFromOBJ(new ResourceLocation(modid, objLoc), visibleGroups, parentState);
if (clazz != null) {
newModel = clazz.getConstructor(IBakedModel.class).newInstance(newModel);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
for (String variant : variants) {
ModelResourceLocation modelResourceLocation = new ModelResourceLocation(modid + ":" + resLoc, variant);
IBakedModel object = event.modelRegistry.getObject(modelResourceLocation);
if (object != null) {
event.modelRegistry.putObject(modelResourceLocation, newModel);
}
}
}
use of net.minecraft.client.resources.model.ModelResourceLocation in project Galacticraft by micdoodle8.
the class AsteroidsModuleClient method registerVariants.
@Override
public void registerVariants() {
Item receiver = Item.getItemFromBlock(AsteroidBlocks.beamReceiver);
ModelResourceLocation modelResourceLocation = new ModelResourceLocation("galacticraftplanets:beam_receiver", "inventory");
ModelLoader.setCustomModelResourceLocation(receiver, 0, modelResourceLocation);
Item reflector = Item.getItemFromBlock(AsteroidBlocks.beamReflector);
modelResourceLocation = new ModelResourceLocation("galacticraftplanets:beam_reflector", "inventory");
ModelLoader.setCustomModelResourceLocation(reflector, 0, modelResourceLocation);
Item teleporter = Item.getItemFromBlock(AsteroidBlocks.shortRangeTelepad);
modelResourceLocation = new ModelResourceLocation("galacticraftplanets:telepad_short", "inventory");
ModelLoader.setCustomModelResourceLocation(teleporter, 0, modelResourceLocation);
modelResourceLocation = new ModelResourceLocation("galacticraftplanets:grapple", "inventory");
ModelLoader.setCustomModelResourceLocation(AsteroidsItems.grapple, 0, modelResourceLocation);
modelResourceLocation = new ModelResourceLocation("galacticraftplanets:rocket_t3", "inventory");
for (int i = 0; i < 5; ++i) {
ModelLoader.setCustomModelResourceLocation(AsteroidsItems.tier3Rocket, i, modelResourceLocation);
}
modelResourceLocation = new ModelResourceLocation("galacticraftplanets:astro_miner", "inventory");
ModelLoader.setCustomModelResourceLocation(AsteroidsItems.astroMiner, 0, modelResourceLocation);
}
use of net.minecraft.client.resources.model.ModelResourceLocation in project BuildCraft by BuildCraft.
the class BuildCraftTransport method registerModels.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void registerModels(ModelBakeEvent event) {
ModelResourceLocation mrl = new ModelResourceLocation("buildcrafttransport:pipeBlock");
event.modelRegistry.putObject(mrl, new PipeBlockModel());
PipeTransportRendererFluids.INSTANCE.modelBake();
for (ItemPipe itemPipe : BlockGenericPipe.pipes.keySet()) {
for (int i = 0; i < 17; i++) {
mrl = ModelHelper.getItemResourceLocation(itemPipe, "_" + i);
event.modelRegistry.putObject(mrl, PipeItemModel.create(itemPipe, i));
}
}
if (lensItem != null) {
for (int i = 0; i < 34; i++) {
mrl = ModelHelper.getItemResourceLocation(lensItem, "_" + i);
event.modelRegistry.putObject(mrl, LensPluggableModel.create(lensItem, i));
}
}
if (plugItem != null) {
mrl = ModelHelper.getItemResourceLocation(plugItem, "");
event.modelRegistry.putObject(mrl, PlugPluggableModel.create());
}
if (powerAdapterItem != null) {
mrl = ModelHelper.getItemResourceLocation(powerAdapterItem, "");
event.modelRegistry.putObject(mrl, ModelPowerAdapter.create());
}
if (pipeGate != null) {
mrl = ModelHelper.getItemResourceLocation(pipeGate, "");
event.modelRegistry.putObject(mrl, GateItemModel.INSTANCE);
}
if (facadeItem != null) {
mrl = ModelHelper.getItemResourceLocation(facadeItem, "");
event.modelRegistry.putObject(mrl, FacadeItemModel.INSTANCE);
}
}
Aggregations