-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathWildWindClientEventHandler.java
51 lines (44 loc) · 2.59 KB
/
WildWindClientEventHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.polaris2023.wild_wind.client;
import net.minecraft.util.FastColor;
import net.minecraft.world.item.Items;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;
import org.polaris2023.wild_wind.client.entity.abstracts.ModMobRenderer;
import org.polaris2023.wild_wind.client.entity.firefly.FireflyModel;
import org.polaris2023.wild_wind.client.entity.piranha.PiranhaModel;
import org.polaris2023.wild_wind.client.entity.trout.TroutModel;
import org.polaris2023.wild_wind.common.init.ModBlocks;
import org.polaris2023.wild_wind.common.init.ModComponents;
import org.polaris2023.wild_wind.common.init.ModEntities;
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class WildWindClientEventHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void registerSlimeColor(RegisterColorHandlersEvent.Item event) {
event.register((stack, tintIndex) ->
FastColor.ARGB32.opaque(stack.getOrDefault(ModComponents.SLIME_COLOR, 0)), Items.SLIME_BALL);
event.register((stack, tintIndex) ->
FastColor.ARGB32.opaque(stack.getOrDefault(ModComponents.COLOR, 0)), ModBlocks.WOOL_ITEM);
}
@SubscribeEvent
public static void registerBlockColor(RegisterColorHandlersEvent.Block event) {
}
@SubscribeEvent
public static void registerRender(EntityRenderersEvent.RegisterRenderers event) {
event.registerEntityRenderer(ModEntities.FIREFLY.get(), context ->
new ModMobRenderer<>("firefly", context, FireflyModel::new, FireflyModel.LAYER_LOCATION, 1));
event.registerEntityRenderer(ModEntities.TROUT.get(), context ->
new ModMobRenderer<>("trout", context, TroutModel::new, TroutModel.LAYER_LOCATION, 1));
event.registerEntityRenderer(ModEntities.PIRANHA.get(), context ->
new ModMobRenderer<>("piranha", context, PiranhaModel::new, PiranhaModel.LAYER_LOCATION, 1));
}
@SubscribeEvent
public static void registerEntityLayers(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(FireflyModel.LAYER_LOCATION, FireflyModel::createBodyLayer);
event.registerLayerDefinition(TroutModel.LAYER_LOCATION, TroutModel::createBodyLayer);
event.registerLayerDefinition(PiranhaModel.LAYER_LOCATION, PiranhaModel::createBodyLayer);
}
}