Use FabricEntityTypeBuilder
All checks were successful
SlightlyVanilla/pipeline/head This commit looks good
All checks were successful
SlightlyVanilla/pipeline/head This commit looks good
This commit is contained in:
parent
b6614da325
commit
f3ea21bea5
@ -7,9 +7,11 @@ import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
|
||||
import net.fabricmc.fabric.api.tag.TagRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.DispenserBlock;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -39,14 +41,11 @@ public class SlightlyVanilla implements ModInitializer {
|
||||
public void onInitialize() {
|
||||
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
|
||||
|
||||
Identifier slimeballID = new Identifier(NAMESPACE, "slimeball");
|
||||
Identifier spawnEggID = new Identifier(NAMESPACE, "spawn_egg");
|
||||
SLIMEBALL_ENTITY = FabricEntityTypeBuilder.create(SpawnGroup.MISC, (EntityType.EntityFactory<SlimeballEntity>) SlimeballEntity::new).dimensions(new EntityDimensions(0.25f, 0.25f, true)).build();
|
||||
SPAWN_EGG_ENTITY = FabricEntityTypeBuilder.create(SpawnGroup.MISC, (EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new).dimensions(new EntityDimensions(0.25f, 0.25f, true)).build();
|
||||
|
||||
SLIMEBALL_ENTITY = EntityType.Builder.create((EntityType.EntityFactory<SlimeballEntity>) SlimeballEntity::new, SpawnGroup.MISC).setDimensions(0.25f, 0.25f).build(slimeballID.toString());
|
||||
SPAWN_EGG_ENTITY = EntityType.Builder.create((EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new, SpawnGroup.MISC).setDimensions(0.25f, 0.25f).build(spawnEggID.toString());
|
||||
|
||||
Registry.register(Registry.ENTITY_TYPE, slimeballID, SLIMEBALL_ENTITY);
|
||||
Registry.register(Registry.ENTITY_TYPE, spawnEggID, SPAWN_EGG_ENTITY);
|
||||
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "slimeball"), SLIMEBALL_ENTITY);
|
||||
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "spawn_egg"), SPAWN_EGG_ENTITY);
|
||||
|
||||
DispenserBlock.registerBehavior(Items.SLIME_BALL, new SlimeballDispenserBehavior());
|
||||
|
||||
|
Reference in New Issue
Block a user