Skip to content

Commit

Permalink
pref: 更新了多个文件,包括物品、方块、网络傳輸 packets 和向量工具类。优化了代码注释,文檔,并添加了新的魔法物品和实体。
Browse files Browse the repository at this point in the history
Modified files:
- src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/StdMagicItem.java
- src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Magic/LimiterItem/StdLimiterItem.java
- src/main/java/com/ictye/the_origin_of_magic/utils/Vec3d_Util.java
- src/main/java/com/ictye/the_origin_of_magic/foundation/Items/Staff/StdStaff.java
- src/main/java/com/ictye/the_origin_of_magic/Contents/AllBlockEntity.java
- src/main/java/com/ictye/the_origin_of_magic/foundation/Blocks/MagicWorkstationBlockEntity.java
- src/main/java/com/ictye/the_origin_of_magic/the_origin_of_magic_client.java
- src/main/java/com/ictye/the_origin_of_magic/infrastructure/netWork/SyncHUDS2CPacket.java
- src/main/generated/.cache/dc1d6e7286e7569a79007c10f809d49635ea1c49
- src/main/java/com/ictye/the_origin_of_magic/foundation/Entitys/Magics/PoisonThrownMagic.java
  • Loading branch information
northgreen committed Apr 20, 2024
1 parent 77181da commit 18424fb
Show file tree
Hide file tree
Showing 36 changed files with 359 additions and 132 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2024-04-20T13:20:04.2533668 Language
cf9144aa31d03773d984551199f36d4c66351a1f assets\the_origin_of_magic\lang\en_us.json
// 1.19.2 2024-04-20T16:16:43.5788967 Language
e4957a0a0c98975bf4c2d8324cf2ff65b3281ca1 assets\the_origin_of_magic\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.19.2 2024-04-20T13:20:04.2507738 Block Loot Tables
// 1.19.2 2024-04-20T16:16:43.57588 Block Loot Tables
fe57f13449a11436bbede8c37e01bd0d1cd87191 data\the_origin_of_magic\loot_tables\blocks\magic_workbench.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// 1.19.2 2024-04-20T13:20:04.2558702 Models
// 1.19.2 2024-04-20T16:16:43.5723787 Models
50c992db06feb825ceb8fe3bd063a7d5fcc83264 assets\the_origin_of_magic\models\item\explosion_magic.json
ddf4e605ac73f757f76bbfe39d60312b7042e7d9 assets\the_origin_of_magic\models\item\hostile_entity_limiter.json
02d3ff4716d16f7c5a4dd4432d1b98f744a13f02 assets\the_origin_of_magic\models\item\blood_essence.json
b1555a32206034cd8f1b13891371182e88d9d40a assets\the_origin_of_magic\models\item\test_magic.json
681374800d5b4991c2e8d6304781b89089bd379c assets\the_origin_of_magic\models\item\poison_magic.json
03b1f5cc891077d36d38a8d98d2ffe49396f8229 assets\the_origin_of_magic\models\item\water_magic_element.json
a50a32a25dfc8a066cacf0c15ac0420396c0c5fc assets\the_origin_of_magic\models\item\hoglin_entity_limiter.json
5 changes: 3 additions & 2 deletions src/main/generated/assets/the_origin_of_magic/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"block.the_origin_of_magic.magic_workbench": "Magic Workbench",
"item.the_origin_of_magic.blood_essence": "Blood Essence",
"item.the_origin_of_magic.deadwood_staff": "Deadwood Staff",
"item.the_origin_of_magic.hoglin_entity_limiter": "Hoglin Entity Limiter",
"item.the_origin_of_magic.test_magic": "Test Magic",
"item.the_origin_of_magic.explosion_magic": "Explosion Magic",
"item.the_origin_of_magic.hostile_entity_limiter": "Hostile Entity Limiter",
"item.the_origin_of_magic.poison_magic": "Poison Magic",
"item.the_origin_of_magic.test_staff": "Test Staff",
"item.the_origin_of_magic.water_magic_element": "Water Magic Element",
"itemGroup.the_origin_of_magic.normal": "The Origin Of The Magic",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "the_origin_of_magic:item/test_magic"
"layer0": "the_origin_of_magic:item/poison_magic"
}
}
20 changes: 15 additions & 5 deletions src/main/java/com/ictye/the_origin_of_magic/Contents/AllBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,21 @@ public class AllBlock {

public static HashMap<String,Item> BlockItems = new HashMap<>();

public static Block MAGIC_WORKSTATION = new MagicWorkstation(FabricBlockSettings.of(Material.STONE).strength(50.0f, 1200.0f).luminance(state -> 10));
@SuppressWarnings("SameParameterValue")
private static void registerBlock(String name, Block block){
Registry.register(Registry.BLOCK,new Identifier(the_origin_of_magic.Mod_Id, name),block);
BlockItems.put(name,new BlockItem(block,new FabricItemSettings().group(AllItem.TheOriginOfMagicItemGroup)));
//魔法工作臺
public static Block MAGIC_WORKSTATION = new MagicWorkstation(FabricBlockSettings.
of(Material.STONE)
.strength(50.0f, 1200.0f)
.luminance(state -> 10));

/**
* 注册方块
* @param id 方塊ID
* @param block 方塊
*/
@SuppressWarnings("SameParameterValue") // 防止IDE瞎TM嗶嗶,煩死了。。。。。。
private static void registerBlock(String id, Block block){
Registry.register(Registry.BLOCK,new Identifier(the_origin_of_magic.Mod_Id, id),block);
BlockItems.put(id,new BlockItem(block,new FabricItemSettings().group(AllItem.TheOriginOfMagicItemGroup)));
}

public static void register(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
import net.minecraft.util.registry.Registry;

public class AllBlockEntity {
/**
* 魔法工作臺
*/
public static final BlockEntityType<MagicWorkstationBlockEntity> MAGIC_WORK_STATION_BLOCK_ENTITIY = BlockEntityType.Builder.create(MagicWorkstationBlockEntity::new, AllBlock.MAGIC_WORKSTATION).build(null);

public static void register(){
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(the_origin_of_magic.Mod_Id,"magic_work_station"),MAGIC_WORK_STATION_BLOCK_ENTITIY);
Registry.register(Registry.BLOCK_ENTITY_TYPE,
new Identifier(the_origin_of_magic.Mod_Id,"magic_work_station"),
MAGIC_WORK_STATION_BLOCK_ENTITIY);
}
}
43 changes: 32 additions & 11 deletions src/main/java/com/ictye/the_origin_of_magic/Contents/AllEntity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ictye.the_origin_of_magic.Contents;

import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.ExplosionThrownMagic;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.PoisonThrownMagic;
import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdThrownMagic;
import com.ictye.the_origin_of_magic.the_origin_of_magic;
import net.fabricmc.api.EnvType;
Expand All @@ -16,27 +17,47 @@

public class AllEntity {

public static final EntityType<StdThrownMagic> TEST_MAGIC_ENTITY_TYPE= FabricEntityTypeBuilder.<StdThrownMagic>create(SpawnGroup.MISC, ExplosionThrownMagic::new)
/**
* 爆炸魔法實體
*/
public static final EntityType<StdThrownMagic> EXPOLOSION_MAGIC_ENTITY_TYPE = FabricEntityTypeBuilder
.<StdThrownMagic>create(SpawnGroup.MISC, ExplosionThrownMagic::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))
.trackRangeBlocks(4).trackedUpdateRate(10)
.build();

/**
* 毒魔法實體
*/
public static final EntityType<StdThrownMagic> POISON_MAGIC_ENTITY_TYPE = FabricEntityTypeBuilder
.<StdThrownMagic>create(SpawnGroup.MISC, PoisonThrownMagic::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F))
.trackRangeBlocks(4).trackedUpdateRate(10)
.build();

/**
* 注冊魔法實體
*/
public static void regEntity(){
/*
* 注冊實體
* */
// 注冊實體
Registry.register(Registry.ENTITY_TYPE,
new Identifier(the_origin_of_magic.Mod_Id,"test_magic"),
TEST_MAGIC_ENTITY_TYPE
EXPOLOSION_MAGIC_ENTITY_TYPE
);

Registry.register(Registry.ENTITY_TYPE,
new Identifier(the_origin_of_magic.Mod_Id,"poison_magic"),
POISON_MAGIC_ENTITY_TYPE
);
}

/**
* 注冊魔法實體渲染器
*/
@Environment(EnvType.CLIENT)
public static void regEntityRunder(){
/*
* 注冊實體渲染器
* */
EntityRendererRegistry.register(TEST_MAGIC_ENTITY_TYPE, FlyingItemEntityRenderer::new);

public static void regEntityRenderer(){
// 注冊實體渲染器
EntityRendererRegistry.register(EXPOLOSION_MAGIC_ENTITY_TYPE, FlyingItemEntityRenderer::new);
EntityRendererRegistry.register(POISON_MAGIC_ENTITY_TYPE, FlyingItemEntityRenderer::new);
}
}
73 changes: 46 additions & 27 deletions src/main/java/com/ictye/the_origin_of_magic/Contents/AllItem.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.ictye.the_origin_of_magic.Contents;

import com.ictye.the_origin_of_magic.foundation.Items.Magic.ExplosionMagicEntityItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.LimiterItem.UndeadEntityLimiterItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.TestMagicEntityItem;
import com.ictye.the_origin_of_magic.foundation.Items.Magic.PoisonMagicEntityItem;
import com.ictye.the_origin_of_magic.foundation.Items.Staff.DeadwoodStaff;
import com.ictye.the_origin_of_magic.foundation.Items.Staff.TestStaff;
import com.ictye.the_origin_of_magic.the_origin_of_magic;
Expand All @@ -23,18 +24,15 @@
*/
public class AllItem {

/*
所有物品組
*/

//////////////////////////////////////////////////
// 所有物品組
/**
* 主物品組
*/
public static final ItemGroup TheOriginOfMagicItemGroup = FabricItemGroupBuilder.build(new Identifier(the_origin_of_magic.Mod_Id,"normal"),
() ->new ItemStack(AllBlock.BlockItems.get("magic_workbench")));
/**
* 所有法杖
*/
() ->new ItemStack(AllBlock.BlockItems.get("magic_workbench")));
/////////////////////////////////////////////////
// 所有法杖
public static final Item DEADWOOD_STAFF = new DeadwoodStaff(new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
Expand All @@ -45,42 +43,50 @@ public class AllItem {
.group(TheOriginOfMagicItemGroup)
.maxDamage(300)
.rarity(Rarity.RARE)); // 測試法杖
/**
* 所有魔法
*/
public static final Item TEST_MAGIC = new TestMagicEntityItem(new FabricItemSettings()
//////////////////////////////////////////////
//所有魔法
public static final Item EXPLOSION_MAGIC = new ExplosionMagicEntityItem(new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup), AllEntity.TEST_MAGIC_ENTITY_TYPE); // 測試魔法
.group(TheOriginOfMagicItemGroup), AllEntity.EXPOLOSION_MAGIC_ENTITY_TYPE); // 測試魔法

public static final Item HOGLIN_ENTITY_LIMITER = new UndeadEntityLimiterItem(new FabricItemSettings()
public static final Item POISON_MAGIC = new PoisonMagicEntityItem(new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup), AllEntity.POISON_MAGIC_ENTITY_TYPE);

public static final Item HOSTILE_ENTITY_LIMITER = new UndeadEntityLimiterItem(new FabricItemSettings()
.maxCount(1)
.group(TheOriginOfMagicItemGroup)
.maxDamage(100)
.rarity(Rarity.COMMON),null);

////////////////////////////////////////////////
//所有材料
/**
* 所有材料
* 血色寶石
*/

public static final Item BLOOD_ESSENCE = new Item(new FabricItemSettings()
.group(TheOriginOfMagicItemGroup)
.rarity(Rarity.COMMON));

/**
* 水元素魔法
*/
public static final Item WATER_MAGIC_ELEMENT = new Item(new FabricItemSettings()
.group(TheOriginOfMagicItemGroup)
.rarity(Rarity.COMMON));


//////////////////////////////////////////////
// 注冊列表
/**
* 物品ID列表
*/
public static final Map<String, Item> ItemMap = Map.of(
"deadwood_staff",DEADWOOD_STAFF,
"test_staff",TEST_STAFF,
"test_magic",TEST_MAGIC,
"hoglin_entity_limiter", HOGLIN_ENTITY_LIMITER,
"explosion_magic", EXPLOSION_MAGIC,
"hostile_entity_limiter", HOSTILE_ENTITY_LIMITER,
"blood_essence",BLOOD_ESSENCE,
"water_magic_element",WATER_MAGIC_ELEMENT
"water_magic_element",WATER_MAGIC_ELEMENT,
"poison_magic",POISON_MAGIC
);

/**
Expand All @@ -89,10 +95,11 @@ public class AllItem {
public static final Map<String, Item> ItemTransMap = Map.of(
"Deadwood Staff",DEADWOOD_STAFF,
"Test Staff",TEST_STAFF,
"Test Magic",TEST_MAGIC,
"Hoglin Entity Limiter", HOGLIN_ENTITY_LIMITER,
"Explosion Magic", EXPLOSION_MAGIC,
"Hostile Entity Limiter", HOSTILE_ENTITY_LIMITER,
"Blood Essence", BLOOD_ESSENCE,
"Water Magic Element",WATER_MAGIC_ELEMENT
"Water Magic Element",WATER_MAGIC_ELEMENT,
"Poison Magic",POISON_MAGIC
);

/**
Expand All @@ -101,18 +108,30 @@ public class AllItem {
public static final Map< Item,Model> ItemModelMap = Map.of(
BLOOD_ESSENCE,Models.GENERATED,
WATER_MAGIC_ELEMENT,Models.GENERATED,
TEST_MAGIC,Models.GENERATED,
HOGLIN_ENTITY_LIMITER,Models.GENERATED
EXPLOSION_MAGIC,Models.GENERATED,
HOSTILE_ENTITY_LIMITER,Models.GENERATED,
POISON_MAGIC,Models.GENERATED
);
///////////////////////////////////////

/**
* 注冊物品
* @param name 名稱
* @param item 物品
*/
private static void registerItem(String name, Item item){
Registry.register(Registry.ITEM, new Identifier(the_origin_of_magic.Mod_Id, name), item);
}

/**
* 開始注冊物品
*/
public static void registerItems(){
// 注冊方塊物品
for (String name : AllBlock.BlockItems.keySet()) {
registerItem(name, AllBlock.BlockItems.get(name));
}

// 注冊物品
for (String name : ItemMap.keySet()) {
registerItem(name, ItemMap.get(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

/*
* 魔法工作臺
* */
Expand All @@ -33,7 +34,6 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
return ActionResult.SUCCESS;
}


@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;

/**
* 魔法工作臺的方塊實體
*/
public class MagicWorkstationBlockEntity extends BlockEntity {
public MagicWorkstationBlockEntity(BlockPos pos, BlockState state) {
super(AllBlockEntity.MAGIC_WORK_STATION_BLOCK_ENTITIY, pos, state);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.ictye.the_origin_of_magic.foundation.Entitys.Magics.EffectMagic;

import com.ictye.the_origin_of_magic.foundation.Entitys.Magics.StdMagicInterface;
import net.minecraft.world.World;

public abstract class StdEffectMagic implements StdMagicInterface {
/**
* 生產魔法特效
* @param world 世界
*/
public abstract void tick(World world);
}
Loading

0 comments on commit 18424fb

Please sign in to comment.