-
-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathClientRegistry.java
More file actions
111 lines (102 loc) · 6.29 KB
/
ClientRegistry.java
File metadata and controls
111 lines (102 loc) · 6.29 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* Copyright 2024 Intelligence Modding @ https://intelligence-modding.de
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.srendi.advancedperipherals.client;
import dan200.computercraft.api.client.ComputerCraftAPIClient;
import dan200.computercraft.api.client.turtle.TurtleUpgradeModeller;
import de.srendi.advancedperipherals.AdvancedPeripherals;
import de.srendi.advancedperipherals.client.renderer.DistanceDetectorRenderer;
import de.srendi.advancedperipherals.client.screens.InventoryManagerScreen;
import de.srendi.advancedperipherals.client.screens.SmartGlassesScreen;
import de.srendi.advancedperipherals.common.setup.APBlockEntityTypes;
import de.srendi.advancedperipherals.common.setup.APContainerTypes;
import de.srendi.advancedperipherals.common.setup.CCRegistration;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.ModelEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@Mod.EventBusSubscriber(modid = AdvancedPeripherals.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ClientRegistry {
private static final String[] TURTLE_MODELS = new String[]{"turtle_chat_box_upgrade_left",
"turtle_chat_box_upgrade_right", "turtle_environment_upgrade_left", "turtle_environment_upgrade_right",
"turtle_player_upgrade_left", "turtle_player_upgrade_right", "turtle_geoscanner_upgrade_left",
"turtle_geoscanner_upgrade_right"};
@SubscribeEvent
public static void registerModels(ModelEvent.RegisterAdditional event) {
for (String model : TURTLE_MODELS) {
event.register(
new ModelResourceLocation(new ResourceLocation(AdvancedPeripherals.MOD_ID, model), "inventory"));
}
}
@SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) {
MenuScreens.register(APContainerTypes.INVENTORY_MANAGER_CONTAINER.get(), InventoryManagerScreen::new);
MenuScreens.register(APContainerTypes.SMART_GLASSES_CONTAINER.get(), SmartGlassesScreen::new);
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.CHUNKY_TURTLE.get(),
TurtleUpgradeModeller.flatItem());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.COMPASS_TURTLE.get(),
TurtleUpgradeModeller.flatItem());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.CHAT_BOX_TURTLE.get(),
TurtleUpgradeModeller.sided(
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_chat_box_upgrade_left"),
"inventory"),
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_chat_box_upgrade_right"),
"inventory")));
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.ENVIRONMENT_TURTLE.get(),
TurtleUpgradeModeller.sided(
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_environment_upgrade_left"),
"inventory"),
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_environment_upgrade_right"),
"inventory")));
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.GEO_SCANNER_TURTLE.get(),
TurtleUpgradeModeller.sided(
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_geoscanner_upgrade_left"),
"inventory"),
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_geoscanner_upgrade_right"),
"inventory")));
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.PLAYER_DETECTOR_TURTLE.get(),
TurtleUpgradeModeller.sided(
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_player_upgrade_left"), "inventory"),
new ModelResourceLocation(AdvancedPeripherals.getRL("turtle_player_upgrade_right"),
"inventory")));
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.OP_END_TURTLE.get(),
new MetaTurtleUpgradeModeller<>());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.OP_HUSBANDRY_TURTLE.get(),
new MetaTurtleUpgradeModeller<>());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.OP_WEAK_TURTLE.get(),
new MetaTurtleUpgradeModeller<>());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.HUSBANDRY_TURTLE.get(),
new MetaTurtleUpgradeModeller<>());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.END_TURTLE.get(),
new MetaTurtleUpgradeModeller<>());
ComputerCraftAPIClient.registerTurtleUpgradeModeller(CCRegistration.WEAK_TURTLE.get(),
new MetaTurtleUpgradeModeller<>());
ItemPropertiesRegistry.register();
}
@SubscribeEvent
public static void registeringKeymappings(RegisterKeyMappingsEvent event) {
KeyBindings.register(event);
}
@SubscribeEvent
public static void registeringRenderers(EntityRenderersEvent.RegisterRenderers event) {
event.registerBlockEntityRenderer(APBlockEntityTypes.DISTANCE_DETECTOR.get(), DistanceDetectorRenderer::new);
}
}