Skip to content

Commit f531e7e

Browse files
committed
添加更多API,添加更多javadoc
1 parent bb19e5e commit f531e7e

File tree

9 files changed

+290
-238
lines changed

9 files changed

+290
-238
lines changed

.idea/workspace.xml

+13-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,11 @@ java {
103103
kotlin {
104104
jvmToolchain(17)
105105
}
106+
107+
// 配置Javadoc生成
108+
javadoc {
109+
options {
110+
encoding = 'UTF-8' // 设置编码格式
111+
charset = 'UTF-8'
112+
}
113+
}

src/main/java/com/crystalneko/tonekofabric/ToNekoFabric.java

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.crystalneko.tonekofabric;
22

33
import com.crystalneko.ctlibPublic.File.YamlConfiguration;
4+
import com.crystalneko.tonekofabric.api.NekoEntityEvents;
45
import com.crystalneko.tonekofabric.command.command;
56
import com.crystalneko.tonekofabric.entity.nekoEntity;
67
import com.crystalneko.tonekofabric.event.*;
@@ -25,7 +26,9 @@
2526
import net.minecraft.item.SpawnEggItem;
2627
import net.minecraft.registry.Registries;
2728
import net.minecraft.registry.Registry;
29+
import net.minecraft.util.ActionResult;
2830
import net.minecraft.util.Identifier;
31+
import net.minecraft.util.math.Vec3d;
2932
import net.minecraft.world.Heightmap;
3033

3134
import java.io.IOException;

src/main/java/com/crystalneko/tonekofabric/api/neko.java src/main/java/com/crystalneko/tonekofabric/api/Neko.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import com.crystalneko.tonekofabric.libs.base;
66
import net.minecraft.entity.LivingEntity;
77
import net.minecraft.entity.player.PlayerEntity;
8-
public class neko {
8+
public class Neko {
99
public LivingEntity entity;
1010
public PlayerEntity player;
1111
public nekoEntity nekoEnt;
1212
public String name;
13-
public neko(LivingEntity entity){
13+
public Neko(LivingEntity entity){
1414
//设置全局实体
1515
this.entity = entity;
1616
if(entity instanceof PlayerEntity){
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.crystalneko.tonekofabric.api;
2+
3+
public enum NekoEntityEnum {;
4+
public enum NameStatus {
5+
SUCCESS,FAILED,ALREADY_SET,USED,UNKNOWN
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.crystalneko.tonekofabric.api;
2+
3+
import com.crystalneko.tonekofabric.entity.nekoEntity;
4+
import net.fabricmc.fabric.api.event.Event;
5+
import net.fabricmc.fabric.api.event.EventFactory;
6+
import net.minecraft.entity.player.PlayerEntity;
7+
import net.minecraft.util.ActionResult;
8+
import net.minecraft.util.Hand;
9+
public class NekoEntityEvents {
10+
11+
/**
12+
* 玩家右键猫娘实体时的回调<br>
13+
* 它会在执行原本的代码前执行<br>
14+
* 参数:<br>
15+
* - entity: 实体<br>
16+
* - player: 玩家<br>
17+
* - hand: 玩家使用的手
18+
*/
19+
public static Event<InteractEvent> ON_INTERACT = EventFactory.createArrayBacked(InteractEvent.class,
20+
(listeners) -> (entity, player, hand) -> {
21+
for (InteractEvent listener : listeners) {
22+
ActionResult result = listener.onInteract(entity, player, hand);
23+
if (result != ActionResult.PASS) {
24+
return result;
25+
}
26+
}
27+
return ActionResult.PASS;
28+
});
29+
30+
/**
31+
* 猫娘实体成长时的回调<br>
32+
* 它会在执行原本的代码后执行<br>
33+
* 参数:<br>
34+
* - entity: 实体<br>
35+
* - age: 猫娘的年龄<br>
36+
* - overGrow: 是否过度生长
37+
*/
38+
public static Event<GrowUpEvent> GROW_UP = EventFactory.createArrayBacked(GrowUpEvent.class,
39+
(listeners) -> (entity, age, overGrow) -> {
40+
for (GrowUpEvent listener : listeners) {
41+
listener.onGrowUp(entity, age, overGrow);
42+
}
43+
});
44+
45+
public interface InteractEvent {
46+
ActionResult onInteract(nekoEntity entity, PlayerEntity player, Hand hand);
47+
}
48+
49+
public interface GrowUpEvent {
50+
void onGrowUp(nekoEntity entity, int age, boolean overGrow);
51+
}
52+
}

src/main/java/com/crystalneko/tonekofabric/api/query.java src/main/java/com/crystalneko/tonekofabric/api/Query.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import net.minecraft.entity.player.PlayerEntity;
55
import net.minecraft.world.World;
66

7-
public class query {
7+
public class Query {
88
/**
99
* 获取猫娘的主人名称
1010
* @param neko 猫娘名称

src/main/java/com/crystalneko/tonekofabric/entity/damage/StickSource.java

-13
This file was deleted.

0 commit comments

Comments
 (0)