mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Add an event for registering block/item colour handlers (#4565)
This commit is contained in:
1 parent
e3c630ecb8
commit
98997061f0
4 files changed
+99
-6
No files matched your search
@@ -61,6 +61,8 @@ import net.minecraft.client.renderer.block.model.ModelManager;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.model.ModelRotation;
|
||||
import net.minecraft.client.renderer.block.model.SimpleBakedModel;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -91,6 +93,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
@@ -185,6 +188,16 @@ public class ForgeHooksClient
|
||||
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
|
||||
}
|
||||
|
||||
public static void onBlockColorsInit(BlockColors blockColors)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new ColorHandlerEvent.Block(blockColors));
|
||||
}
|
||||
|
||||
public static void onItemColorsInit(ItemColors itemColors, BlockColors blockColors)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new ColorHandlerEvent.Item(itemColors, blockColors));
|
||||
}
|
||||
|
||||
static int renderPass = -1;
|
||||
public static void setRenderPass(int pass)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2017.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Use these events to register block/item
|
||||
* color handlers at the appropriate time.
|
||||
*/
|
||||
public abstract class ColorHandlerEvent extends Event
|
||||
{
|
||||
public static class Block extends ColorHandlerEvent
|
||||
{
|
||||
private final BlockColors blockColors;
|
||||
|
||||
public Block(BlockColors blockColors)
|
||||
{
|
||||
this.blockColors = blockColors;
|
||||
}
|
||||
|
||||
public BlockColors getBlockColors()
|
||||
{
|
||||
return blockColors;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Item extends ColorHandlerEvent
|
||||
{
|
||||
private final ItemColors itemColors;
|
||||
private final BlockColors blockColors;
|
||||
|
||||
public Item(ItemColors itemColors, BlockColors blockColors)
|
||||
{
|
||||
this.itemColors = itemColors;
|
||||
this.blockColors = blockColors;
|
||||
}
|
||||
|
||||
public ItemColors getItemColors()
|
||||
{
|
||||
return itemColors;
|
||||
}
|
||||
|
||||
public BlockColors getBlockColors()
|
||||
{
|
||||
return blockColors;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user