diff --git a/src/main/java/io/github/squidcraft/client/SquidCraftClient.java b/src/main/java/io/github/squidcraft/client/SquidCraftClient.java index e714436..bf91d2c 100644 --- a/src/main/java/io/github/squidcraft/client/SquidCraftClient.java +++ b/src/main/java/io/github/squidcraft/client/SquidCraftClient.java @@ -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 { @@ -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)); } } diff --git a/src/main/java/io/github/squidcraft/entity/CookieCreeperEntity.java b/src/main/java/io/github/squidcraft/entity/CookieCreeperEntity.java new file mode 100644 index 0000000..0606c94 --- /dev/null +++ b/src/main/java/io/github/squidcraft/entity/CookieCreeperEntity.java @@ -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 entityType, World world) { + super(entityType, world); + } +} diff --git a/src/main/java/io/github/squidcraft/entity/CookieCreeperRenderer.java b/src/main/java/io/github/squidcraft/entity/CookieCreeperRenderer.java new file mode 100644 index 0000000..f5d44ff --- /dev/null +++ b/src/main/java/io/github/squidcraft/entity/CookieCreeperRenderer.java @@ -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> { + 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"); + } +} diff --git a/src/main/java/io/github/squidcraft/item/ItemGroups.java b/src/main/java/io/github/squidcraft/item/ItemGroups.java index 11b6ce1..46f5045 100644 --- a/src/main/java/io/github/squidcraft/item/ItemGroups.java +++ b/src/main/java/io/github/squidcraft/item/ItemGroups.java @@ -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(); diff --git a/src/main/java/io/github/squidcraft/util/ModEntities.java b/src/main/java/io/github/squidcraft/util/ModEntities.java new file mode 100644 index 0000000..127926c --- /dev/null +++ b/src/main/java/io/github/squidcraft/util/ModEntities.java @@ -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 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() + ); +} diff --git a/src/main/java/io/github/squidcraft/util/registers/ItemRegister.java b/src/main/java/io/github/squidcraft/util/registers/ItemRegister.java index 9b2cdbe..966affa 100644 --- a/src/main/java/io/github/squidcraft/util/registers/ItemRegister.java +++ b/src/main/java/io/github/squidcraft/util/registers/ItemRegister.java @@ -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. @@ -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( @@ -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); diff --git a/src/main/resources/assets/squidcraft/lang/en_us.json b/src/main/resources/assets/squidcraft/lang/en_us.json index 35bed7f..ddd73af 100644 --- a/src/main/resources/assets/squidcraft/lang/en_us.json +++ b/src/main/resources/assets/squidcraft/lang/en_us.json @@ -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", @@ -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", diff --git a/src/main/resources/assets/squidcraft/lang/zh_cn.json b/src/main/resources/assets/squidcraft/lang/zh_cn.json index 9575f7d..ddcec36 100644 --- a/src/main/resources/assets/squidcraft/lang/zh_cn.json +++ b/src/main/resources/assets/squidcraft/lang/zh_cn.json @@ -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": "鱿鱼工艺", @@ -65,6 +67,8 @@ "biome.squidcraft.squid_biome": "鱿鱼群系", + "entity_type.squidcraft.cookie_creeper": "曲奇苦力怕", + "enchantment.squidcraft.frost": "霜冻", "enchantment.squidcraft.fire_boom": "火焰爆炸", "enchantment.squidcraft.insane": "疯狂附魔", diff --git a/src/main/resources/assets/squidcraft/models/item/cookie_creeper_spawn_egg.json b/src/main/resources/assets/squidcraft/models/item/cookie_creeper_spawn_egg.json new file mode 100644 index 0000000..7a2c6da --- /dev/null +++ b/src/main/resources/assets/squidcraft/models/item/cookie_creeper_spawn_egg.json @@ -0,0 +1,3 @@ +{ + "parent": "item/template_spawn_egg" +} \ No newline at end of file diff --git a/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped.png b/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped.png deleted file mode 100644 index f280926..0000000 Binary files a/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped.png and /dev/null differ diff --git a/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped_left.png b/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped_left.png deleted file mode 100644 index a272dba..0000000 Binary files a/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped_left.png and /dev/null differ diff --git a/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped_right.png b/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped_right.png deleted file mode 100644 index 73e75b2..0000000 Binary files a/src/main/resources/assets/squidcraft/textures/entity/bigger_chest/trapped_right.png and /dev/null differ diff --git a/src/main/resources/assets/squidcraft/textures/entity/cookie_creeper/creeper.png b/src/main/resources/assets/squidcraft/textures/entity/cookie_creeper/creeper.png new file mode 100644 index 0000000..a4bf9c5 Binary files /dev/null and b/src/main/resources/assets/squidcraft/textures/entity/cookie_creeper/creeper.png differ