Merge remote-tracking branch 'origin/1.20.4' into 1.20.4

# Conflicts:
#	src/generated/resources/.cache/9cf54cdf67e16111ec482a2a3b607e8fd75a4246
This commit is contained in:
Flanks255 2024-03-13 15:32:37 -05:00
commit e4e9108099
45 changed files with 767 additions and 53 deletions

View file

@ -1,10 +1,11 @@
// 1.20.4 2024-03-13T15:31:38.1701841 Item Recipes
// 1.20.4 2024-03-13T16:31:58.3504382 Item Recipes
d374edde9294d1a224b4b5610b50117a11328c00 data/actuallyadditions/recipes/advanced_coil.json
f67629e45d152c96f3467a90a67520f78ecf9f07 data/actuallyadditions/recipes/advanced_leaf_blower.json
d65e5a70232fa2f0e74d2a67c1cd4b0e87124242 data/actuallyadditions/recipes/basic_coil.json
ffba076ef8dfa9a7053dd1d194f92fabc3932319 data/actuallyadditions/recipes/black_quartz_ore_blasting.json
473d892c0e99d5e2381ba850583ee3aa2f8c57f4 data/actuallyadditions/recipes/black_quartz_ore_smelting.json
b59bc713a54b6398730e5a1ef105479a7e58cf3e data/actuallyadditions/recipes/booklet.json
f14292672f37036259cf72e862e698e4477e78b7 data/actuallyadditions/recipes/book_pattern.json
29e79a47f752d85438b06efefdc1eef2e09c0be6 data/actuallyadditions/recipes/canola_seeds.json
3ba50983b327aa3df390a73583cd99dc06c8efd9 data/actuallyadditions/recipes/charcoal_to_tiny.json
5499f93d172328fc4136f866c80523ecdafcf4a3 data/actuallyadditions/recipes/coal_to_tiny.json
@ -50,6 +51,7 @@ c3592647a1b6de17893a80eeb9ed214f719cc4eb data/actuallyadditions/recipes/diamond_
035937b870792a57c0db0b512b41f965af4c8195 data/actuallyadditions/recipes/double_battery.json
ac1da42089dad9779f7f8b4d143c35e910a43610 data/actuallyadditions/recipes/drill_core.json
33dc398564081b1ea8b619650b6e292231ef957d data/actuallyadditions/recipes/drill_light_blue.json
201358d5c3c6b02e02de6c35d0a6e62c6fe565eb data/actuallyadditions/recipes/drill_pattern.json
32ed85c13069aad6a213fc8481ab1455385237f2 data/actuallyadditions/recipes/drill_upgrade_block_placing.json
b18208992a1d9f48dbbcb60c373e775030c1ba5e data/actuallyadditions/recipes/drill_upgrade_five_by_five.json
f6d8d39e01e8f9802119417355fb543529ebba05 data/actuallyadditions/recipes/drill_upgrade_fortune.json
@ -70,6 +72,7 @@ a4e0e3bb72d472302f2ab4e5d282cbc7fd6882a6 data/actuallyadditions/recipes/iron_aio
0792f7ad8ae9bbe9e10951db70a41fc802a92f19 data/actuallyadditions/recipes/laser_wrench.json
04ffdbe566efb77088f7223c5d0445e906be16b6 data/actuallyadditions/recipes/laser_wrench_nbt.json
c70153bac66cc164f7c3a18f8db69ce40827832b data/actuallyadditions/recipes/leaf_blower.json
08020150e683afcccc285d06bacca85526b258fc data/actuallyadditions/recipes/leaf_blo_pattern.json
61a273ab2984142c215cecb2df2b663ae7b1a0a7 data/actuallyadditions/recipes/lens.json
1fafe233864d0a6917fd84579d7c5a3cccf25c2a data/actuallyadditions/recipes/lens_of_disenchanting.json
a1c8701211811f545dae9839f2de150167e3d3ca data/actuallyadditions/recipes/lens_of_the_killer.json
@ -77,12 +80,12 @@ bbda1becc270cf13e6b1d8e6d873aafa0951552d data/actuallyadditions/recipes/lens_of_
9c59763d7c18df2173dab694d0be2682db45f1c5 data/actuallyadditions/recipes/netherite_aiot.json
6e70b532fcfd3809938d0483acb3da13041e1663 data/actuallyadditions/recipes/phantom_clearing.json
0ab782aeb87292c1480a865c1c493aef432bff24 data/actuallyadditions/recipes/phantom_connector.json
79b7ca263600d62ae6c0ebd0838ec530bfc93d9c data/actuallyadditions/recipes/phan_con_pattern.json
4a76fa84033e80532494163fc35f60c44bdb67b5 data/actuallyadditions/recipes/player_probe.json
2f24905a9d4b0e5d3d5ecbc5a7fa3a7647f41619 data/actuallyadditions/recipes/quadruple_battery.json
80a2e4f402acab5da96bdf3acd459fce0f930c08 data/actuallyadditions/recipes/quintuple_battery.json
c6ff81ba878c02651a9353e490b3a8f9897a5410 data/actuallyadditions/recipes/rice_dough.json
bc69015bae99ad4bb1a613a7367469d4401f83ae data/actuallyadditions/recipes/rice_dough_smelting.json
36eb3f29269e14cac10af27e6cd070209446a7b8 data/actuallyadditions/recipes/rice_paper.json
5958ff2fb37430660fb22012212336320ee83dd8 data/actuallyadditions/recipes/rice_seeds.json
f6c73cb2e41a8a21e2fda888b28bf52672b33d2e data/actuallyadditions/recipes/rice_slime.json
319b2d0423b79497837f5a3f940011b3bccf09f3 data/actuallyadditions/recipes/rice_slime_potion.json

View file

@ -0,0 +1,5 @@
// 1.20.4 2024-03-13T16:25:25.7337747 Tags for minecraft:banner_pattern mod id actuallyadditions
3dd9e0b0c98a7e1c7043f53569e3bbe83d8d8f81 data/actuallyadditions/tags/banner_pattern/pattern_item/book.json
5fdfca3b16ef2b8b12a96218d4792f5dd92670cb data/actuallyadditions/tags/banner_pattern/pattern_item/drill.json
6ce4a69df9109573aeb0f2e56ff087ed6a6068d7 data/actuallyadditions/tags/banner_pattern/pattern_item/leaf_blower.json
6ed142fcbd485f7f74f5befc735deb4094b42979 data/actuallyadditions/tags/banner_pattern/pattern_item/phan_con.json

View file

@ -1,4 +1,4 @@
// 1.20.4 2024-03-09T15:15:51.411672 Item Models: actuallyadditions
// 1.20.4 2024-03-13T16:28:37.0564484 Item Models: actuallyadditions
34463d3d2ae3fafaaea338e7ffc03cd139d3cfeb assets/actuallyadditions/models/item/advanced_coil.json
24594fc68e66011dc2d7b79b92c94b387e710318 assets/actuallyadditions/models/item/advanced_leaf_blower.json
ba2d814e269cdef72e1045f200b3c20ed6961517 assets/actuallyadditions/models/item/atomic_reconstructor.json
@ -21,6 +21,7 @@ c8974657e959db31495382cf6a86a3367df5d8c9 assets/actuallyadditions/models/item/bl
74aaa894cd68cf64f8ad5aac0e7c0b26cdb0a021 assets/actuallyadditions/models/item/black_quartz_stair.json
7e8476e561bd4854b54ce79cb798fd9b2915efb4 assets/actuallyadditions/models/item/black_quartz_wall.json
a921bf283b5864b283ffff0737d8c3c89487dd08 assets/actuallyadditions/models/item/booklet.json
e02c1dcb56bd16fe497ed8a4f19c52233aa9b20e assets/actuallyadditions/models/item/book_pattern.json
8f1232a569a12d54b1053fae05dc85d23b28ed42 assets/actuallyadditions/models/item/breaker.json
a311a3b7ad53f4b3e248939aecb41edbc5539a64 assets/actuallyadditions/models/item/canola.json
fa77f5b54168ff7c11c5ce9fbe342eb7298a9ec8 assets/actuallyadditions/models/item/canola_oil_bucket.json
@ -59,6 +60,7 @@ ec5271390d19a8f654a039ce484c687f23a67ef5 assets/actuallyadditions/models/item/dr
d1a9bbc0f92cf264b361cd392b192e5eba191b15 assets/actuallyadditions/models/item/drill_lime.json
b451f12814595ac7b06ffee06eaa93249c2c0075 assets/actuallyadditions/models/item/drill_magenta.json
c5be173ce3f3c5fdc376eacbefb2e3d913a2ecc4 assets/actuallyadditions/models/item/drill_orange.json
65f60912d49440c97977e319e6ffdbfe68aae594 assets/actuallyadditions/models/item/drill_pattern.json
26a3683600670d1733f0e0be80528e1b01d1c94a assets/actuallyadditions/models/item/drill_pink.json
086647e21977dff542f6cb09c4b0f3f826f874c5 assets/actuallyadditions/models/item/drill_purple.json
a1dae4b66cce762b355ef2b5bbf399693f09b141 assets/actuallyadditions/models/item/drill_red.json
@ -157,6 +159,7 @@ a20fa6e1df0a18526f8cac045b6e0f4fcb4bf30c assets/actuallyadditions/models/item/la
05e3583ade09c7d90ddb536c5be6d3df1ce786c7 assets/actuallyadditions/models/item/lava_factory_casing.json
34573ebef541f5d9f7d62ba95205f81e1de234b4 assets/actuallyadditions/models/item/lava_factory_controller.json
df17f763590bf5c883eec492e4ab4d8dc4bdeb97 assets/actuallyadditions/models/item/leaf_blower.json
040d94359f68325e207c6635117a777a3b612c7e assets/actuallyadditions/models/item/leaf_blo_pattern.json
4a349378c423823c42c3075e145ca6e5b31631ad assets/actuallyadditions/models/item/leaf_generator.json
c86d9a24e157d61bd56b0c4dd847e93c21f9406a assets/actuallyadditions/models/item/lens.json
e3504dd0c16703f516932406b6ac26fdac7f30b1 assets/actuallyadditions/models/item/lens_of_certain_death.json
@ -180,6 +183,7 @@ b393ea03ae008aca117e8f7aa5a2d69ef36b827b assets/actuallyadditions/models/item/ph
57c38461980802bef0a353a335eb470d36afd803 assets/actuallyadditions/models/item/phantom_liquiface.json
974194113a4b6bf1e101cc4a2b826cdc067204ef assets/actuallyadditions/models/item/phantom_placer.json
3eb4d917b6a1ad3a5512b505853cb2bc361e9942 assets/actuallyadditions/models/item/phantom_redstoneface.json
57dd3274f49361ca5954d8202453c12a250f1241 assets/actuallyadditions/models/item/phan_con_pattern.json
bc0ddfda095c4b5ee092c5a3e4d0b6ba920c2d63 assets/actuallyadditions/models/item/placer.json
39c58314ca0c6a71223dd2e52e91ec1371831a74 assets/actuallyadditions/models/item/player_interface.json
6bd69a7b1644ed47ebc115b3e3168f78b47a5609 assets/actuallyadditions/models/item/player_probe.json

View file

@ -0,0 +1,4 @@
// 1.20.4 2024-03-13T03:30:52.2359302 Global Loot Modifiers : actuallyadditions
c314f845c2f475a0e11bbbeaf9ce082f283e84ed data/actuallyadditions/loot_modifiers/bat_loot.json
f77519b3b0453bb66d43569f8c67e59de6e49a2f data/actuallyadditions/loot_modifiers/dungeon_loot.json
24211d6853742ccd8fc0116f93710ef5ee759c29 data/neoforge/loot_modifiers/global_loot_modifiers.json

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "actuallyadditions:item/book_pattern"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "actuallyadditions:item/drill_pattern"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "actuallyadditions:item/leaf_blo_pattern"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "actuallyadditions:item/phan_con_pattern"
}
}

View file

@ -0,0 +1,12 @@
{
"type": "actuallyadditions:bat_loot",
"conditions": [
{
"condition": "minecraft:killed_by_player"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:entities/bat"
}
]
}

View file

@ -0,0 +1,46 @@
{
"type": "actuallyadditions:dungeon_loot",
"conditions": [
{
"condition": "minecraft:any_of",
"terms": [
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/simple_dungeon"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/abandoned_mineshaft"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/village/village_weaponsmith"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/stronghold_library"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/igloo_chest"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/desert_pyramid"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/nether_bridge"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/end_city_treasure"
},
{
"condition": "neoforge:loot_table_id",
"loot_table_id": "minecraft:chests/woodland_mansion"
}
]
}
]
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:booklet"
},
{
"item": "minecraft:paper"
}
],
"result": {
"item": "actuallyadditions:book_pattern"
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:drill_core"
},
{
"item": "minecraft:paper"
}
],
"result": {
"item": "actuallyadditions:drill_pattern"
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:leaf_blower"
},
{
"item": "minecraft:paper"
}
],
"result": {
"item": "actuallyadditions:leaf_blo_pattern"
}
}

View file

@ -0,0 +1,15 @@
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": [
{
"item": "actuallyadditions:phantom_connector"
},
{
"item": "minecraft:paper"
}
],
"result": {
"item": "actuallyadditions:phan_con_pattern"
}
}

View file

@ -0,0 +1,5 @@
{
"values": [
"actuallyadditions:book"
]
}

View file

@ -0,0 +1,5 @@
{
"values": [
"actuallyadditions:drill"
]
}

View file

@ -0,0 +1,5 @@
{
"values": [
"actuallyadditions:leaf_blo"
]
}

View file

@ -0,0 +1,5 @@
{
"values": [
"actuallyadditions:phan_con"
]
}

View file

@ -0,0 +1,7 @@
{
"entries": [
"actuallyadditions:dungeon_loot",
"actuallyadditions:bat_loot"
],
"replace": false
}

View file

@ -8,12 +8,14 @@ import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BannerPattern;
public final class ActuallyTags {
public static final void init() {
// lol
Items.touch();
Blocks.touch();
BannerPatterns.touch();
}
public static class Items {
public static void touch() {
@ -64,4 +66,19 @@ public final class ActuallyTags {
return TagKey.create(Registries.BLOCK, new ResourceLocation(ActuallyAdditions.MODID, name));
}
}
public static class BannerPatterns {
public static void touch() {
// load the stupid tags
}
public static final TagKey<BannerPattern> PATTERN_DRILL = tag("pattern_item/drill");
public static final TagKey<BannerPattern> PATTERN_LEAF_BLO = tag("pattern_item/leaf_blower");
public static final TagKey<BannerPattern> PATTERN_PHAN_CON = tag("pattern_item/phan_con");
public static final TagKey<BannerPattern> PATTERN_BOOK = tag("pattern_item/book");
private static TagKey<BannerPattern> tag(String name) {
return TagKey.create(Registries.BANNER_PATTERN, new ResourceLocation(ActuallyAdditions.MODID, name));
}
}
}

View file

@ -48,6 +48,7 @@ public class ActuallyAdditionsData {
generator.addProvider(true, new ItemTagsGenerator(packOutput, lookupProvider, generatorBlockTags, helper));
generator.addProvider(true, new PoiTypeTagsGenerator(packOutput, lookupProvider, helper));
generator.addProvider(true, new DamageTypeTagsGenerator(packOutput, lookupProvider, helper));
generator.addProvider(true, new BannerPatternTagsGenerator(packOutput, lookupProvider, helper));
generator.addProvider(true, new BlockStateGenerator(packOutput, helper));
generator.addProvider(true, new ItemModelGenerator(packOutput, helper));
@ -66,6 +67,8 @@ public class ActuallyAdditionsData {
generator.addProvider(true, new PachouliGenerator(packOutput));
generator.addProvider(true, new GlobalLootModifierGenerator(packOutput));
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
packOutput, patchedProvider, Set.of(ActuallyAdditions.MODID)));
}

View file

@ -0,0 +1,26 @@
package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.tags.BannerPatternTagsProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.CompletableFuture;
public class BannerPatternTagsGenerator extends BannerPatternTagsProvider {
public BannerPatternTagsGenerator(PackOutput output, CompletableFuture<HolderLookup.Provider> completableFuture, @Nullable ExistingFileHelper fileHelper) {
super(output, completableFuture, ActuallyAdditions.MODID, fileHelper);
}
@Override
protected void addTags(HolderLookup.Provider pProvider) {
this.tag(ActuallyTags.BannerPatterns.PATTERN_DRILL).add(BannerHelper.DRILL.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_LEAF_BLO).add(BannerHelper.LEAF_BLO.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_PHAN_CON).add(BannerHelper.PHAN_CON.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_BOOK).add(BannerHelper.BOOK.getKey());
}
}

View file

@ -0,0 +1,42 @@
package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.lootmodifier.BatLootModifier;
import de.ellpeck.actuallyadditions.mod.lootmodifier.DungeonLootModifier;
import net.minecraft.data.PackOutput;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.predicates.AnyOfCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemKilledByPlayerCondition;
import net.neoforged.neoforge.common.data.GlobalLootModifierProvider;
import net.neoforged.neoforge.common.loot.LootTableIdCondition;
public class GlobalLootModifierGenerator extends GlobalLootModifierProvider {
public GlobalLootModifierGenerator(PackOutput packOutput) {
super(packOutput, ActuallyAdditions.MODID);
}
@Override
protected void start() {
this.add("bat_loot", new BatLootModifier(
new LootItemCondition[]{
LootItemKilledByPlayerCondition.killedByPlayer().build(),
LootTableIdCondition.builder(EntityType.BAT.getDefaultLootTable()).build()
}));
this.add("dungeon_loot", new DungeonLootModifier(
new LootItemCondition[]{
AnyOfCondition.anyOf(
LootTableIdCondition.builder(BuiltInLootTables.SIMPLE_DUNGEON),
LootTableIdCondition.builder(BuiltInLootTables.ABANDONED_MINESHAFT),
LootTableIdCondition.builder(BuiltInLootTables.VILLAGE_WEAPONSMITH),
LootTableIdCondition.builder(BuiltInLootTables.STRONGHOLD_LIBRARY),
LootTableIdCondition.builder(BuiltInLootTables.IGLOO_CHEST),
LootTableIdCondition.builder(BuiltInLootTables.DESERT_PYRAMID),
LootTableIdCondition.builder(BuiltInLootTables.NETHER_BRIDGE),
LootTableIdCondition.builder(BuiltInLootTables.END_CITY_TREASURE),
LootTableIdCondition.builder(BuiltInLootTables.WOODLAND_MANSION)
).build()
}));
}
}

View file

@ -10,7 +10,12 @@ import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import de.ellpeck.actuallyadditions.mod.util.RecipeInjector;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.*;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
@ -551,6 +556,24 @@ public class ItemRecipeGenerator extends RecipeProvider {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem()), RecipeCategory.MISC, ActuallyItems.BLACK_QUARTZ.get(), 0.7F, 100)
.unlockedBy("", has(Items.AIR))
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "black_quartz_ore_blasting"));
//Patterns
Recipe.shapeless(ActuallyItems.DRILL_PATTERN.get())
.requires(ActuallyItems.DRILL_CORE.get())
.requires(Items.PAPER)
.save(recipeOutput);
Recipe.shapeless(ActuallyItems.LEAF_BLO_PATTERN.get())
.requires(ActuallyItems.LEAF_BLOWER.get())
.requires(Items.PAPER)
.save(recipeOutput);
Recipe.shapeless(ActuallyItems.PHAN_CON_PATTERN.get())
.requires(ActuallyItems.PHANTOM_CONNECTOR.get())
.requires(Items.PAPER)
.save(recipeOutput);
Recipe.shapeless(ActuallyItems.BOOK_PATTERN.get())
.requires(ActuallyItems.ITEM_BOOKLET.get())
.requires(Items.PAPER)
.save(recipeOutput);
}
protected void generateAOIT(RecipeOutput consumer) {

View file

@ -35,6 +35,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.Worm;
import de.ellpeck.actuallyadditions.mod.lootmodifier.ActuallyLootModifiers;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
@ -116,6 +117,8 @@ public class ActuallyAdditions {
ActuallyVillagers.init(eventBus);
ActuallyPOITypes.init(eventBus);
ActuallyAttachments.init(eventBus);
ActuallyLootModifiers.init(eventBus);
BannerHelper.init(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus);
CONDITION_CODECS.register(eventBus);
@ -159,7 +162,6 @@ public class ActuallyAdditions {
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
new UpdateChecker();
BannerHelper.init();
InitEntities.init(); // todo: [port] replace
//AAWorldGen gen = new AAWorldGen();
ItemCoffee.initIngredients();

View file

@ -12,20 +12,30 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable;
public class BlockItemInterfaceHopping extends BlockItemInterface {
public static final DirectionProperty FACING = BlockStateProperties.FACING_HOPPER;
public BlockItemInterfaceHopping() {
super();
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.DOWN));
}
@Override
@ -44,4 +54,26 @@ public class BlockItemInterfaceHopping extends BlockItemInterface {
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> entityType) {
return level.isClientSide? TileEntityItemInterfaceHopping::clientTick : TileEntityItemInterfaceHopping::serverTick;
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
Direction direction = pContext.getClickedFace().getOpposite();
return this.defaultBlockState()
.setValue(FACING, direction.getAxis() == Direction.Axis.Y ? Direction.DOWN : direction);
}
@Override
public BlockState rotate(BlockState pState, Rotation pRotation) {
return pState.setValue(FACING, pRotation.rotate(pState.getValue(FACING)));
}
@Override
public BlockState mirror(BlockState pState, Mirror pMirror) {
return pState.rotate(pMirror.getRotation(pState.getValue(FACING)));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
pBuilder.add(FACING);
}
}

View file

@ -87,6 +87,7 @@ public class CommonConfig {
public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK;
public static ModConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
public static ModConfigSpec.BooleanValue DO_CAT_DROPS;
public static ModConfigSpec.BooleanValue DO_BAT_DROPS;
public static ModConfigSpec.IntValue FUR_CHANCE;
public static ModConfigSpec.BooleanValue WORMS;
public static ModConfigSpec.IntValue WORMS_DIE_TIME;
@ -121,6 +122,9 @@ public class CommonConfig {
DO_CAT_DROPS = BUILDER.comment("If true, Cats drop Hairy Balls Occasionally.")
.define("doCatDrops", true);
DO_BAT_DROPS = BUILDER.comment("Should Bat wings drop from Bats?")
.define("doBatDrops", true);
FUR_CHANCE = BUILDER.comment("The 1/n drop chance, per tick, for a fur ball to be dropped.")
.defineInRange("furDropChance", 5000, 1, Integer.MAX_VALUE);

View file

@ -12,34 +12,46 @@ package de.ellpeck.actuallyadditions.mod.event;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.inventory.gui.EnergyDisplay;
import de.ellpeck.actuallyadditions.mod.items.DrillItem;
import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade;
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent;
import net.neoforged.neoforge.client.event.RenderHighlightEvent;
import net.neoforged.neoforge.client.gui.overlay.GuiOverlayManager;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;
import java.util.List;
@OnlyIn(Dist.CLIENT)
public class ClientEvents {
@ -227,6 +239,46 @@ public class ClientEvents {
}
}
@SubscribeEvent
public void renderBlockHighlight(RenderHighlightEvent.Block event) {
Minecraft mc = Minecraft.getInstance();
Player player = mc.player;
if (mc.player == null)
return;
ItemStack stack = player.getMainHandItem();
if (stack.getItem() instanceof DrillItem drillItem) {
if (!player.isShiftKeyDown() && drillItem.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) {
Level level = player.level();
Vec3 vec3 = event.getCamera().getPosition();
double d0 = vec3.x();
double d1 = vec3.y();
double d2 = vec3.z();
BlockHitResult blockHitResult = event.getTarget();
BlockPos targetPos = blockHitResult.getBlockPos();
BlockState blockState = level.getBlockState(targetPos);
VertexConsumer lineConsumer = event.getMultiBufferSource().getBuffer(RenderType.lines());
if (stack.isCorrectToolForDrops(blockState)) {
int radius = 0;
if (drillItem.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)) {
radius = 2;
} else if (drillItem.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)) {
radius = 1;
}
if (radius == 0) return; //No radius, no need to render extra hitboxes
List<BlockPos> coords = drillItem.gatherBreakingPositions(stack, radius, level, targetPos, blockHitResult.getDirection(), player);
for (BlockPos blockPos : coords) {
if (blockPos.equals(targetPos)) continue; //Let the original event draw this one!
AssetUtil.renderHitOutline(event.getPoseStack(), lineConsumer, player, d0, d1, d2, level, blockPos, level.getBlockState(blockPos));
}
}
}
}
}
/* @SubscribeEvent //TODO someday move the laser rendering to a new system
public void onRenderStage(final RenderLevelStageEvent event) {
if(event.getStage() == RenderLevelStageEvent.Stage.AFTER_SOLID_BLOCKS) {

View file

@ -12,12 +12,14 @@ package de.ellpeck.actuallyadditions.mod.items;
import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.AABlockItem;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
import net.minecraft.world.item.BannerPatternItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Tiers;
@ -179,6 +181,12 @@ public final class ActuallyItems {
public static final DeferredItem<AllInOneTool> DIAMOND_AIOT = ITEMS.register("diamond_aiot", () -> new AllInOneTool(Tiers.DIAMOND));
public static final DeferredItem<AllInOneTool> NETHERITE_AIOT = ITEMS.register("netherite_aiot", () -> new AllInOneTool(Tiers.NETHERITE));
// Banner Pattern
public static final DeferredItem<BannerPatternItem> DRILL_PATTERN = ITEMS.register("drill_pattern", () -> new BannerPatternItem(ActuallyTags.BannerPatterns.PATTERN_DRILL, defaultNonStacking()));
public static final DeferredItem<BannerPatternItem> LEAF_BLO_PATTERN = ITEMS.register("leaf_blo_pattern", () -> new BannerPatternItem(ActuallyTags.BannerPatterns.PATTERN_LEAF_BLO, defaultNonStacking()));
public static final DeferredItem<BannerPatternItem> PHAN_CON_PATTERN = ITEMS.register("phan_con_pattern", () -> new BannerPatternItem(ActuallyTags.BannerPatterns.PATTERN_PHAN_CON, defaultNonStacking()));
public static final DeferredItem<BannerPatternItem> BOOK_PATTERN = ITEMS.register("book_pattern", () -> new BannerPatternItem(ActuallyTags.BannerPatterns.PATTERN_BOOK, defaultNonStacking()));
public static final Set<DeferredItem<? extends Item>> SIMPLE_ITEMS = ImmutableSet.of(
// Crystals
BLACK_QUARTZ, RESTONIA_CRYSTAL, PALIS_CRYSTAL, DIAMATINE_CRYSTAL,
@ -199,7 +207,7 @@ public final class ActuallyItems {
/* CRUSHED_IRON, CRUSHED_GOLD, CRUSHED_DIAMOND, CRUSHED_EMERALD, CRUSHED_LAPIS,
CRUSHED_QUARTZ, CRUSHED_COAL, CRUSHED_BLACK_QUARTZ, */
SOLIDIFIED_EXPERIENCE,
COFFEE_BEANS, RICE_SEEDS, CANOLA_SEEDS, FLAX_SEEDS
COFFEE_BEANS, RICE_SEEDS, CANOLA_SEEDS, FLAX_SEEDS, DRILL_PATTERN, LEAF_BLO_PATTERN, PHAN_CON_PATTERN, BOOK_PATTERN
);
public static final Set<DeferredItem<? extends Item>> TOOLS = ImmutableSet.of(

View file

@ -54,6 +54,7 @@ import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.items.IItemHandlerModifiable;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class DrillItem extends ItemEnergy {
@ -457,6 +458,77 @@ public class DrillItem extends ItemEnergy {
return true;
}
/**
* Generate a list of block positions that can be broken taking radius, poker and side into account
* @param stack The Drill
* @param radius The Radius to break Blocks in (0 means only 1 Block will be broken!)
* @param world The World
* @param aPos The position of the block being broken
* @param side The side of the block being broken
* @param player The Player who breaks the Blocks
* @return A list of block positions that can be broken
*/
public List<BlockPos> gatherBreakingPositions(ItemStack stack, int radius, Level world, BlockPos aPos, Direction side, Player player) {
int energyStored = this.getEnergyStored(stack);
List<BlockPos> positions = new ArrayList<>();
int xRange = radius;
int yRange = radius;
int zRange = 0;
//Corrects Blocks to hit depending on Side of original Block hit
if (side.getAxis() == Direction.Axis.Y) {
zRange = radius;
yRange = 0;
}
if (side.getAxis() == Direction.Axis.X) {
xRange = 0;
zRange = radius;
}
//Not defined later because main Block is getting broken below
BlockState state = world.getBlockState(aPos);
float mainHardness = state.getDestroySpeed(world, aPos);
//Break Middle Block first
int use = this.getEnergyUsePerBlock(stack);
if (energyStored < use) {
return positions;
}
if (radius == 2 && side.getAxis() != Direction.Axis.Y) {
aPos = aPos.above();
BlockState theState = world.getBlockState(aPos);
if (theState.getDestroySpeed(world, aPos) <= mainHardness + 5.0F) {
positions.add(aPos.immutable());
}
}
//Break Blocks around
if (radius > 0 && mainHardness >= 0.2F) {
for (int xPos = aPos.getX() - xRange; xPos <= aPos.getX() + xRange; xPos++) {
for (int yPos = aPos.getY() - yRange; yPos <= aPos.getY() + yRange; yPos++) {
for (int zPos = aPos.getZ() - zRange; zPos <= aPos.getZ() + zRange; zPos++) {
if (!(aPos.getX() == xPos && aPos.getY() == yPos && aPos.getZ() == zPos)) {
if (energyStored >= use) {
//Only break Blocks around that are (about) as hard or softer
BlockPos thePos = new BlockPos(xPos, yPos, zPos);
BlockState theState = world.getBlockState(thePos);
if (theState.getDestroySpeed(world, thePos) <= mainHardness + 5.0F) {
energyStored -= use;
positions.add(thePos.immutable());
}
} else {
return positions;
}
}
}
}
}
}
return positions;
}
/**
* Tries to harvest a certain Block
* Breaks the Block, drops Particles etc.

View file

@ -0,0 +1,21 @@
package de.ellpeck.actuallyadditions.mod.lootmodifier;
import com.mojang.serialization.Codec;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import java.util.function.Supplier;
public class ActuallyLootModifiers {
private static final DeferredRegister<Codec<? extends IGlobalLootModifier>> GLM = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, ActuallyAdditions.MODID);
public static final Supplier<Codec<? extends IGlobalLootModifier>> BAT_LOOT = GLM.register("bat_loot", BatLootModifier.CODEC);
public static final Supplier<Codec<? extends IGlobalLootModifier>> DUNGEON_LOOT = GLM.register("dungeon_loot", DungeonLootModifier.CODEC);
public static void init(IEventBus evt) {
GLM.register(evt);
}
}

View file

@ -0,0 +1,47 @@
package de.ellpeck.actuallyadditions.mod.lootmodifier;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.ambient.Bat;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.common.loot.LootModifier;
public class BatLootModifier extends LootModifier {
public static final Supplier<Codec<BatLootModifier>> CODEC = Suppliers.memoize(() ->
RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, BatLootModifier::new)));
public BatLootModifier(LootItemCondition[] conditionsIn) {
super(conditionsIn);
}
@Override
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
RandomSource random = context.getRandom();
if (CommonConfig.Other.DO_BAT_DROPS.get() &&
context.hasParam(LootContextParams.KILLER_ENTITY) &&
context.hasParam(LootContextParams.DAMAGE_SOURCE) &&
context.hasParam(LootContextParams.THIS_ENTITY) &&
context.getParam(LootContextParams.THIS_ENTITY) instanceof Bat) {
int looting = context.getLootingModifier();
if (random.nextInt(15) <= looting * 2) {
generatedLoot.add(new ItemStack(ActuallyItems.BATS_WING.get(), random.nextInt(2 + looting) + 1));
}
}
return generatedLoot;
}
@Override
public Codec<? extends IGlobalLootModifier> codec() {
return CODEC.get();
}
}

View file

@ -0,0 +1,141 @@
package de.ellpeck.actuallyadditions.mod.lootmodifier;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.neoforged.neoforge.common.loot.IGlobalLootModifier;
import net.neoforged.neoforge.common.loot.LootModifier;
public class DungeonLootModifier extends LootModifier {
public static final Supplier<Codec<DungeonLootModifier>> CODEC = Suppliers.memoize(() ->
RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, DungeonLootModifier::new)));
public DungeonLootModifier(LootItemCondition[] conditionsIn) {
super(conditionsIn);
}
@Override
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
RandomSource random = context.getRandom();
if (CommonConfig.Other.DUNGEON_LOOT.get()) {
ResourceLocation lootTable = context.getQueriedLootTableId();
boolean addCrystals = false;
boolean addDrillCore = false;
boolean addQuartz = false;
boolean addBatWings = false;
if (BuiltInLootTables.SIMPLE_DUNGEON.equals(lootTable)) {
addCrystals = true;
addDrillCore = true;
addQuartz = true;
} else if (BuiltInLootTables.ABANDONED_MINESHAFT.equals(lootTable)) {
addCrystals = true;
addDrillCore = true;
} else if (BuiltInLootTables.VILLAGE_WEAPONSMITH.equals(lootTable)) {
addDrillCore = true;
addQuartz = true;
} else if (BuiltInLootTables.STRONGHOLD_LIBRARY.equals(lootTable)) {
addBatWings = true;
} else if (BuiltInLootTables.IGLOO_CHEST.equals(lootTable)) {
addBatWings = true;
} else if (BuiltInLootTables.DESERT_PYRAMID.equals(lootTable)) {
addDrillCore = true;
addBatWings = true;
} else if (BuiltInLootTables.NETHER_BRIDGE.equals(lootTable)) {
addBatWings = true;
addCrystals = true;
addDrillCore = true;
} else if (BuiltInLootTables.END_CITY_TREASURE.equals(lootTable)) {
addBatWings = true;
addCrystals = true;
addDrillCore = true;
addQuartz = true;
} else if (BuiltInLootTables.WOODLAND_MANSION.equals(lootTable)) {
addBatWings = true;
addCrystals = true;
addDrillCore = true;
addQuartz = true;
}
if (addCrystals) {
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(0, TheCrystals.values().length - 1));
// LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 3));
// LootFunction[] functions = new LootFunction[] { damage, amount };
// pool.addEntry(new LootEntryItem(InitItems.itemCrystal, 20, 0, functions, noCondition, ActuallyAdditions.MODID + ":crystalItems"));
// pool.addEntry(new LootEntryItem(Item.getItemFromBlock(InitBlocks.blockCrystal), 3, 0, functions, noCondition, ActuallyAdditions.MODID + ":crystalBlocks"));
if (random.nextInt(5) == 0) {
int count = random.nextInt(3) + 1;
Item crystal = getRandomItem(random, ActuallyTags.Items.CRYSTALS, ActuallyItems.RESTONIA_CRYSTAL.get());
generatedLoot.add(new ItemStack(crystal, count));
}
if (random.nextInt(15) == 0) {
int count = random.nextInt(3) + 1;
Item crystal = getRandomItem(random, ActuallyTags.Items.CRYSTAL_BLOCKS, ActuallyBlocks.RESTONIA_CRYSTAL.getItem());
generatedLoot.add(new ItemStack(crystal, count));
}
}
if (addDrillCore) {
System.out.println("Deciding to add drill core or not");
if (random.nextInt(10) == 0) {
generatedLoot.add(new ItemStack(ActuallyItems.DRILL_CORE.get()));
}
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.DRILL_CORE.ordinal()));
// pool.addEntry(new LootEntryItem(InitItems.itemMisc, 5, 0, new LootFunction[] { damage }, noCondition, ActuallyAdditions.MODID + ":drillCore"));
}
if (addQuartz) {
if (random.nextInt(5) == 0) {
int count = random.nextInt(5) + 1;
generatedLoot.add(new ItemStack(ActuallyItems.BLACK_QUARTZ.get(), count));
}
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.QUARTZ.ordinal()));
// LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 5));
// pool.addEntry(new LootEntryItem(InitItems.itemMisc, 20, 0, new LootFunction[] { damage, amount }, noCondition, ActuallyAdditions.MODID + ":quartz"));
}
if (addBatWings) {
if (random.nextInt(10) == 0) {
int count = random.nextInt(2) + 1;
generatedLoot.add(new ItemStack(ActuallyItems.BATS_WING.get(), count));
}
// LootFunction damage = new SetMetadata(noCondition, new RandomValueRange(TheMiscItems.BAT_WING.ordinal()));
// LootFunction amount = new SetCount(noCondition, new RandomValueRange(1, 2));
// pool.addEntry(new LootEntryItem(InitItems.itemMisc, 5, 0, new LootFunction[] { damage, amount }, noCondition, ActuallyAdditions.MODID + ":batWings"));
}
}
return generatedLoot;
}
private Item getRandomItem(RandomSource random, TagKey<Item> tagKey, Item defaultItem) {
HolderSet.Named<Item> holderSet = BuiltInRegistries.ITEM.getTag(tagKey).orElse(null);
if (holderSet != null) {
Holder<Item> itemHolder = holderSet.getRandomElement(random).orElse(null);
if (itemHolder != null) {
return itemHolder.value();
}
}
return defaultItem;
}
@Override
public Codec<? extends IGlobalLootModifier> codec() {
return CODEC.get();
}
}

View file

@ -11,39 +11,21 @@
package de.ellpeck.actuallyadditions.mod.misc;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.entity.BannerPattern;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;
public final class BannerHelper {
public static final DeferredRegister<BannerPattern> BANNER_PATTERNS = DeferredRegister.create(BuiltInRegistries.BANNER_PATTERN, ActuallyAdditions.MODID);
public static void init() {
addCraftingPattern("drill", new ItemStack(ActuallyItems.DRILL_MAIN.get()));
addCraftingPattern("leaf_blo", new ItemStack(ActuallyItems.LEAF_BLOWER.get()));
addCraftingPattern("phan_con", new ItemStack(ActuallyItems.PHANTOM_CONNECTOR.get()));
addCraftingPattern("book", new ItemStack(ActuallyItems.ITEM_BOOKLET.get()));
public static DeferredHolder<BannerPattern, BannerPattern> DRILL = BANNER_PATTERNS.register("drill", () -> new BannerPattern(ActuallyAdditions.MODID + ":drill"));
public static DeferredHolder<BannerPattern, BannerPattern> LEAF_BLO = BANNER_PATTERNS.register("leaf_blo", () -> new BannerPattern(ActuallyAdditions.MODID + ":leaf_blo"));
public static DeferredHolder<BannerPattern, BannerPattern> PHAN_CON = BANNER_PATTERNS.register("phan_con", () -> new BannerPattern(ActuallyAdditions.MODID + ":phan_con"));
public static DeferredHolder<BannerPattern, BannerPattern> BOOK = BANNER_PATTERNS.register("book", () -> new BannerPattern(ActuallyAdditions.MODID + ":book"));
public static void init(IEventBus eventBus) {
BANNER_PATTERNS.register(eventBus);
}
/**
* (Excerpted from Additional Banners by Darkhax with permission, thanks!)
* <p>
* Adds a new banner pattern to the game. This banner pattern will be applied by using the
* provided item in a crafting recipe with the banner.
*
* @param name The name of the banner pattern. This is used for the texture file, and is
* also converted into upper case and used for the enum entry. Given how this
* system works, it's critical that this value is unique, consider adding the
* mod id to the name.
* //@param id A small string used to represent the pattern without taking up much space. An
* example of this is "bri". Given how the system works, it is critical that
* this is a unique value. please consider adding the mod id to the pattern id.
* @param craftingStack An ItemStack which is used in the crafting recipe for this pattern.
* An example of this would be the creeper skull being used for the creeper
* pattern.
*/
public static void addCraftingPattern(String name, ItemStack craftingStack) {
Class<?>[] paramTypes = {String.class, String.class, ItemStack.class};
Object[] paramValues = {ActuallyAdditions.MODID + "_" + name, ActuallyAdditions.MODID + "_" + name, craftingStack};
// EnumHelper.addEnum(BannerPattern.class, (ActuallyAdditions.MODID + "_" + name).toUpperCase(Locale.ROOT), paramTypes, paramValues); //TODO wth banners
}
}

View file

@ -75,7 +75,8 @@ public abstract class TileEntityBase extends BlockEntity {
@Override
public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) {
this.readSyncableNBT(pkt.getTag(), NBTType.SYNC);
if (pkt.getTag() != null) //TODO: pkt.getTag() is nullable. Hopping Item Interface will throw in the log when placed because of this
this.readSyncableNBT(pkt.getTag(), NBTType.SYNC);
}
@Override

View file

@ -198,16 +198,15 @@ public class TileEntityItemInterface extends TileEntityBase {
int slotsQueried = 0;
for (GenericItemHandlerInfo info : this.genericInfos) {
if (!info.isLoaded()) continue;
for (SlotlessableItemHandlerWrapper handler : info.handlers) {
Optional<IItemHandler> normalHandler = Optional.ofNullable(handler.getNormalHandler());
slotsQueried += normalHandler.map(cap -> {
int queried = 0;
for (int i = 0; i < cap.getSlots(); i++) {
this.itemHandlerInfos.put(queried, new IItemHandlerInfo(cap, i, info.relayInQuestion));
queried++;
IItemHandler normalHandler = handler.getNormalHandler();
if (normalHandler != null) {
for (int i = 0; i < normalHandler.getSlots(); i++) {
this.itemHandlerInfos.put(slotsQueried, new IItemHandlerInfo(normalHandler, i, info.relayInQuestion));
slotsQueried++;
}
return queried;
}).orElse(0);
}
// TODO: [port] add back
// if (ActuallyAdditions.commonCapsLoaded) {

View file

@ -24,6 +24,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.AABB;
import net.neoforged.neoforge.capabilities.Capabilities;
import net.neoforged.neoforge.items.IItemHandler;
@ -61,7 +62,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
List<ItemEntity> items = level.getEntities(EntityType.ITEM, axisAlignedBB, EntitySelector.ENTITY_STILL_ALIVE);
if (items != null && !items.isEmpty()) {
for (ItemEntity item : items) {
if (item != null && item.isAlive()) {
if (item != null) {
if (ActuallyAdditions.commonCapsLoaded) {
Object slotless = tile.itemHandler.getSlotlessHandler();
// TODO: [port] add back?
@ -78,11 +79,12 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
Optional<IItemHandler> handler = Optional.ofNullable(tile.itemHandler.getNormalHandler());
handler.ifPresent(cap -> {
System.out.println(cap.getSlots());
for (int i = 0; i < cap.getSlots(); i++) {
ItemStack left = cap.insertItem(i, item.getItem(), false);
item.setItem(left);
if (!StackUtil.isValid(left)) {
if (left.isEmpty()) {
item.discard();
break;
}
@ -125,8 +127,7 @@ public class TileEntityItemInterfaceHopping extends TileEntityItemInterface {
}
BlockState state = this.level.getBlockState(this.getBlockPos());
//Direction facing = state.getValue(BlockStateProperties.FACING);
Direction facing = Direction.DOWN; //TODO temp, facing missing
Direction facing = state.getValue(BlockStateProperties.FACING_HOPPER);
BlockPos toPos = this.getBlockPos().relative(facing);
if (this.level.isLoaded(toPos)) {

View file

@ -36,13 +36,19 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.client.ClientHooks;
@ -423,4 +429,43 @@ public final class AssetUtil {
}
return new float[]{0.0f, (pos -= 170.0f) * 3.0f, 255.0f - pos * 3.0f};
}
@OnlyIn(Dist.CLIENT)
public static void renderHitOutline(PoseStack poseStack, VertexConsumer consumer, Entity entity,
double camX, double camY, double camZ, Level level, BlockPos pos, BlockState state) {
renderShape(poseStack, consumer, state.getShape(level, pos, CollisionContext.of(entity)),
(double) pos.getX() - camX,
(double) pos.getY() - camY,
(double) pos.getZ() - camZ,
0.0F,
0.0F,
0.0F,
0.4F
);
}
@OnlyIn(Dist.CLIENT)
private static void renderShape(PoseStack poseStack, VertexConsumer consumer, VoxelShape shape,
double x, double y, double z, float red, float green, float blue, float alpha) {
PoseStack.Pose posestack$pose = poseStack.last();
shape.forAllEdges(
(minX, minY, minZ, maxX, maxY, maxZ) -> {
float f = (float) (maxX - minX);
float f1 = (float) (maxY - minY);
float f2 = (float) (maxZ - minZ);
float f3 = Mth.sqrt(f * f + f1 * f1 + f2 * f2);
f /= f3;
f1 /= f3;
f2 /= f3;
consumer.vertex(posestack$pose.pose(), (float) (minX + x), (float) (minY + y), (float) (minZ + z))
.color(red, green, blue, alpha)
.normal(posestack$pose.normal(), f, f1, f2)
.endVertex();
consumer.vertex(posestack$pose.pose(), (float) (maxX + x), (float) (maxY + y), (float) (maxZ + z))
.color(red, green, blue, alpha)
.normal(posestack$pose.normal(), f, f1, f2)
.endVertex();
}
);
}
}

View file

@ -41,6 +41,7 @@ import net.neoforged.neoforge.event.EventHooks;
import net.neoforged.neoforge.event.level.BlockEvent.BreakEvent;
import net.neoforged.neoforge.fluids.FluidStack;
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
import net.neoforged.neoforge.items.IItemHandler;
import java.util.ArrayList;
import java.util.List;
@ -94,7 +95,7 @@ public final class WorldUtil {
}
if (!StackUtil.isValid(extracted)) {
/* IItemHandler handler = extractWrapper.getNormalHandler();
IItemHandler handler = extractWrapper.getNormalHandler();
if (handler != null) {
for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) {
if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) {
@ -105,7 +106,7 @@ public final class WorldUtil {
}
}
}
}*/
}
}
return extracted;

View file

@ -16,6 +16,7 @@ public class SlotlessableItemHandlerWrapper {
//TODO: Check if we need this wrapper at all? The previous implementation used CommonCapabilities ISlotlessItemhandler
private final IItemHandler normalHandler;
@Deprecated
private final Object slotlessHandler;
public SlotlessableItemHandlerWrapper(IItemHandler normalHandler, Object slotlessHandler) {
@ -27,6 +28,7 @@ public class SlotlessableItemHandlerWrapper {
return this.normalHandler;
}
@Deprecated
public Object getSlotlessHandler() {
return this.slotlessHandler;
}

View file

@ -341,7 +341,7 @@
"item.actuallyadditions.booklet": "Actually Additions Manual (wip)",
"item.actuallyadditions.rarmor_module_reconstructor": "Reconstruction Module (wip)",
"item.actuallyadditions.laser_wrench": "Laser Wrench",
"item.actuallyadditions.drill_core": "Drill Core (wip)",
"item.actuallyadditions.drill_core": "Drill Core",
"item.actuallyadditions.restonia_crystal": "Restonia Crystal",
"item.actuallyadditions.palis_crystal": "Palis Crystal",
"item.actuallyadditions.diamatine_crystal": "Diamatine Crystal",
@ -395,6 +395,14 @@
"item.actuallyadditions.void_crystal_shard": "Black Crystal Shard",
"item.actuallyadditions.emeradic_crystal_shard": "Green Crystal Shard",
"item.actuallyadditions.enori_crystal_shard": "White Crystal Shard",
"item.actuallyadditions.drill_pattern": "Banner Pattern",
"item.actuallyadditions.drill_pattern.desc": "Drill",
"item.actuallyadditions.leaf_blo_pattern": "Banner Pattern",
"item.actuallyadditions.leaf_blo_pattern.desc": "Leaf Blower",
"item.actuallyadditions.phan_con_pattern": "Banner Pattern",
"item.actuallyadditions.phan_con_pattern.desc": "Phantom Connector",
"item.actuallyadditions.book_pattern": "Banner Pattern",
"item.actuallyadditions.book_pattern.desc": "Book",
"_comment": "Tooltips",
"tooltip.actuallyadditions.onSuffix.desc": "On",
"tooltip.actuallyadditions.phantom.connected.desc": "<Block connected!>",

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B