net.minecraftforge.client.event.TextureStitchEvent Java Examples
The following examples show how to use
net.minecraftforge.client.event.TextureStitchEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientProxy.java From BigReactors with MIT License | 6 votes |
@Override @SideOnly(Side.CLIENT) @SubscribeEvent public void registerIcons(TextureStitchEvent.Pre event) { if(event.map.getTextureType() == BeefIconManager.TERRAIN_TEXTURE) { BigReactors.registerNonBlockFluidIcons(event.map); GuiIcons.registerIcons(event.map); CommonBlockIcons.registerIcons(event.map); } // else if(event.map.textureType == BeefIconManager.ITEM_TEXTURE) { } // Reset any controllers which have TESRs which cache displaylists with UV data in 'em // This is necessary in case a texture pack changes UV coordinates on us Set<MultiblockControllerBase> controllers = MultiblockRegistry.getControllersFromWorld(FMLClientHandler.instance().getClient().theWorld); if(controllers != null) { for(MultiblockControllerBase controller: controllers) { if(controller instanceof MultiblockTurbine) { ((MultiblockTurbine)controller).resetCachedRotors(); } } } }
Example #2
Source File: DynamicTextureMap.java From VanillaFix with MIT License | 6 votes |
public void init() { deleteGlTexture(); int maximumTextureSize = Minecraft.getGLMaximumTextureSize(); stitcher = new DynamicStitcher(maximumTextureSize, maximumTextureSize, 0, mipmapLevels); listAnimatedSprites.clear(); initMissingImage(); missingImage.generateMipmaps(mipmapLevels); spritesNeedingUpload.add(missingImage); stitcher.addSprite(missingImage); TextureUtil.allocateTextureImpl(getGlTextureId(), mipmapLevels, stitcher.getImageWidth(), stitcher.getImageHeight()); LOGGER.info("Created {}x{} '{}' atlas", stitcher.getImageWidth(), stitcher.getImageHeight(), basePath); EventUtil.postEventAllowingErrors(new TextureStitchEvent.Pre(this)); ModelLoader.White.INSTANCE.register(this); mapRegisteredSprites.put("builtin/white", ModelLoader.White.INSTANCE); // TODO: why is this necessary ModelDynBucket.LoaderDynBucket.INSTANCE.register(this); EventUtil.postEventAllowingErrors(new TextureStitchEvent.Post(this)); }
Example #3
Source File: GibsModelRegistry.java From Valkyrien-Skies with Apache License 2.0 | 6 votes |
public static void registerTextures(TextureStitchEvent event) { System.out.println( "Valkyrien Skies got a register textures pre event! " + NAMES_TO_RESOURCE_LOCATION .size()); for (ResourceLocation location : NAMES_TO_RESOURCE_LOCATION.values()) { try { // Get the model so that registry will remember to register its textures. IModel model = ModelLoaderRegistry.getModel(location); Collection<ResourceLocation> resourceLocations = model.getTextures(); for (ResourceLocation texture : resourceLocations) { // Register the found texture into the texture map. event.getMap() .registerSprite(texture); } } catch (Exception e) { e.printStackTrace(); } } }
Example #4
Source File: RenderUtility.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Handles NOVA texture update. * @param event Event */ @SubscribeEvent public void textureHook(TextureStitchEvent.Post event) { Game.render().blockTextures.forEach(this::updateTexureDimensions); Game.render().itemTextures.forEach(this::updateTexureDimensions); Game.render().entityTextures.forEach(this::updateTexureDimensions); }
Example #5
Source File: ArtifactServerEventHandler.java From Artifacts with MIT License | 5 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public void registerTextures(TextureStitchEvent.Pre event) { //System.out.println("before: " + event.map.getTextureExtry("artifacts:calendar")); //TextureMap tm = (TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationItemsTexture); //boolean re = tm.setTextureEntry("artifacts:calendar", new TextureCalendar("artifacts:calendar")); //System.out.println("Able to register calendar texture: " + re); //ItemCalendar.instance.setTextureName("artifacts:calendar"); //System.out.println(event.map.getTextureExtry("artifacts:calendar")); if(event.map.getTextureType() == 1 ) { event.map.setTextureEntry("artifacts:calendar", ClientProxy.calendar = new TextureCalendar("artifacts:calendar")); } }
Example #6
Source File: ModuleComputerCraft.java From OpenPeripheral-Addons with MIT License | 5 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public void textureHook(TextureStitchEvent.Pre event) { if (event.map.getTextureType() == 0) { Icons.narcissiticTurtle = event.map.registerIcon("computercraft:turtle"); Icons.sensorTurtle = event.map.registerIcon("openperipheraladdons:sensorturtle"); } }
Example #7
Source File: WRAddonEventHandler.java From WirelessRedstone with MIT License | 5 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public void onTextureLoad(TextureStitchEvent.Pre event) { if (event.map.getTextureType() == 1) { RemoteTexManager.load(event.map); TriangTexManager.loadTextures(); } }
Example #8
Source File: TextureSubmap.java From Chisel with GNU General Public License v2.0 | 5 votes |
@SubscribeEvent public void TexturesStitched(TextureStitchEvent.Post event) { for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { icons[y * width + x] = new TextureVirtual(icon, width, height, x, y); } } }
Example #9
Source File: LiquidTextures.java From CodeChickenCore with MIT License | 5 votes |
@SubscribeEvent public void postStitch(TextureStitchEvent.Post event) { Map<String, TextureAtlasSprite> uploadedSprites = event.map.mapUploadedSprites; if (replaceWater) { uploadedSprites.put("minecraft:blocks/water_still", newTextures[0]); uploadedSprites.put("minecraft:blocks/water_flow", newTextures[1]); } if (replaceLava) { uploadedSprites.put("minecraft:blocks/lava_still", newTextures[2]); uploadedSprites.put("minecraft:blocks/lava_flow", newTextures[3]); } }
Example #10
Source File: ClientEventHandler.java From Et-Futurum with The Unlicense | 5 votes |
@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 #11
Source File: RenderUtility.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Handles NOVA texture update. * @param event Event */ @SubscribeEvent public void textureHook(TextureStitchEvent.Post event) { Game.render().blockTextures.forEach(this::updateTexureDimensions); Game.render().itemTextures.forEach(this::updateTexureDimensions); Game.render().entityTextures.forEach(this::updateTexureDimensions); }
Example #12
Source File: RenderUtility.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Handles NOVA texture registration. * @param event Event */ @SubscribeEvent public void preTextureHook(TextureStitchEvent.Pre event) { if (event.map.getTextureType() == 0) { Game.render().blockTextures.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)); } else if (event.map.getTextureType() == 1) { Game.render().itemTextures.forEach(t -> registerIcon(t, event)); } }
Example #13
Source File: RenderUtility.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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)); } }
Example #14
Source File: RenderUtility.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
/** * Handles NOVA texture registration. * @param event Event */ @SubscribeEvent public void preTextureHook(TextureStitchEvent.Pre event) { if (event.getMap() == Minecraft.getMinecraft().getTextureMapBlocks()) { Game.render().blockTextures.forEach(t -> registerIcon(t, event)); Game.render().itemTextures.forEach(t -> registerIcon(t, event)); Game.render().entityTextures.forEach(t -> registerIcon(t, event)); } }
Example #15
Source File: GTProxyClient.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public static void onRegisterTexture(TextureStitchEvent.Pre event) { event.getMap().registerSprite(new ResourceLocation(GTMod.MODID, "fluids/fluid")); event.getMap().registerSprite(new ResourceLocation(GTMod.MODID, "fluids/fluidflowing")); event.getMap().registerSprite(new ResourceLocation(GTMod.MODID, "fluids/gas")); event.getMap().registerSprite(new ResourceLocation(GTMod.MODID, "fluids/gasflowing")); event.getMap().registerSprite(new ResourceLocation(GTMod.MODID, "fluids/magicdye")); event.getMap().registerSprite(new ResourceLocation(GTMod.MODID, "fluids/magicdyeflowing")); }
Example #16
Source File: SpriteRegistryHelper.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@SubscribeEvent public void onTextureStitchPre(TextureStitchEvent.Pre event) { AtlasTexture atlas = event.getMap(); AtlasRegistrarImpl registrar = getRegistrar(atlas); iconRegisters.get(atlas.getTextureLocation()).forEach(e -> e.registerIcons(registrar)); registrar.processPre(event::addSprite); }
Example #17
Source File: EventHandler.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) @SubscribeEvent public void onTextureStitchEvent(TextureStitchEvent event) { if (event.getMap() == Minecraft.getMinecraft().getTextureMapBlocks()) { event.getMap().registerSprite(new ResourceLocation(Wizardry.MODID, MISC.SMOKE)); event.getMap().registerSprite(new ResourceLocation(Wizardry.MODID, MISC.SPARKLE_BLURRED)); event.getMap().registerSprite(new ResourceLocation(Wizardry.MODID, MISC.DIAMOND)); } }
Example #18
Source File: EventsClient.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@SubscribeEvent public void onTextureStitchPre(TextureStitchEvent.Pre event) { ResourceLocation mainCoreInventoryTexture = new ResourceLocation(ValkyrienSkiesMod.MOD_ID, "items/main_core"); ResourceLocation smallCoreInventoryTexture = new ResourceLocation(ValkyrienSkiesMod.MOD_ID, "items/small_core"); event.getMap() .registerSprite(mainCoreInventoryTexture); event.getMap() .registerSprite(smallCoreInventoryTexture); }
Example #19
Source File: RenderEvents.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public static void onTextureStitchPre(SpriteAtlasTexture spriteAtlasTexture, Set<Identifier> set) { eventDispatcher.accept(new TextureStitchEvent.Pre(spriteAtlasTexture, set)); }
Example #20
Source File: RenderUtility.java From NOVA-Core with GNU Lesser General Public License v3.0 | 4 votes |
public void registerIcon(Texture texture, TextureStitchEvent.Pre event) { textureMap.put(texture, event.getMap().registerSprite(AssetConverter.instance().toNativeTexture(texture))); }
Example #21
Source File: CommonProxy.java From BigReactors with MIT License | 4 votes |
@SideOnly(Side.CLIENT) @SubscribeEvent public void setIcons(TextureStitchEvent.Post event) { }
Example #22
Source File: CommonProxy.java From BigReactors with MIT License | 4 votes |
@SideOnly(Side.CLIENT) @SubscribeEvent public void registerIcons(TextureStitchEvent.Pre event) { }
Example #23
Source File: ClientProxy.java From BigReactors with MIT License | 4 votes |
@Override @SideOnly(Side.CLIENT) @SubscribeEvent public void setIcons(TextureStitchEvent.Post event) { BigReactors.setNonBlockFluidIcons(); }
Example #24
Source File: RenderEvents.java From patchwork-api with GNU Lesser General Public License v2.1 | 4 votes |
public static void onTextureStitchPost(SpriteAtlasTexture spriteAtlasTexture) { eventDispatcher.accept(new TextureStitchEvent.Post(spriteAtlasTexture)); }
Example #25
Source File: TextureUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@SubscribeEvent public void textureLoad(TextureStitchEvent.Pre event) { for (IIconRegister reg : iconRegisters) reg.registerIcons(event.map); }
Example #26
Source File: EventsClient.java From Valkyrien-Skies with Apache License 2.0 | 4 votes |
/** * Register textures for all the models registered in the GibsModelRegistry. */ @SubscribeEvent public void onTextureStitchEvent(TextureStitchEvent.Pre event) { GibsModelRegistry.registerTextures(event); }
Example #27
Source File: TextureRegisterEvent.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@SubscribeEvent public void onTextureStitch(TextureStitchEvent.Post event) { for (final Fluid fluid : EntityHelper.getContainableFluids().values()) { try { final String fluidName = fluid.getName(); final EntityTypeData entityTypeData = EntityHelper.getEntityData(fluidName); final TextureAtlasSprite fluidIcon = event.getMap().getAtlasSprite(fluid.getStill().toString()); final int fluidColor = fluid.getColor(); if (fluidColor != 0xFFFFFFFF) { if (entityTypeData != null) { entityTypeData.setOverlay(new Color( (fluidColor >> 16) & 0xFF, (fluidColor >> 8) & 0xFF, (fluidColor) & 0xFF, 128).getRGB()); } } else if (fluidIcon != event.getMap().getMissingSprite() && fluidIcon.getFrameTextureData(0) != null) { final Color meanColour = ColorHelper.getMeanColour(fluidIcon.getFrameTextureData(0)); if (entityTypeData != null) { entityTypeData.setOverlay(new Color( meanColour.getRed(), meanColour.getGreen(), meanColour.getBlue(), 128).getRGB()); } } else { if (entityTypeData != null) { entityTypeData.setOverlay(0xFFFFFFFF); } } EntityHelper.setEntityData(fluidName, entityTypeData); if (ModInformation.DEBUG_MODE) { LogHelper.info(String.format("Successfully added colour overlay for %s", fluidName)); if (fluidIcon != null) { LogHelper.info("Successfully added colour overlay for " + fluidIcon.getIconName()); } } } catch (final Exception ex) { LogHelper.error("Encountered an issue when attempting to manipulate texture"); ex.printStackTrace(); } } }
Example #28
Source File: TextureStitchHandler.java From AgriCraft with MIT License | 4 votes |
@SubscribeEvent(priority = EventPriority.LOWEST) @SuppressWarnings("unused") public static void onTextureStitch(TextureStitchEvent e) { CoreHandler.loadTextures(e.getMap()::registerSprite); PluginHandler.loadTextures(e.getMap()::registerSprite); }
Example #29
Source File: IconSupplier.java From Framez with GNU General Public License v3.0 | 4 votes |
@SubscribeEvent public void onTextureStitch(TextureStitchEvent event) { TextureMap map = event.map; if (map.getTextureType() == 0) { wood_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_WOOD_BORDER); wood_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_WOOD_BORDER_PANEL); wood_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_WOOD_CROSS); wood_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_WOOD_SIMPLE); iron_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_IRON_BORDER); iron_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_IRON_BORDER_PANEL); iron_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_IRON_CROSS); iron_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_IRON_SIMPLE); copper_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_COPPER_BORDER); copper_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_COPPER_BORDER_PANEL); copper_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_COPPER_CROSS); copper_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_COPPER_SIMPLE); tin_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_TIN_BORDER); tin_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_TIN_BORDER_PANEL); tin_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_TIN_CROSS); tin_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_TIN_SIMPLE); silver_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_SILVER_BORDER); silver_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_SILVER_BORDER_PANEL); silver_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_SILVER_CROSS); silver_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_SILVER_SIMPLE); gold_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_GOLD_BORDER); gold_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_GOLD_BORDER_PANEL); gold_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_GOLD_CROSS); gold_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_GOLD_SIMPLE); bronze_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_BRONZE_BORDER); bronze_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_BRONZE_BORDER_PANEL); bronze_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_BRONZE_CROSS); bronze_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_BRONZE_SIMPLE); invar_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_INVAR_BORDER); invar_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_INVAR_BORDER_PANEL); invar_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_INVAR_CROSS); invar_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_INVAR_SIMPLE); electrum_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ELECTRUM_BORDER); electrum_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ELECTRUM_BORDER_PANEL); electrum_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ELECTRUM_CROSS); electrum_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ELECTRUM_SIMPLE); enderium_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ENDERIUM_BORDER); enderium_border_panel = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ENDERIUM_BORDER_PANEL); enderium_cross = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ENDERIUM_CROSS); enderium_simple = map.registerIcon(ModInfo.MODID + ":" + References.Texture.FRAME_ENDERIUM_SIMPLE); motor_border = map.registerIcon(ModInfo.MODID + ":" + References.Texture.MOTOR_BORDER); motor_center = map.registerIcon(ModInfo.MODID + ":" + References.Texture.MOTOR_CENTER); } }
Example #30
Source File: SpriteRegistryHelper.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@SubscribeEvent public void onTextureStitchPost(TextureStitchEvent.Post event) { AtlasTexture atlas = event.getMap(); AtlasRegistrarImpl registrar = getRegistrar(atlas); registrar.processPost(atlas); }