Skip to content

Commit f907488

Browse files
committed
🎨 feat -> add Slugger spawn egg and loot table support
1 parent 456269b commit f907488

File tree

6 files changed

+91
-6
lines changed

6 files changed

+91
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"parent": "minecraft:item/template_spawn_egg"
3+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"type": "minecraft:entity",
3+
"pools": [
4+
{
5+
"bonus_rolls": 0.0,
6+
"entries": [
7+
{
8+
"type": "minecraft:item",
9+
"functions": [
10+
{
11+
"add": false,
12+
"count": {
13+
"type": "minecraft:uniform",
14+
"max": 2.0,
15+
"min": 0.0
16+
},
17+
"function": "minecraft:set_count"
18+
},
19+
{
20+
"count": {
21+
"type": "minecraft:uniform",
22+
"max": 1.0,
23+
"min": 0.0
24+
},
25+
"function": "minecraft:looting_enchant"
26+
}
27+
],
28+
"name": "minecraft:rotten_flesh"
29+
}
30+
],
31+
"rolls": 1.0
32+
},
33+
{
34+
"bonus_rolls": 0.0,
35+
"conditions": [
36+
{
37+
"condition": "minecraft:killed_by_player"
38+
},
39+
{
40+
"chance": 0.025,
41+
"condition": "minecraft:random_chance_with_looting",
42+
"looting_multiplier": 0.01
43+
}
44+
],
45+
"entries": [
46+
{
47+
"type": "minecraft:item",
48+
"name": "minecraft:iron_ingot"
49+
},
50+
{
51+
"type": "minecraft:item",
52+
"name": "minecraft:carrot"
53+
},
54+
{
55+
"type": "minecraft:item",
56+
"functions": [
57+
{
58+
"conditions": [
59+
{
60+
"condition": "minecraft:entity_properties",
61+
"entity": "this",
62+
"predicate": {
63+
"flags": {
64+
"is_on_fire": true
65+
}
66+
}
67+
}
68+
],
69+
"function": "minecraft:furnace_smelt"
70+
}
71+
],
72+
"name": "minecraft:potato"
73+
}
74+
],
75+
"rolls": 1.0
76+
}
77+
],
78+
"random_sequence": "enemyexp:entities/slugger"
79+
}

common/src/main/java/org/infernalstudios/enemyexp/setup/EEItems.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public final class EEItems {
1818

1919
public static final DeferredObject<Item> SPRINTER_SPAWN_EGG = spawnEgg("sprinter_spawn_egg", EEntities.SPRINTER.get(), -14269861, -9273797);
2020
public static final DeferredObject<Item> HAUL_SPAWN_EGG = spawnEgg("haul_spawn_egg", EEntities.HAUL.get(), 0xDEB289, 0x5A4539);
21-
21+
public static final DeferredObject<Item> SLUGGER_SPAWN_EGG = spawnEgg("slugger_spawn_egg", EEntities.SLUGGER.get(), -12244867, -10910598);
2222

2323
private EEItems() {
2424
// Prevent instantiation, why would you even want to? :p
@@ -55,7 +55,7 @@ static DeferredObject<Item> spawnEgg(String name, EntityType<? extends Mob> enti
5555
* @return The deferred object that holds the item instance
5656
*/
5757
static <T extends Item> DeferredObject<T> item(String name, Supplier<T> itemSupplier, boolean defaultModel, boolean defaultTab) {
58-
var ret = new DeferredObject<T>(itemSupplier);
58+
var ret = new DeferredObject<>(itemSupplier);
5959
items.put(name, ret);
6060
if (defaultTab) EECreativeTabs.addItem(ret);
6161
if (defaultModel) EEDataGenProcessor.addDefaultItem(name, ret);
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"item.enemyexp.sprinter_spawn_egg": "Sprinter Spawn Egg",
33
"item.enemyexp.haul_spawn_egg": "Haul Spawn Egg",
4+
"item.enemyexp.slugger_spawn_egg": "Slugger Spawn Egg",
45
"entity.enemyexp.sprinter": "Sprinter",
5-
"entity.enemyexp.haul": "Haul"
6+
"entity.enemyexp.haul": "Haul",
7+
"entity.enemyexp.slugger": "Slugger"
68
}

forge/src/main/java/org/infernalstudios/enemyexp/datagen/provider/EEItemModelProvider.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ protected void registerModels() {
2222

2323
spawnEgg(EEItems.SPRINTER_SPAWN_EGG);
2424
spawnEgg(EEItems.HAUL_SPAWN_EGG);
25+
spawnEgg(EEItems.SLUGGER_SPAWN_EGG);
2526
}
2627

2728
private void spawnEgg(DeferredObject<Item> item) {
@@ -31,9 +32,9 @@ private void spawnEgg(DeferredObject<Item> item) {
3132

3233
private void simpleItem(String name) {
3334
withExistingParent(name,
34-
new ResourceLocation("item/generated")).texture(
35+
ResourceLocation.withDefaultNamespace("item/generated")).texture(
3536
"layer0",
36-
new ResourceLocation(Constants.MOD_ID, "item/" + name)
37+
ResourceLocation.fromNamespaceAndPath(Constants.MOD_ID, "item/" + name)
3738
);
3839
}
3940
}

forge/src/main/java/org/infernalstudios/enemyexp/datagen/provider/EEntityLootTables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public EEntityLootTables() {
3131
public void generate() {
3232
this.add(EEntities.SPRINTER.get(), LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.ROTTEN_FLESH).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))).apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0.0F, 1.0F))))).withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.IRON_INGOT)).add(LootItem.lootTableItem(Items.CARROT)).add(LootItem.lootTableItem(Items.POTATO).apply(SmeltItemFunction.smelted().when(LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, ENTITY_ON_FIRE)))).when(LootItemKilledByPlayerCondition.killedByPlayer()).when(LootItemRandomChanceWithLootingCondition.randomChanceAndLootingBoost(0.025F, 0.01F))));
3333
this.add(EEntities.HAUL.get(), LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.ROTTEN_FLESH).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))).apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0.0F, 1.0F))))).withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.IRON_INGOT)).add(LootItem.lootTableItem(Items.CARROT)).add(LootItem.lootTableItem(Items.POTATO).apply(SmeltItemFunction.smelted().when(LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, ENTITY_ON_FIRE)))).when(LootItemKilledByPlayerCondition.killedByPlayer()).when(LootItemRandomChanceWithLootingCondition.randomChanceAndLootingBoost(0.025F, 0.01F))));
34-
34+
this.add(EEntities.SLUGGER.get(), LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.ROTTEN_FLESH).apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F))).apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0.0F, 1.0F))))).withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(Items.IRON_INGOT)).add(LootItem.lootTableItem(Items.CARROT)).add(LootItem.lootTableItem(Items.POTATO).apply(SmeltItemFunction.smelted().when(LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, ENTITY_ON_FIRE)))).when(LootItemKilledByPlayerCondition.killedByPlayer()).when(LootItemRandomChanceWithLootingCondition.randomChanceAndLootingBoost(0.025F, 0.01F))));
3535
}
3636

3737
@Override

0 commit comments

Comments
 (0)