Skip to content
This repository has been archived by the owner on Dec 19, 2020. It is now read-only.

Commit

Permalink
add new entity
Browse files Browse the repository at this point in the history
add new entity : cookie creeper
  • Loading branch information
squid233 committed May 6, 2020
1 parent c87e0df commit 1b5e806
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package io.github.squidcraft.client;

import io.github.squidcraft.client.gui.BiggerChestScreen;
import io.github.squidcraft.entity.CookieCreeperRenderer;
import io.github.squidcraft.tile.BiggerChestContainer;
import io.github.squidcraft.util.ModEntities;
import io.github.squidcraft.util.registers.BlockRegister;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry;
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.TranslatableText;
import static io.github.squidcraft.util.KeyBindings.*;

import static io.github.squidcraft.util.KeyBindings.keyBinding_0;
import static net.fabricmc.fabric.api.client.keybinding.KeyBindingRegistry.INSTANCE;

public final class SquidCraftClient implements ClientModInitializer {
Expand All @@ -23,5 +27,7 @@ public void onInitializeClient() {
assert MinecraftClient.getInstance().player != null;
return new BiggerChestScreen(container, MinecraftClient.getInstance().player.inventory, new TranslatableText(BlockRegister.BIGGER_CHEST_TRANSLATION_KEY));
}));

EntityRendererRegistry.INSTANCE.register(ModEntities.COOKIE_CREEPER, (entityRenderDispatcher, context) -> new CookieCreeperRenderer(entityRenderDispatcher));
}
}
11 changes: 11 additions & 0 deletions src/main/java/io/github/squidcraft/entity/CookieCreeperEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.squidcraft.entity;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.mob.CreeperEntity;
import net.minecraft.world.World;

public class CookieCreeperEntity extends CreeperEntity {
public CookieCreeperEntity(EntityType<? extends CreeperEntity> entityType, World world) {
super(entityType, world);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.github.squidcraft.entity;

import io.github.squidcraft.SquidCraft;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.render.entity.model.CreeperEntityModel;
import net.minecraft.util.Identifier;

public class CookieCreeperRenderer extends MobEntityRenderer<CookieCreeperEntity, CreeperEntityModel<CookieCreeperEntity>> {
public CookieCreeperRenderer(EntityRenderDispatcher entityRenderDispatcher_1) {
super(entityRenderDispatcher_1, new CreeperEntityModel<>(), 1);
}

@Override
public Identifier getTexture(CookieCreeperEntity cookieCreeperEntity) {
return new Identifier(SquidCraft.MODID+":textures/entity/cookie_creeper/creeper.png");
}
}
2 changes: 2 additions & 0 deletions src/main/java/io/github/squidcraft/item/ItemGroups.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ private ItemGroups() {
stacks.add(new ItemStack(COPPER_INGOT));
stacks.add(new ItemStack(COPPER_BLOCK));

stacks.add(new ItemStack(COOKIE_CREEPER_SPAWN_EGG));

})
.build();

Expand Down
19 changes: 19 additions & 0 deletions src/main/java/io/github/squidcraft/util/ModEntities.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.github.squidcraft.util;

import io.github.squidcraft.SquidCraft;
import io.github.squidcraft.entity.CookieCreeperEntity;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class ModEntities {
public static final EntityType<CookieCreeperEntity> COOKIE_CREEPER =
Registry.register(
Registry.ENTITY_TYPE,
new Identifier(SquidCraft.MODID, "cookie_creeper"),
FabricEntityTypeBuilder.create(EntityCategory.AMBIENT, CookieCreeperEntity::new).dimensions(EntityDimensions.fixed(1, 2)).build()
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package io.github.squidcraft.util.registers;

import io.github.squidcraft.api.ItemsRegister;
import io.github.squidcraft.armor.*;
import io.github.squidcraft.armor.ArmorMaterials;
import io.github.squidcraft.armor.NetheriteHelmet;
import io.github.squidcraft.armor.SquidHelmet;
import io.github.squidcraft.item.*;
import io.github.squidcraft.item.tools.netherite.*;
import io.github.squidcraft.item.tools.squid.*;
import io.github.squidcraft.util.ModEntities;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.*;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.SpawnEggItem;

import static io.github.squidcraft.SquidCraft.MODID;
import static io.github.squidcraft.item.ItemGroups.*;
import static io.github.squidcraft.item.ItemGroups.NETHERITE_MOD;
import static io.github.squidcraft.item.ItemGroups.SQUID_CRAFT_COMBAT_AND_TOOLS;

public class ItemRegister {
// TODO Always register item, add item group, add models, add textures and add recipes.
Expand Down Expand Up @@ -45,6 +51,8 @@ public class ItemRegister {
public static final Item COPPER_NUGGET = new CopperNugget();
public static final Item COPPER_INGOT = new CopperIngot();

public static final Item COOKIE_CREEPER_SPAWN_EGG = new SpawnEggItem(ModEntities.COOKIE_CREEPER, 0x0DA70B, 0x73420E, new Item.Settings().group(ItemGroups.SQUID_CRAFT));

public ItemRegister() {

registerAll(
Expand All @@ -70,6 +78,8 @@ public ItemRegister() {
registerItem("copper_nugget", COPPER_NUGGET);
registerItem("copper_ingot", COPPER_INGOT);

registerItem("cookie_creeper_spawn_egg", COOKIE_CREEPER_SPAWN_EGG);

registerArmor("squid", SQUID_HELMET, SQUID_CHESTPLATE, SQUID_LEGGINGS, SQUID_BOOTS);
registerArmor("netherite", NETHERITE_HELMET, NETHERITE_CHESTPLATE, NETHERITE_LEGGINGS, NETHERITE_BOOTS);

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/squidcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"item.squidcraft.copper_nugget": "Copper Nugget",
"item.squidcraft.copper_ingot": "Copper Ingot",

"item.squidcraft.cookie_creeper_spawn_egg":"Spawn Cookie Creeper",

"item.squidcraft.squid_cookie.tooltip": "Craft a squid block!",

"itemGroup.squidcraft.squid_craft": "SquidCraft",
Expand Down Expand Up @@ -65,6 +67,8 @@

"biome.squidcraft.squid_biome": "Squid Biome",

"entity_type.squidcraft.cookie_creeper": "Cookie Creeper",

"enchantment.squidcraft.frost": "Frost",
"enchantment.squidcraft.fire_boom": "Fire Boom",
"enchantment.squidcraft.insane": "Insane Enchantment",
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/squidcraft/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"item.squidcraft.copper_nugget": "铜粒",
"item.squidcraft.copper_ingot": "铜锭",

"item.squidcraft.cookie_creeper_spawn_egg":"生成曲奇苦力怕",

"item.squidcraft.squid_cookie.tooltip": "合成一个鱿鱼块!",

"itemGroup.squidcraft.squid_craft": "鱿鱼工艺",
Expand Down Expand Up @@ -65,6 +67,8 @@

"biome.squidcraft.squid_biome": "鱿鱼群系",

"entity_type.squidcraft.cookie_creeper": "曲奇苦力怕",

"enchantment.squidcraft.frost": "霜冻",
"enchantment.squidcraft.fire_boom": "火焰爆炸",
"enchantment.squidcraft.insane": "疯狂附魔",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "item/template_spawn_egg"
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1b5e806

Please sign in to comment.