|
1
|
|
|
package de.pewpewproject.lasertag.entity; |
|
2
|
|
|
|
|
3
|
|
|
import de.pewpewproject.lasertag.LasertagMod; |
|
4
|
|
|
import de.pewpewproject.lasertag.block.Blocks; |
|
5
|
|
|
import de.pewpewproject.lasertag.block.entity.*; |
|
6
|
|
|
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; |
|
7
|
|
|
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; |
|
8
|
|
|
import net.minecraft.block.entity.BlockEntityType; |
|
9
|
|
|
import net.minecraft.entity.EntityType; |
|
10
|
|
|
import net.minecraft.entity.SpawnGroup; |
|
11
|
|
|
import net.minecraft.util.Identifier; |
|
12
|
|
|
import net.minecraft.util.registry.Registry; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class for registering all entities |
|
16
|
|
|
* |
|
17
|
|
|
* @author Étienne Muser |
|
18
|
|
|
*/ |
|
19
|
|
|
public class Entities { |
|
20
|
|
|
// Create instances for all block entities |
|
21
|
|
|
public static BlockEntityType<LaserTargetBlockEntity> LASER_TARGET_ENTITY; |
|
22
|
|
|
public static BlockEntityType<LasertagGameManagerBlockEntity> LASERTAG_GAME_MANAGER_BLOCK_ENTITY; |
|
23
|
|
|
public static BlockEntityType<LasertagTeamSelectorBlockEntity> LASERTAG_TEAM_SELECTOR_BLOCK_ENTITY; |
|
24
|
|
|
public static BlockEntityType<LasertagCreditsButtonBlockEntity> LASERTAG_CREDITS_BLOCK_ENTITY; |
|
25
|
|
|
public static BlockEntityType<LasertagStartGameButtonBlockEntity> LASERTAG_START_GAME_BUTTON_ENTITY; |
|
26
|
|
|
public static BlockEntityType<LasertagTeamZoneGeneratorBlockEntity> LASERTAG_TEAM_ZONE_GENERATOR_BLOCK_ENTITY; |
|
27
|
|
|
public static BlockEntityType<LasertagFlagBlockEntity> LASERTAG_FLAG_BLOCK_ENTITY; |
|
28
|
|
|
|
|
29
|
|
|
// Register all entities |
|
30
|
|
|
public static EntityType<LaserRayEntity> LASER_RAY; |
|
31
|
|
|
|
|
32
|
|
|
public static void register() { |
|
33
|
|
|
LASER_RAY = Registry.register( |
|
34
|
|
|
Registry.ENTITY_TYPE, |
|
35
|
|
|
new Identifier(LasertagMod.ID, "laser_ray_entity"), |
|
36
|
|
|
FabricEntityTypeBuilder.<LaserRayEntity>create(SpawnGroup.MISC, LaserRayEntity::new).build()); |
|
37
|
|
|
|
|
38
|
|
|
LASER_TARGET_ENTITY = Registry.register( |
|
39
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
40
|
|
|
new Identifier(LasertagMod.ID, "lasertarget_entity"), |
|
41
|
|
|
FabricBlockEntityTypeBuilder.create(LaserTargetBlockEntity::new, Blocks.LASER_TARGET).build()); |
|
42
|
|
|
|
|
43
|
|
|
LASERTAG_GAME_MANAGER_BLOCK_ENTITY = Registry.register( |
|
44
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
45
|
|
|
new Identifier(LasertagMod.ID, "lasertag_game_manager_block_entity"), |
|
46
|
|
|
FabricBlockEntityTypeBuilder.create(LasertagGameManagerBlockEntity::new, Blocks.LASERTAG_GAME_MANAGER_BLOCK).build()); |
|
47
|
|
|
|
|
48
|
|
|
LASERTAG_TEAM_SELECTOR_BLOCK_ENTITY = Registry.register( |
|
49
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
50
|
|
|
new Identifier(LasertagMod.ID, "lasertag_team_selector_block_entity"), |
|
51
|
|
|
FabricBlockEntityTypeBuilder.create(LasertagTeamSelectorBlockEntity::new, Blocks.LASERTAG_TEAM_SELECTOR_BLOCK).build()); |
|
52
|
|
|
|
|
53
|
|
|
LASERTAG_CREDITS_BLOCK_ENTITY = Registry.register( |
|
54
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
55
|
|
|
new Identifier(LasertagMod.ID, "lasertag_credits_button_block_entity"), |
|
56
|
|
|
FabricBlockEntityTypeBuilder.create(LasertagCreditsButtonBlockEntity::new, Blocks.LASERTAG_CREDITS_BUTTON).build()); |
|
57
|
|
|
|
|
58
|
|
|
LASERTAG_START_GAME_BUTTON_ENTITY = Registry.register( |
|
59
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
60
|
|
|
new Identifier(LasertagMod.ID, "lasertag_start_game_button_block_entity"), |
|
61
|
|
|
FabricBlockEntityTypeBuilder.create(LasertagStartGameButtonBlockEntity::new, Blocks.LASERTAG_START_GAME_BUTTON).build()); |
|
62
|
|
|
|
|
63
|
|
|
LASERTAG_TEAM_ZONE_GENERATOR_BLOCK_ENTITY = Registry.register( |
|
64
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
65
|
|
|
new Identifier(LasertagMod.ID, "lasertag_team_zone_generator_block_entity"), |
|
66
|
|
|
FabricBlockEntityTypeBuilder.create(LasertagTeamZoneGeneratorBlockEntity::new, Blocks.LASERTAG_TEAM_ZONE_GENERATOR_BLOCK).build()); |
|
67
|
|
|
|
|
68
|
|
|
LASERTAG_FLAG_BLOCK_ENTITY = Registry.register( |
|
69
|
|
|
Registry.BLOCK_ENTITY_TYPE, |
|
70
|
|
|
new Identifier(LasertagMod.ID, "lasertag_flag_block_entity"), |
|
71
|
|
|
FabricBlockEntityTypeBuilder.create(LasertagFlagBlockEntity::new, Blocks.LASERTAG_FLAG_BLOCK).build()); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|