new
This commit is contained in:
89
src/main/java/net/mcreator/biglifantasy/BiglifantasyMod.java
Normal file
89
src/main/java/net/mcreator/biglifantasy/BiglifantasyMod.java
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* MCreator note:
|
||||
*
|
||||
* If you lock base mod element files, you can edit this file and it won't get overwritten.
|
||||
* If you change your modid or package, you need to apply these changes to this file MANUALLY.
|
||||
*
|
||||
* Settings in @Mod annotation WON'T be changed in case of the base mod element
|
||||
* files lock too, so you need to set them manually here in such case.
|
||||
*
|
||||
* If you do not lock base mod element files in Workspace settings, this file
|
||||
* will be REGENERATED on each build.
|
||||
*
|
||||
*/
|
||||
package net.mcreator.biglifantasy;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import net.minecraftforge.network.simple.SimpleChannel;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
||||
import net.mcreator.biglifantasy.init.BiglifantasyModItems;
|
||||
import net.mcreator.biglifantasy.init.BiglifantasyModEnchantments;
|
||||
import net.mcreator.biglifantasy.init.BiglifantasyModBlocks;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.AbstractMap;
|
||||
|
||||
@Mod("biglifantasy")
|
||||
public class BiglifantasyMod {
|
||||
public static final Logger LOGGER = LogManager.getLogger(BiglifantasyMod.class);
|
||||
public static final String MODID = "biglifantasy";
|
||||
|
||||
public BiglifantasyMod() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
BiglifantasyModBlocks.REGISTRY.register(bus);
|
||||
BiglifantasyModItems.REGISTRY.register(bus);
|
||||
|
||||
BiglifantasyModEnchantments.REGISTRY.register(bus);
|
||||
|
||||
}
|
||||
|
||||
private static final String PROTOCOL_VERSION = "1";
|
||||
public static final SimpleChannel PACKET_HANDLER = NetworkRegistry.newSimpleChannel(new ResourceLocation(MODID, MODID), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals);
|
||||
private static int messageID = 0;
|
||||
|
||||
public static <T> void addNetworkMessage(Class<T> messageType, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<NetworkEvent.Context>> messageConsumer) {
|
||||
PACKET_HANDLER.registerMessage(messageID, messageType, encoder, decoder, messageConsumer);
|
||||
messageID++;
|
||||
}
|
||||
|
||||
private static final Collection<AbstractMap.SimpleEntry<Runnable, Integer>> workQueue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public static void queueServerWork(int tick, Runnable action) {
|
||||
workQueue.add(new AbstractMap.SimpleEntry(action, tick));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tick(TickEvent.ServerTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
List<AbstractMap.SimpleEntry<Runnable, Integer>> actions = new ArrayList<>();
|
||||
workQueue.forEach(work -> {
|
||||
work.setValue(work.getValue() - 1);
|
||||
if (work.getValue() == 0)
|
||||
actions.add(work);
|
||||
});
|
||||
actions.forEach(e -> e.getKey().run());
|
||||
workQueue.removeAll(actions);
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/net/mcreator/biglifantasy/block/TestBlock.java
Normal file
34
src/main/java/net/mcreator/biglifantasy/block/TestBlock.java
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
package net.mcreator.biglifantasy.block;
|
||||
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
|
||||
public class TestBlock extends Block {
|
||||
public TestBlock() {
|
||||
super(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.GRAVEL).strength(1f, 10f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightBlock(BlockState state, BlockGetter worldIn, BlockPos pos) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
List<ItemStack> dropsOriginal = super.getDrops(state, builder);
|
||||
if (!dropsOriginal.isEmpty())
|
||||
return dropsOriginal;
|
||||
return Collections.singletonList(new ItemStack(this, 1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
package net.mcreator.biglifantasy.enchantment;
|
||||
|
||||
import net.minecraft.world.item.enchantment.EnchantmentCategory;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
|
||||
public class BlessEnchantment extends Enchantment {
|
||||
public BlessEnchantment(EquipmentSlot... slots) {
|
||||
super(Enchantment.Rarity.COMMON, EnchantmentCategory.BREAKABLE, slots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageProtection(int level, DamageSource source) {
|
||||
return level * 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
|
||||
return Ingredient.of(new ItemStack(Items.WATER_BUCKET)).test(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTreasureOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDiscoverable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTradeable() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
/*
|
||||
* MCreator note: This file will be REGENERATED on each build.
|
||||
*/
|
||||
package net.mcreator.biglifantasy.init;
|
||||
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import net.mcreator.biglifantasy.block.TestBlock;
|
||||
import net.mcreator.biglifantasy.BiglifantasyMod;
|
||||
|
||||
public class BiglifantasyModBlocks {
|
||||
public static final DeferredRegister<Block> REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCKS, BiglifantasyMod.MODID);
|
||||
public static final RegistryObject<Block> TEST = REGISTRY.register("test", () -> new TestBlock());
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
/*
|
||||
* MCreator note: This file will be REGENERATED on each build.
|
||||
*/
|
||||
package net.mcreator.biglifantasy.init;
|
||||
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
|
||||
import net.mcreator.biglifantasy.enchantment.BlessEnchantment;
|
||||
import net.mcreator.biglifantasy.BiglifantasyMod;
|
||||
|
||||
public class BiglifantasyModEnchantments {
|
||||
public static final DeferredRegister<Enchantment> REGISTRY = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, BiglifantasyMod.MODID);
|
||||
public static final RegistryObject<Enchantment> BLESS = REGISTRY.register("bless", () -> new BlessEnchantment());
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
/*
|
||||
* MCreator note: This file will be REGENERATED on each build.
|
||||
*/
|
||||
package net.mcreator.biglifantasy.init;
|
||||
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
|
||||
import net.mcreator.biglifantasy.item.TestSwordItem;
|
||||
import net.mcreator.biglifantasy.BiglifantasyMod;
|
||||
|
||||
public class BiglifantasyModItems {
|
||||
public static final DeferredRegister<Item> REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, BiglifantasyMod.MODID);
|
||||
public static final RegistryObject<Item> TEST_SWORD = REGISTRY.register("test_sword", () -> new TestSwordItem());
|
||||
public static final RegistryObject<Item> TEST = block(BiglifantasyModBlocks.TEST);
|
||||
|
||||
private static RegistryObject<Item> block(RegistryObject<Block> block) {
|
||||
return REGISTRY.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
/*
|
||||
* MCreator note: This file will be REGENERATED on each build.
|
||||
*/
|
||||
package net.mcreator.biglifantasy.init;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class BiglifantasyModTabs {
|
||||
@SubscribeEvent
|
||||
public static void buildTabContentsModded(CreativeModeTabEvent.Register event) {
|
||||
event.registerCreativeModeTab(new ResourceLocation("biglifantasy", "big_li_fantasy"),
|
||||
builder -> builder.title(Component.translatable("item_group.biglifantasy.big_li_fantasy")).icon(() -> new ItemStack(Items.MUSIC_DISC_FAR)).displayItems((parameters, tabData) -> {
|
||||
tabData.accept(BiglifantasyModItems.TEST_SWORD.get());
|
||||
tabData.accept(BiglifantasyModBlocks.TEST.get().asItem());
|
||||
}).withSearchBar());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
package net.mcreator.biglifantasy.item;
|
||||
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
public class TestSwordItem extends SwordItem {
|
||||
public TestSwordItem() {
|
||||
super(new Tier() {
|
||||
public int getUses() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return 4f;
|
||||
}
|
||||
|
||||
public float getAttackDamageBonus() {
|
||||
return 498f;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getEnchantmentValue() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Ingredient getRepairIngredient() {
|
||||
return Ingredient.of();
|
||||
}
|
||||
}, 3, -3f, new Item.Properties().fireResistant());
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean isFoil(ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
22
src/main/resources/META-INF/mods.toml
Normal file
22
src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[45,)"
|
||||
license="Academic Free License v3.0"
|
||||
|
||||
[[mods]]
|
||||
modId="biglifantasy"
|
||||
version="1.0.0"
|
||||
displayName="大力的幻想"
|
||||
credits="Created using mod maker MCreator - https://mcreator.net/about"
|
||||
displayURL="http://www.mcstarsky.top"
|
||||
authors="Coldsmile, MCreator"
|
||||
|
||||
[[dependencies.biglifantasy]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.19.4]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "biglifantasy:block/test"
|
||||
}
|
||||
}
|
||||
}
|
||||
6
src/main/resources/assets/biglifantasy/lang/en_us.json
Normal file
6
src/main/resources/assets/biglifantasy/lang/en_us.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"block.biglifantasy.test": "Test",
|
||||
"enchantment.biglifantasy.bless": "Bless",
|
||||
"item.biglifantasy.test_sword": "Test Sword",
|
||||
"item_group.biglifantasy.big_li_fantasy": "BigLi\u0027s Fantasy"
|
||||
}
|
||||
6
src/main/resources/assets/biglifantasy/lang/zh_cn.json
Normal file
6
src/main/resources/assets/biglifantasy/lang/zh_cn.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"block.biglifantasy.test": "Test",
|
||||
"enchantment.biglifantasy.bless": "护佑",
|
||||
"item.biglifantasy.test_sword": "§4§l大§l§5力§l§6王§l§7剑 §l§0§m(测试刀)",
|
||||
"item_group.biglifantasy.big_li_fantasy": "大力的幻想"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"parent": "block/cube",
|
||||
"textures": {
|
||||
"down": "biglifantasy:block/test",
|
||||
"up": "biglifantasy:block/test",
|
||||
"north": "biglifantasy:block/test",
|
||||
"east": "biglifantasy:block/test",
|
||||
"south": "biglifantasy:block/test",
|
||||
"west": "biglifantasy:block/test",
|
||||
"particle": "biglifantasy:block/test"
|
||||
},
|
||||
"render_type": "solid"
|
||||
}
|
||||
22
src/main/resources/assets/biglifantasy/models/item/test.json
Normal file
22
src/main/resources/assets/biglifantasy/models/item/test.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"parent": "biglifantasy:block/test",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [
|
||||
10,
|
||||
-45,
|
||||
170
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
1.5,
|
||||
-2.75
|
||||
],
|
||||
"scale": [
|
||||
0.375,
|
||||
0.375,
|
||||
0.375
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "item/handheld",
|
||||
"textures": {
|
||||
"layer0": "biglifantasy:item/big_li_sword"
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/biglifantasy/textures/block/test.png
Normal file
BIN
src/main/resources/assets/biglifantasy/textures/block/test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 B |
Binary file not shown.
|
After Width: | Height: | Size: 406 B |
17
src/main/resources/data/biglifantasy/recipes/bless_book.json
Normal file
17
src/main/resources/data/biglifantasy/recipes/bless_book.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"group": "blessbook",
|
||||
"category": "misc",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "minecraft:enchanted_book"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:enchanted_book"
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"item": "minecraft:enchanted_book",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"type": "minecraft:entity",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:elytra",
|
||||
"weight": 1,
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_count",
|
||||
"count": {
|
||||
"min": 1,
|
||||
"max": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"type": "minecraft:entity",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:wither_skeleton_skull",
|
||||
"weight": 1,
|
||||
"functions": [
|
||||
{
|
||||
"function": "set_count",
|
||||
"count": {
|
||||
"min": 3,
|
||||
"max": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
8
src/main/resources/pack.mcmeta
Normal file
8
src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "biglifantasy mod resources",
|
||||
"pack_format": 13,
|
||||
"forge:resource_pack_format": 13,
|
||||
"forge:data_pack_format": 12
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user