Skip to content

Commit

Permalink
Added cooked_shredded_squid_block
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Mar 16, 2024
1 parent 3a54cbf commit 6723255
Show file tree
Hide file tree
Showing 21 changed files with 326 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2023 XenFork Union
* Copyright (c) 2023-2024 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -17,6 +17,7 @@
package io.github.xenfork.squidcraft;

import dev.architectury.event.events.common.LootEvent;
import io.github.xenfork.squidcraft.block.ModBlocks;
import io.github.xenfork.squidcraft.item.ModItemGroups;
import io.github.xenfork.squidcraft.item.ModItems;
import net.minecraft.advancements.critereon.EntityFlagsPredicate;
Expand All @@ -41,6 +42,7 @@ public class SquidCraft {
public static final String MOD_ID = "squidcraft";

public static void init() {
ModBlocks.init();
ModItems.init();
ModItemGroups.init();
LootEvent.MODIFY_LOOT_TABLE.register((lootDataManager, id, context, builtin) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* MIT License
*
* Copyright (c) 2024 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/

package io.github.xenfork.squidcraft.block;

import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import io.github.xenfork.squidcraft.SquidCraft;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;

import java.util.Locale;
import java.util.function.Supplier;

/**
* @author squid233
* @since 0.14.0
*/
public enum ModBlocks {
COOKED_SHREDDED_SQUID_BLOCK(() -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_WHITE).instabreak().sound(SoundType.SLIME_BLOCK)));

private static final DeferredRegister<Block> REGISTER = DeferredRegister.create(SquidCraft.MOD_ID, Registries.BLOCK);
private final String path;
private final Supplier<Block> supplier;
private RegistrySupplier<Block> registrySupplier;

ModBlocks(Supplier<Block> supplier) {
this.path = name().toLowerCase(Locale.ROOT);
this.supplier = supplier;
}

public static void init() {
for (var value : values()) {
value.registrySupplier = REGISTER.register(value.path(), value.supplier);
}
REGISTER.register();
}

public String path() {
return path;
}

public RegistrySupplier<Block> registrySupplier() {
return registrySupplier;
}

public Block get() {
return registrySupplier().get();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2023 XenFork Union
* Copyright (c) 2023-2024 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -43,6 +43,7 @@ public final class ModItemGroups {
output.accept(ModItems.COOKED_SHREDDED_SQUID.get());
output.accept(ModItems.GLOWING_SHREDDED_SQUID.get());
output.accept(ModItems.MAGMA_SHREDDED_SQUID.get());
output.accept(ModItems.COOKED_SHREDDED_SQUID_BLOCK.get());
})
));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2023 XenFork Union
* Copyright (c) 2023-2024 XenFork Union
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,10 +19,12 @@
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import io.github.xenfork.squidcraft.SquidCraft;
import io.github.xenfork.squidcraft.block.ModBlocks;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;

import java.util.Locale;
Expand All @@ -37,25 +39,21 @@ public enum ModItems {
SHREDDED_SQUID(() -> ofSnack(1, 1f)),
COOKED_SHREDDED_SQUID(() -> ofSnack(2, 1f)),
GLOWING_SHREDDED_SQUID(() -> ofMeat(1, 1f, builder -> builder.effect(new MobEffectInstance(MobEffects.GLOWING, 200, 0), 1f))),
MAGMA_SHREDDED_SQUID(() -> ofMeat(2, 0.5f, builder -> builder.effect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 200, 0), 0.3f)));
MAGMA_SHREDDED_SQUID(() -> ofMeat(2, 0.5f, builder -> builder.effect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 200, 0), 0.3f))),
COOKED_SHREDDED_SQUID_BLOCK(() -> new BlockItem(ModBlocks.COOKED_SHREDDED_SQUID_BLOCK.get(), new Item.Properties()));

private static final DeferredRegister<Item> REGISTER = DeferredRegister.create(SquidCraft.MOD_ID, Registries.ITEM);
private final String path;
private final Supplier<Item> supplier;
private RegistrySupplier<Item> registrySupplier;

ModItems(Supplier<Item> supplier, String path) {
this.path = path;
this.supplier = supplier;
}

ModItems(Supplier<Item> supplier) {
this.path = name().toLowerCase(Locale.ROOT);
this.supplier = supplier;
}

public static void init() {
for (ModItems value : values()) {
for (var value : values()) {
value.registrySupplier = REGISTER.register(value.path(), value.supplier);
}
REGISTER.register();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "squidcraft:block/cooked_shredded_squid_block"
}
}
}
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/squidcraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"advancements.squidcraft.glowing_shredded_squid.description": "Get glowing shredded squid",
"advancements.squidcraft.magma_shredded_squid.title": "Magma Shredded Squid",
"advancements.squidcraft.magma_shredded_squid.description": "Get magma shredded squid",
"block.squidcraft.cooked_shredded_squid_block": "Block of Cooked Shredded Squid",
"item.squidcraft.shredded_squid": "Shredded Squid",
"item.squidcraft.cooked_shredded_squid": "Cooked Shredded Squid",
"item.squidcraft.glowing_shredded_squid": "Glowing Shredded Squid",
"item.squidcraft.magma_shredded_squid": "Magma Shredded Squid",
"item.squidcraft.cooked_shredded_squid_block": "Block of Cooked Shredded Squid",
"itemGroup.squidcraft.main": "SquidCraft"
}
2 changes: 2 additions & 0 deletions common/src/main/resources/assets/squidcraft/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"advancements.squidcraft.glowing_shredded_squid.description": "获得荧光鱿鱼丝",
"advancements.squidcraft.magma_shredded_squid.title": "岩浆鱿鱼丝",
"advancements.squidcraft.magma_shredded_squid.description": "获得岩浆鱿鱼丝",
"block.squidcraft.cooked_shredded_squid_block": "熟鱿鱼丝块",
"item.squidcraft.shredded_squid": "鱿鱼丝",
"item.squidcraft.cooked_shredded_squid": "熟鱿鱼丝",
"item.squidcraft.glowing_shredded_squid": "荧光鱿鱼丝",
"item.squidcraft.magma_shredded_squid": "岩浆鱿鱼丝",
"item.squidcraft.cooked_shredded_squid_block": "熟鱿鱼丝块",
"itemGroup.squidcraft.main": "鱿鱼工艺"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "squidcraft:block/cooked_shredded_squid_block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "squidcraft:block/cooked_shredded_squid_block"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parent": "squidcraft:cooked_shredded_squid",
"criteria": {
"cooked_shredded_squid_block": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"display": {
"frame": "goal",
"description": {
"translate": "advancements.squidcraft.cooked_shredded_squid_block.description"
},
"title": {
"translate": "advancements.squidcraft.cooked_shredded_squid_block.title"
},
"icon": {
"item": "squidcraft:cooked_shredded_squid_block"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"parent": "squidcraft:root",
"parent": "squidcraft:cooked_shredded_squid",
"criteria": {
"magma_shredded_squid": {
"conditions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
},
"trigger": "minecraft:inventory_changed"
},
"has_cooked_shredded_squid": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "squidcraft:cooked_shredded_squid"
Expand All @@ -36,6 +48,7 @@
[
"has_shredded_squid",
"has_glowing_shredded_squid",
"has_cooked_shredded_squid",
"has_the_recipe"
]
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"parent": "squidcraft:recipes/root",
"criteria": {
"has_cooked_shredded_squid": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_cooked_shredded_squid_block": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "squidcraft:cooked_shredded_squid_block"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_cooked_shredded_squid",
"has_cooked_shredded_squid_block",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"squidcraft:cooked_shredded_squid_block"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"parent": "squidcraft:recipes/root",
"criteria": {
"has_cooked_shredded_squid": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_cooked_shredded_squid_block": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid_block"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "squidcraft:cooked_shredded_squid_decompress"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_cooked_shredded_squid",
"has_cooked_shredded_squid_block",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"squidcraft:cooked_shredded_squid_decompress"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@
},
"trigger": "minecraft:inventory_changed"
},
"has_cooked_shredded_squid": {
"conditions": {
"items": [
{
"items": [
"squidcraft:cooked_shredded_squid"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "squidcraft:cooked_shredded_squid"
"recipe": "squidcraft:cooked_shredded_squid_from_campfire_cooking"
},
"trigger": "minecraft:recipe_unlocked"
}
Expand All @@ -36,6 +48,7 @@
[
"has_shredded_squid",
"has_glowing_shredded_squid",
"has_cooked_shredded_squid",
"has_the_recipe"
]
],
Expand Down
Loading

0 comments on commit 6723255

Please sign in to comment.