Java Code Examples for net.minecraftforge.client.event.TextureStitchEvent

The following are top voted examples for showing how to use net.minecraftforge.client.event.TextureStitchEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: RunicArcana   File: StitchEventHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void textureStuff(TextureStitchEvent.Pre event)
{
    if (event.getMap() == Minecraft.getMinecraft().getTextureMapBlocks()) {

        for (LinkedList<IDustSymbol> category : ModDust.dustRegistry)
        {
            for(IDustSymbol dust : category)
            {

                String textureStr = dust.getTexture();
                int index = textureStr.lastIndexOf(".png");
                String texture =  "runicarcana:"+textureStr.substring(9,index);
                event.getMap().registerSprite(new ResourceLocation(texture));
            }

        }
    }

    event.getMap().registerSprite(new ResourceLocation(Reference.PARTICLE_RESOURCE_LOCATION + "WaterStrikeFX"));
    event.getMap().registerSprite(new ResourceLocation(Reference.PARTICLE_RESOURCE_LOCATION + "EarthStrikeFX"));
    event.getMap().registerSprite(new ResourceLocation(Reference.PARTICLE_RESOURCE_LOCATION + "AirStrikeFX"));

}
 
Example 2
Project: ExtraUtilities   File: TConEvents.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void handleStich(final TextureStitchEvent.Pre event) {
    if (event.map.getTextureType() != 0) {
        return;
    }
    TConIntegration.bedrock.setIcons(event.map.registerIcon("TConIntegration.bedrock"));
    TextureAtlasSprite sprite = new TextureBedrockLava("extrautils:bedrockFluid", "lava_still");
    event.map.setTextureEntry("extrautils:bedrockFluid", sprite);
    if (TConIntegration.bedrock != null) {
        TConIntegration.bedrock.setIcons((IIcon)sprite);
    }
    sprite = new TextureBedrockLava("extrautils:bedrockFluid_flowing", "lava_flow");
    if (event.map.setTextureEntry("extrautils:bedrockFluid_flowing", sprite) && TConIntegration.bedrock != null) {
        TConIntegration.bedrock.setFlowingIcon((IIcon)sprite);
    }
    sprite = new TextureUnstableLava("extrautils:unstableFluid", "water_still");
    event.map.setTextureEntry("extrautils:unstableFluid", sprite);
    if (TConIntegration.unstable != null) {
        TConIntegration.unstable.setIcons((IIcon)sprite);
    }
    sprite = new TextureUnstableLava("extrautils:unstableFluid_flowing", "water_flow");
    if (event.map.setTextureEntry("extrautils:unstableFluid_flowing", sprite) && TConIntegration.unstable != null) {
        TConIntegration.unstable.setFlowingIcon((IIcon)sprite);
    }
}
 
Example 3
Project: 4Space-5   File: FluidTexturesGC.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onStitch(TextureStitchEvent.Pre event)
{
    if (event.map.getTextureType() == 0)
    {
        AsteroidsModule.fluidMethaneGas.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/MethaneGas"));
        AsteroidsModule.fluidAtmosphericGases.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/AtmosphericGases"));
        AsteroidsModule.fluidLiquidMethane.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/LiquidMethane"));
        AsteroidsModule.fluidLiquidOxygen.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/LiquidOxygen"));
        AsteroidsModule.fluidOxygenGas.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/OxygenGas"));
        AsteroidsModule.fluidLiquidNitrogen.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/LiquidNitrogen"));
        AsteroidsModule.fluidLiquidArgon.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/LiquidArgon"));
        AsteroidsModule.fluidNitrogenGas.setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/NitrogenGas"));
        FluidRegistry.getFluid("hydrogen").setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/HydrogenGas"));
        FluidRegistry.getFluid("helium").setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/HeliumGas"));
        FluidRegistry.getFluid("argon").setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/ArgonGas"));
        FluidRegistry.getFluid("carbondioxide").setIcons(event.map.registerIcon(AsteroidsModule.ASSET_PREFIX + ":fluids/CarbonDioxideGas"));
    }
}
 
Example 4
Project: 4Space-5   File: LiquidTextures.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void postStitch(TextureStitchEvent.Post event)
{
    IIcon[] icons;
    if(replaceLava)
    {
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.flowing_lava);
        icons[0] = newTextures[2];
        icons[1] = newTextures[3];
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.lava);
        icons[0] = newTextures[2];
        icons[1] = newTextures[3];
    }
    if(replaceWater)
    {
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.flowing_water);
        icons[0] = newTextures[0];
        icons[1] = newTextures[1];
        icons = ReflectionManager.get(field_tex, IIcon[].class, Blocks.water);
        icons[0] = newTextures[0];
        icons[1] = newTextures[1];
    }
}
 
Example 5
Project: Toms-Mod   File: EventHandlerClient.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onRegisterTexture(TextureStitchEvent.Pre event) {
	TMLogger.info("Adding fluid textures");
	loadedLocations.clear();
	lcdFont = new LCDFontRenderer(mc.gameSettings, Configs.lcdFont, mc.renderEngine, false);
	TextureMap map = event.getMap();
	for (Entry<String, Fluid> entry : CoreInit.fluidList.entrySet()) {
		if (!loadedLocations.contains(entry.getValue().getFlowing())) {
			map.registerSprite(entry.getValue().getFlowing());
			loadedLocations.add(entry.getValue().getFlowing());
		}
		if (!loadedLocations.contains(entry.getValue().getStill())) {
			map.registerSprite(entry.getValue().getStill());
			loadedLocations.add(entry.getValue().getStill());
		}
	}
	textureIns++;
}
 
Example 6
Project: Factorization   File: FzModel.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void bakeModels(TextureStitchEvent.Post event) {
    final TextureMap map = event.map;
    Function<ResourceLocation,TextureAtlasSprite> lookup = new Function<ResourceLocation, TextureAtlasSprite>() {
        @Nullable
        @Override
        public TextureAtlasSprite apply(@Nullable ResourceLocation input) {
            if (input == null) return map.getAtlasSprite(null);
            return map.getAtlasSprite(input.toString());
        }
    };
    for (FzModel fzm : instances) {
        IModel rawModel = raws.get(fzm);
        if (rawModel == null) {
            fzm.model = null;
            continue;
        }
        fzm.model = rawModel.bake(fzm.trsrt, fzm.getFormat(), lookup);
    }
    raws.clear();
}
 
Example 7
Project: Factorization   File: RenderUtil.java   View source code 6 votes vote down vote up
/**
 * Use reflection to set all TextureAtlasSprites in a class.
 * All fields that are TextureAtlasSprites will be assigned, and any field whose type
 * is annotated with {@link LoadSprite} will be instantiated, assigned, and recursively loaded.
 * If a field name contains a '$', it will be replaced with a '/' for the icon's path name,
 * and also when recursion occurs.
 * @param domain    The domain of the textures.
 * @param toVisit   The object to visit. If it is a class, then its static fields will be loaded.
 * @param prefix    The path prefix. You likely want "".
 * @param event     Call this method during the TextureStitchEvent.Pre event.
 * @see LoadSprite
 * @throws RuntimeException on any error
 */
public static void loadSprites(String domain, Object toVisit, String prefix, TextureStitchEvent.Pre event)  {
    Class base;
    Object instance;
    if (toVisit instanceof Class) {
        base = (Class) toVisit;
        instance = null;
    } else {
        base = toVisit.getClass();
        instance = toVisit;
    }
    try {
        load0(domain, base, instance, prefix, event);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
 
Example 8
Project: Factorization   File: RenderUtil.java   View source code 6 votes vote down vote up
private static void load0(String domain, Class base, Object instance, String prefix, TextureStitchEvent.Pre event) throws IllegalAccessException, InstantiationException {
    for (Field field : base.getFields()) {
        String name = field.getName().replace("$", "/");

        Class<?> type = field.getType();
        boolean staticField = (field.getModifiers() & Modifier.STATIC) != 0;
        boolean staticAccess = instance == null;
        if (staticField != staticAccess) continue;
        Object set;
        if (type == TextureAtlasSprite.class) {
            ResourceLocation location = new ResourceLocation(domain, prefix + name);
            set = event.map.registerSprite(location);
        } else if (canVisit(type)) {
            set = type.newInstance();
            load0(domain, type, set, prefix + name + "/", event);
        } else {
            continue;
        }
        field.set(instance, set);
    }
}
 
Example 9
Project: FlowstoneEnergy   File: TextureStitchEventHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onPreTextureStiching(TextureStitchEvent.Pre event){
    if (event.map == FMLClientHandler.instance().getClient().getTextureMapBlocks()){
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/machine_Top"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/machine_Bottom"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/oreTumbler_Front"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/oreTumbler_Front_Active"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/flowstoneBottler_Front"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/flowstoneBottler_Front_Activate"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/furnace_Front"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/furnace_Front_Active"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/lumberMill_Front"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/lumberMill_Front_Active"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/metalMixer_Front"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/metalMixer_Front_Active"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/cooler_Front"));
        event.map.registerSprite(new ResourceLocation("flowstoneenergy:blocks/machines/cooler_Front_Active"));
    }
    
}
 
Example 10
Project: ShadowsOfPhysis   File: TextureMapHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onStitch(TextureStitchEvent.Pre event) {
	Map<String, TextureAtlasSprite> iconlist = null;
	if (event.map.getTextureType() == 0) {
		iconlist = TextureHelper.addedBlockIcons;
	}
	else if (event.map.getTextureType() == 1) {
		iconlist = TextureHelper.addedItemIcons;
	}
	
	if (iconlist != null) {
		for (Entry<String, TextureAtlasSprite> entry : iconlist.entrySet()) {
			//Physis.logger.info("Adding "+entry.getKey()+" to the map");
			event.map.setTextureEntry(entry.getKey(), entry.getValue());
		}
	}
}
 
Example 11
Project: OpenBlocks   File: CanvasTextureManager.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onTextureStitchEvent(TextureStitchEvent.Pre evt) {
	freeTextures.clear();
	usedTextures.clear();
	peakRejectedAllocations = 0;
	textureLimitReached = false;

	CanvasSideState.onTextureReload();

	if (DEBUG) Log.info("Allocating %s textures", Config.canvasPoolSize);

	final TextureMap map = evt.getMap();
	final EmptyTextureData emptyTexture = new EmptyTextureData();
	for (int i = 0; i < Config.canvasPoolSize; i++) {
		final CanvasTexture entry = new CanvasTexture(OpenBlocks.location("canvas-" + i), emptyTexture);
		map.setTextureEntry(entry);
		freeTextures.push(entry);
	}
}
 
Example 12
Project: Agriculture   File: ExtraIcons.java   View source code 6 votes vote down vote up
@ForgeSubscribe
public void onItemIconRegister(final TextureStitchEvent.Pre evt)
{
    System.out.println("textureType = " + evt.map.textureType);
    if (evt.map.textureType == 1)
    {
        ExtraIcons.ovenSlotOpen = evt.map.registerIcon("agriculture:gui/OvenSlotOpen");
        ExtraIcons.ovenSlotClosed = evt.map.registerIcon("agriculture:gui/OvenSlotClosed");
    }
    else
    {
        ExtraIcons.liquidMilk = evt.map.registerIcon("agriculture:milk");
        ExtraIcons.liquidBeer = evt.map.registerIcon("agriculture:beer");
        ExtraIcons.liquidHotcocoa = evt.map.registerIcon("agriculture:hotcocoa");
        ExtraIcons.vineger = evt.map.registerIcon("agriculture:vinegar");
        ExtraIcons.liquidVodka = evt.map.registerIcon("agriculture:vodka");
        ExtraIcons.liquidCider = evt.map.registerIcon("agriculture:cider");
    }
}
 
Example 13
Project: genera   File: EventHandler.java   View source code 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void stitch(TextureStitchEvent.Pre event){
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/wood/body"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/wood/wing_bottom"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/wood/wing_top"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/cave/body"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/cave/wing_bottom"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/cave/wing_top"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/mountain/body"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/mountain/wing_bottom"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID,"entity/faerie/mountain/wing_top"));
}
 
Example 14
Project: Bewitchment   File: ClientProxy.java   View source code 5 votes vote down vote up
@SubscribeEvent
public static void stitchEventPre(TextureStitchEvent.Pre event) {
	event.getMap().registerSprite(ResourceLocations.STEAM);
	event.getMap().registerSprite(ResourceLocations.BEE);
	event.getMap().registerSprite(ResourceLocations.FLAME);
	event.getMap().registerSprite(ResourceLocations.GRAY_WATER);
}
 
Example 15
Project: Anima-Mundi   File: ParticleManager.java   View source code 5 votes vote down vote up
@SubscribeEvent
public static void registerParticles(TextureStitchEvent.Pre event)
{
	stitchParticle("particle/glow_par", event.getMap());
	stitchParticle("items/sword_glow_top", event.getMap());
	stitchParticle("items/sword_glow_bottom", event.getMap());
}
 
Example 16
Project: connor41-etfuturum2   File: ClientEventHandler.java   View source code 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre event) {
	if (EtFuturum.enablePrismarine)
		if (event.map.getTextureType() == 0) {
			TextureAtlasSprite icon = new PrismarineIcon("prismarine_rough");
			if (event.map.setTextureEntry("prismarine_rough", icon))
				((PrismarineBlocks) ModBlocks.prismarine).setIcon(0, icon);
			else
				((PrismarineBlocks) ModBlocks.prismarine).setIcon(0, event.map.registerIcon("prismarine_rough"));
		}
}
 
Example 17
Project: Thermionics   File: ClientProxy.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Pre event) {
	event.getMap().registerSprite(new ResourceLocation("thermionics", "fluids/clear_hootch"));
	event.getMap().registerSprite(new ResourceLocation("thermionics", "fluids/medium_hootch"));
	event.getMap().registerSprite(new ResourceLocation("thermionics", "fluids/dark_hootch"));
	event.getMap().registerSprite(new ResourceLocation("thermionics", "fluids/clear_spirit"));
	event.getMap().registerSprite(new ResourceLocation("thermionics", "fluids/medium_spirit"));
	event.getMap().registerSprite(new ResourceLocation("thermionics", "fluids/dark_spirit"));
}
 
Example 18
Project: SimpleTubes   File: TextureRegistry.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStich(TextureStitchEvent.Pre event) {
	for (ResourceLocation loc : textureList) {
		event.getMap().registerSprite(loc);
	}

}
 
Example 19
Project: uniquecrops   File: UCEventHandlerClient.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void loadTextures(TextureStitchEvent.Pre event) {
	
	try {
		Map<String, TextureAtlasSprite> mapRegisteredSprites = ReflectionHelper.getPrivateValue(TextureMap.class, event.getMap(), FIELD);
		for (int i = 1; i < 6; i++)
			mapRegisteredSprites.put("uniquecrops:blocks/invisibilia" + i, new UCInvisibiliaStitch("uniquecrops:blocks/invisibilia" + i));
		mapRegisteredSprites.put("uniquecrops:blocks/dyeplant5", new UCDyePlantStitch("uniquecrops:blocks/dyeplant5"));
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 20
Project: Mods   File: TF2EventsClient.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void registerIcons(TextureStitchEvent.Pre event) {
	// if(event.getMap().getGlTextureId()==1){
	// System.out.println("Registered icon:
	// "+event.getMap().getGlTextureId());
	pelletIcon = event.getMap().registerSprite(new ResourceLocation(TF2weapons.MOD_ID, "items/pellet3"));
	event.getMap().registerSprite(new ResourceLocation(TF2weapons.MOD_ID, "items/ammo_belt_empty"));
	event.getMap().registerSprite(new ResourceLocation(TF2weapons.MOD_ID, "items/refill_empty"));
	event.getMap().registerSprite(new ResourceLocation(TF2weapons.MOD_ID, "items/weapon_empty_0"));
	event.getMap().registerSprite(new ResourceLocation(TF2weapons.MOD_ID, "items/weapon_empty_1"));
	event.getMap().registerSprite(new ResourceLocation(TF2weapons.MOD_ID, "items/weapon_empty_2"));
	// }
}
 
Example 21
Project: ExtraUtilities   File: EventHandlerClient.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void registerParticle(final TextureStitchEvent.Pre event) {
    if (event.map.getTextureType() != 0) {
        return;
    }
    EventHandlerClient.particle = event.map.registerIcon("extrautils:particle");
}
 
Example 22
Project: Thelta   File: ClientContext.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTexturePreStitch(TextureStitchEvent.Pre pre) {
	state = ContextState.LoadingTextures;
	currentTextureMap = pre.getMap();
	for (AutoModel model : autoModels) {
		for (ResourceLocation location : model.getTextures()) {
			currentTextureMap.registerSprite(location);
		}
	}
	for (TheltaModule module : modules) {
		module.loadTextures(this);
	}
	state = ContextState.Intermediary;
}
 
Example 23
Project: TRHS_Club_Mod_2016   File: ForgeHooksClient.java   View source code 5 votes vote down vote up
public static void onTextureStitchedPost(TextureMap map)
{
    MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));

    FluidRegistry.WATER.setIcons(BlockLiquid.func_149803_e("water_still"), BlockLiquid.func_149803_e("water_flow"));
    FluidRegistry.LAVA.setIcons(BlockLiquid.func_149803_e("lava_still"), BlockLiquid.func_149803_e("lava_flow"));
}
 
Example 24
Project: ItsJustaCharm1.10.2Dead   File: ParticleHandler.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent event) {
	map = event.getMap();

	for (ModParticles particle : ModParticles.values()) {
		particle.registerSprite();
	}

}
 
Example 25
Project: FFS   File: FancyFluidStorage.java   View source code 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre event) {
	FluidHelper.initTextures(event.getMap());

	OverlayRenderHandler.overlayTexture = event.getMap().registerSprite(new ResourceLocation("ffs", "blocks/overlay/tank_overlay_anim"));
}
 
Example 26
Project: ChameleonCreepersMod   File: EventHandlerClient.java   View source code 5 votes vote down vote up
@SubscribeEvent
void onLoadResourcepack(TextureStitchEvent.Post evt)
{
    try
    {
        RenderChameleonCreeper.convertTextureToGrayScale();
    }
    catch (IOException ie)
    {
        System.out.println("Couldn't convert creeper texture to grayscale");
        ie.printStackTrace();
    }
}
 
Example 27
Project: Aether-Legacy   File: AetherClientEvents.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStichedEvent(TextureStitchEvent event)
{
	for (int i = 0; i < InventoryAccessories.EMPTY_SLOT_NAMES.length; ++i)
	{
		event.getMap().registerSprite(new ResourceLocation("aether_legacy", "items/slots/" + InventoryAccessories.EMPTY_SLOT_NAMES[i]));
	}
}
 
Example 28
Project: CodeChickenLib   File: CCBlockStateLoader.java   View source code 5 votes vote down vote up
@SubscribeEvent (priority = EventPriority.HIGHEST)
public void onTextureStitchPre(TextureStitchEvent.Pre event) {
    if (!event.getMap().getBasePath().equals("textures")) {
        CCLLog.log(Level.WARN, "Someone is calling the TextureStitchEvent.Pre for a texture map that is NOT vanillas.");
        CCLLog.log(Level.WARN, "This is a bug. There is no sense of different atlas's in vanilla so this event is NOT generic and specific to the vanilla atlas.");
        CCLLog.log(Level.WARN, "Im catching this so things don't explode. Fix your shit!");
        CCLLog.big(Level.WARN, 100, "");
        return;
    }
    grabLoader();

    loadBakery(modelLoader.blockModelShapes.getBlockStateMapper(), modelLoader.resourceManager);

    toBake.values().forEach(model -> model.getTextures().forEach(event.getMap()::registerSprite));
}
 
Example 29
Project: CodeChickenLib   File: TextureUtils.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void textureLoad(TextureStitchEvent.Pre event) {
    if (!event.getMap().getBasePath().equals("textures")) {
        CCLLog.log(Level.WARN, "Someone is calling the TextureStitchEvent.Pre for a texture map that is NOT vanillas.");
        CCLLog.log(Level.WARN, "This is a bug. There is no sense of different atlas's in vanilla so this event is NOT generic and is specific to the vanilla atlas.");
        CCLLog.log(Level.WARN, "Im catching this so things don't explode. Fix your shit!");
        CCLLog.big(Level.WARN, 100, "");
        return;
    }
    for (IIconRegister reg : iconRegisters) {
        reg.registerIcons(event.getMap());
    }
}
 
Example 30
Project: Toms-Mod   File: EventHandler.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStitchEventPost(TextureStitchEvent.Post event) {
	if (Config.reloadColours) {
		Logging.logInfo("Skipping the first generation of blockcolours, models are not loaded yet", (Object[]) null);
	} else {
		this.mw.reloadBlockColours();
	}
}
 
Example 31
Project: geomastery   File: ClientEvents.java   View source code 5 votes vote down vote up
/** Registers ICONS for container slot backgrounds. */
@SubscribeEvent
public void textureStich(TextureStitchEvent.Pre event) {

    event.getMap().registerSprite(BACKPACK_TEXTURE);
    event.getMap().registerSprite(YOKE_SLOT);
}
 
Example 32
Project: TMT-Refraction   File: EventHandlerClient.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void stitch(TextureStitchEvent.Pre event) {
	event.getMap().registerSprite(new ResourceLocation(Constants.MOD_ID, "particles/glow"));
	event.getMap().registerSprite(new ResourceLocation(Constants.MOD_ID, "particles/star"));
	event.getMap().registerSprite(new ResourceLocation(Constants.MOD_ID, "particles/sparkle_blurred"));
	event.getMap().registerSprite(new ResourceLocation(Constants.MOD_ID, "particles/lens_flare_1"));
}
 
Example 33
Project: Factorization   File: FlatMod.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void loadModels(TextureStitchEvent.Pre event) {
    IModelMaker modelMaker = new IModelMaker() {
        @Nullable
        @Override
        public IFlatModel getModel(ResourceLocation... url) {
            return new FlatModel(url);
        }
    };
    for (FlatFace face : Flat.getAllSamples()) {
        face.loadModels(modelMaker);
    }
}
 
Example 34
Project: Factorization   File: FzModel.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void loadModels(TextureStitchEvent.Pre event) {
    raws.clear();
    //event.modelBakery.reg
    Minecraft mc = Minecraft.getMinecraft();

    IResourceManager irm = mc.getResourceManager();
    HashSet<ResourceLocation> textures = new HashSet<ResourceLocation>();
    for (FzModel fzm : instances) {
        fzm.model = null;
        ResourceLocation location = fzm.getLocation(irm);
        IModel rawModel = null;
        try {
            if (location != null) {
                rawModel = ModelLoaderRegistry.getModel(location);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (rawModel == null) {
            rawModel = ModelLoaderRegistry.getMissingModel();
        }
        raws.put(fzm, rawModel);
        Collection<ResourceLocation> modelTextures = rawModel.getTextures();
        textures.addAll(modelTextures);
    }
    for (ResourceLocation texture : textures) {
        event.map.registerSprite(texture);
    }
}
 
Example 35
Project: Factorization   File: FactorizationClientProxy.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStitch(TextureStitchEvent.Pre event) {
    RenderUtil.loadSprites("factorization", FzIcons.class, "", event);
    RenderUtil.loadSprites("factorization", BarrelModel.class, "blocks/storage/", event);
    try {
        BarrelModel.template = (IRetexturableModel) ModelLoaderRegistry.getModel(new ResourceLocation("factorization:block/barrel_template"));
        IModel socketBase = ModelLoaderRegistry.getModel(new ResourceLocation("factorization:block/socket"));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
Example 36
Project: Nuclear-Foundation   File: ClientProxy.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onTextureStitchPre(TextureStitchEvent.Pre event) {
    // Register all of our sprites so that we can use them for the model
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID, "blocks/uranium_bits"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID, "blocks/thorium_bits"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID, "blocks/blazonium_bits"));
    event.getMap().registerSprite(new ResourceLocation(Constants.MODID, "blocks/terminium_bits"));
}
 
Example 37
Project: LyokoEnergistics   File: TextureEvent.java   View source code 5 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onPostTextureStitch(TextureStitchEvent.Post event)
{
	if(event.map.getTextureType() == 0)
	{
		ModFluid.DigitalSea.setIcons(ModBlock.digitalSea.getBlockTextureFromSide(1), ModBlock.digitalSea.getBlockTextureFromSide(2));
	}
}
 
Example 38
Project: CauldronGit   File: ForgeHooksClient.java   View source code 5 votes vote down vote up
public static void onTextureStitchedPost(TextureMap map)
{
    MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));

    FluidRegistry.WATER.setIcons(BlockLiquid.getLiquidIcon("water_still"), BlockLiquid.getLiquidIcon("water_flow"));
    FluidRegistry.LAVA.setIcons(BlockLiquid.getLiquidIcon("lava_still"), BlockLiquid.getLiquidIcon("lava_flow"));
}
 
Example 39
Project: EnderCore   File: IconUtil.java   View source code 5 votes vote down vote up
@Mod.EventHandler
@SubscribeEvent
public void onIconLoad(TextureStitchEvent.Pre event) {
  for (IIconProvider reg : iconProviders) {
    if (reg.getTextureType() == event.map.getTextureType()) {
      reg.registerIcons(event.map);
    }
  }
}
 
Example 40
Project: NOVA-Core   File: RenderUtility.java   View source code 5 votes vote down vote up
/**
 * Handles NOVA texture registration.
 * @param event Event
 */
@SubscribeEvent
public void preTextureHook(TextureStitchEvent.Pre event) {
	if (event.map == Minecraft.getMinecraft().getTextureMapBlocks()) {
		Game.render().blockTextures.forEach(t -> registerIcon(t, event));
		Game.render().itemTextures.forEach(t -> registerIcon(t, event));
		//TODO: This is HACKS. We should create custom sprite sheets for entities.
		Game.render().entityTextures.forEach(t -> registerIcon(t, event));
	}
}