Skip to content

Commit b20bb2f

Browse files
committed
Fix Knight Loot
1 parent cc3d5a3 commit b20bb2f

File tree

2 files changed

+83
-17
lines changed

2 files changed

+83
-17
lines changed

src/main/resources/assets/chessmod/loot_tables/entities/knight.json

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,93 @@
11
{
22
"pools": [
3+
{
4+
"name": "chessmod:white_king",
5+
"rolls": 1,
6+
"entries": [
7+
{
8+
"type": "item",
9+
"name": "chessmod:piece",
10+
"weight": 1,
11+
"functions": [
12+
{
13+
"function": "set_nbt",
14+
"tag": "{white:1b,type:5b}"
15+
},
16+
{
17+
"function": "set_count",
18+
"count": {
19+
"min": 1,
20+
"max": 1
21+
}
22+
},
23+
{
24+
"function": "looting_enchant",
25+
"count": {
26+
"min": 1,
27+
"max": 1
28+
}
29+
}
30+
]
31+
},
32+
{
33+
"type": "empty",
34+
"weight": 100
35+
}
36+
],
37+
"conditions": [
38+
{
39+
"condition": "killed_by_player"
40+
}
41+
]
42+
},
43+
{
44+
"name": "chessmod:black_king",
45+
"rolls": 1,
46+
"entries": [
47+
{
48+
"type": "item",
49+
"name": "chessmod:piece",
50+
"weight": 1,
51+
"functions": [
52+
{
53+
"function": "set_nbt",
54+
"tag": "{white:0b,type:5b}"
55+
},
56+
{
57+
"function": "set_count",
58+
"count": {
59+
"min": 1,
60+
"max": 1
61+
}
62+
},
63+
{
64+
"function": "looting_enchant",
65+
"count": {
66+
"min": 1,
67+
"max": 1
68+
}
69+
}
70+
]
71+
},
72+
{
73+
"type": "empty",
74+
"weight": 200
75+
}
76+
],
77+
"conditions": [
78+
{
79+
"condition": "killed_by_player"
80+
}
81+
]
82+
},
383
{
484
"name": "chessmod:white_pawn",
585
"rolls": 1,
686
"entries": [
787
{
888
"type": "item",
989
"name": "chessmod:piece",
10-
"weight": 20,
90+
"weight": 10,
1191
"functions": [
1292
{
1393
"function": "set_nbt",
@@ -47,7 +127,7 @@
47127
{
48128
"type": "item",
49129
"name": "chessmod:piece",
50-
"weight": 1,
130+
"weight": 10,
51131
"functions": [
52132
{
53133
"function": "set_nbt",
@@ -56,7 +136,7 @@
56136
{
57137
"function": "set_count",
58138
"count": {
59-
"min": 0,
139+
"min": 1,
60140
"max": 1
61141
}
62142
},

src/main/scala/net/katsstuff/nightclipse/chessmod/entity/EntityKnight.scala

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,6 @@ class EntityKnight(_world: World, attackPieces: Boolean) extends EntityMob(_worl
7272
override def getLootTable: ResourceLocation =
7373
ChessMod.resource("entities/knight")
7474

75-
override def dropLoot(wasRecentlyHit: Boolean, lootingModifier: Int, source: DamageSource): Unit = {
76-
super.dropLoot(wasRecentlyHit, lootingModifier, source)
77-
78-
val color = if (rand.nextBoolean()) PieceColor.White else PieceColor.Black
79-
if(!world.isRemote) {
80-
entityDropItem(ItemPiece.stackOf(Piece(PieceType.Pawn, color)), 1)
81-
82-
if(rand.nextInt(100) == 0) {
83-
entityDropItem(ItemPiece.stackOf(Piece(PieceType.King, color)), 1)
84-
}
85-
}
86-
87-
}
88-
8975
override protected def getAmbientSound: SoundEvent = SoundEvents.ENTITY_SKELETON_AMBIENT
9076

9177
override protected def getHurtSound(damageSourceIn: DamageSource): SoundEvent = SoundEvents.ENTITY_SKELETON_HURT

0 commit comments

Comments
 (0)