From 0daca60588c89e540a296e61d3ef37de2f3710cc Mon Sep 17 00:00:00 2001 From: nimsolated Date: Mon, 23 Mar 2026 22:09:44 -0700 Subject: [PATCH] 2.0.3 --- aris_random_additions.mcreator | 57 ++++++++++++++++++- .../BedrockPickaxeEntitySwingsItem.mod.json | 2 +- elements/SweetBladeEnchantment.mod.json | 26 +++++++++ elements/SweetBladeProcedure.mod.json | 7 +++ .../SweetBladeEnchantmentEnchantment.java | 42 ++++++++++++++ .../ArisRandomAdditionsModEnchantments.java | 2 + .../item/BedrockPickaxeItem.java | 2 +- ...drockPickaxeEntitySwingsItemProcedure.java | 32 ++++++++--- .../SweetBladeProcedureProcedure.java | 48 ++++++++++++++++ src/main/resources/META-INF/mods.toml | 4 +- .../aris_random_additions/lang/en_us.json | 1 + 11 files changed, 208 insertions(+), 15 deletions(-) create mode 100644 elements/SweetBladeEnchantment.mod.json create mode 100644 elements/SweetBladeProcedure.mod.json create mode 100644 src/main/java/net/mcreator/arisrandomadditions/enchantment/SweetBladeEnchantmentEnchantment.java create mode 100644 src/main/java/net/mcreator/arisrandomadditions/procedures/SweetBladeProcedureProcedure.java diff --git a/aris_random_additions.mcreator b/aris_random_additions.mcreator index 2a97a4b..11e48b6 100644 --- a/aris_random_additions.mcreator +++ b/aris_random_additions.mcreator @@ -1790,6 +1790,10 @@ "name": "entity", "type": "entity" }, + { + "name": "itemstack", + "type": "itemstack" + }, { "name": "world", "type": "world" @@ -3960,6 +3964,54 @@ ] }, "path": "~/Other" + }, + { + "name": "SweetBladeEnchantment", + "type": "enchantment", + "compiles": true, + "locked_code": false, + "registry_name": "sweet_blade_enchantment", + "metadata": { + "files": [ + "src/main/java/net/mcreator/arisrandomadditions/enchantment/SweetBladeEnchantmentEnchantment.java" + ] + }, + "path": "~/Other" + }, + { + "name": "SweetBladeProcedure", + "type": "procedure", + "compiles": true, + "locked_code": false, + "registry_name": "sweet_blade_procedure", + "metadata": { + "files": [ + "src/main/java/net/mcreator/arisrandomadditions/procedures/SweetBladeProcedureProcedure.java" + ], + "dependencies": [ + { + "name": "sourceentity", + "type": "entity" + }, + { + "name": "x", + "type": "number" + }, + { + "name": "y", + "type": "number" + }, + { + "name": "z", + "type": "number" + }, + { + "name": "world", + "type": "world" + } + ] + }, + "path": "~/Other" } ], "variable_elements": [], @@ -4228,6 +4280,7 @@ "fluid.nims_random_bullshit.netherrack_juice": "Netherrack Juice", "item.nims_random_bullshit.wand_of_resizing.description_0": "DISCLAIMER: Does not work with Origins that periodically reset your scale!", "gui.nims_random_bullshit.mailbox_gui.outbox_z_coord": "0", + "enchantment.aris_random_additions.sweet_blade_enchantment": "Sweet Blade", "item.aris_random_additions.turd": "Turd", "item.aris_random_additions.pocket_lightning.description_0": "Spawns lightning wherever it lands.", "item.nims_random_bullshit.netherrackite_pickaxe": "Netherrackite Pickaxe", @@ -4326,11 +4379,11 @@ "workspaceSettings": { "modid": "aris_random_additions", "modName": "Ari\u0027s Random Additions", - "version": "2.0.2", + "version": "2.0.3", "description": "Random Additions by Ari. Created with MCreator.", "author": "nimsolated, MCreator", "websiteURL": "https://mcreator.net", - "license": "Academic Free License v3.0", + "license": "MIT License", "serverSideOnly": false, "modPicture": "ari", "requiredMods": [], diff --git a/elements/BedrockPickaxeEntitySwingsItem.mod.json b/elements/BedrockPickaxeEntitySwingsItem.mod.json index b1470fe..c77a870 100644 --- a/elements/BedrockPickaxeEntitySwingsItem.mod.json +++ b/elements/BedrockPickaxeEntitySwingsItem.mod.json @@ -2,6 +2,6 @@ "_fv": 73, "_type": "procedure", "definition": { - "procedurexml": "no_ext_triggerNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5Blocks.BEDROCKTRUEFALSENONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5Blocks.AIRblock.stone.breakblockNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.50.80.8TRUECUSTOM:BedrockShardNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.510NONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5CUSTOM:BedrockifierTRUEFALSENONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5Blocks.AIRblock.stone.breakblockNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.50.80.8TRUECUSTOM:BedrockifierNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.510" + "procedurexml": "no_ext_triggerNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5Blocks.BEDROCKTRUEFALSENONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5Blocks.AIRblock.stone.breakblockNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.50.80.8SILK_TOUCHTRUEBlocks.BEDROCKNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.52TRUECUSTOM:BedrockShardNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.52NONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5CUSTOM:BedrockifierTRUEFALSENONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.5Blocks.AIRblock.stone.breakblockNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.50.80.8TRUECUSTOM:BedrockifierNONEOUTLINE4.5NONEOUTLINE4.5NONEOUTLINE4.510" } } \ No newline at end of file diff --git a/elements/SweetBladeEnchantment.mod.json b/elements/SweetBladeEnchantment.mod.json new file mode 100644 index 0000000..58bf3d4 --- /dev/null +++ b/elements/SweetBladeEnchantment.mod.json @@ -0,0 +1,26 @@ +{ + "_fv": 73, + "_type": "enchantment", + "definition": { + "name": "Sweet Blade", + "supportedSlots": "mainhand", + "weight": 2, + "anvilCost": 1, + "maxLevel": 3, + "damageModifier": 0, + "incompatibleEnchantments": [ + { + "value": "FIRE_ASPECT" + } + ], + "supportedItems": [ + { + "value": "TAG:minecraft:swords" + } + ], + "isTreasureEnchantment": false, + "isCurse": false, + "canGenerateInLootTables": true, + "canVillagerTrade": true + } +} \ No newline at end of file diff --git a/elements/SweetBladeProcedure.mod.json b/elements/SweetBladeProcedure.mod.json new file mode 100644 index 0000000..116efa7 --- /dev/null +++ b/elements/SweetBladeProcedure.mod.json @@ -0,0 +1,7 @@ +{ + "_fv": 73, + "_type": "procedure", + "definition": { + "procedurexml": "entity_diesANDCUSTOM:SweetBladeEnchantmentCUSTOM:SweetBladeEnchantmentTRUEItems.SWEET_BERRIES10" + } +} \ No newline at end of file diff --git a/src/main/java/net/mcreator/arisrandomadditions/enchantment/SweetBladeEnchantmentEnchantment.java b/src/main/java/net/mcreator/arisrandomadditions/enchantment/SweetBladeEnchantmentEnchantment.java new file mode 100644 index 0000000..f635343 --- /dev/null +++ b/src/main/java/net/mcreator/arisrandomadditions/enchantment/SweetBladeEnchantmentEnchantment.java @@ -0,0 +1,42 @@ + +package net.mcreator.arisrandomadditions.enchantment; + +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.enchantment.EnchantmentCategory; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.tags.ItemTags; +import net.minecraft.resources.ResourceLocation; + +import java.util.List; + +public class SweetBladeEnchantmentEnchantment extends Enchantment { + private static final EnchantmentCategory ENCHANTMENT_CATEGORY = EnchantmentCategory.create("aris_random_additions_sweet_blade_enchantment", + item -> Ingredient.of(ItemTags.create(new ResourceLocation("minecraft:swords"))).test(new ItemStack(item))); + + public SweetBladeEnchantmentEnchantment() { + super(Enchantment.Rarity.RARE, ENCHANTMENT_CATEGORY, new EquipmentSlot[]{EquipmentSlot.MAINHAND}); + } + + @Override + public int getMinCost(int level) { + return 1 + level * 10; + } + + @Override + public int getMaxCost(int level) { + return 6 + level * 10; + } + + @Override + public int getMaxLevel() { + return 3; + } + + @Override + protected boolean checkCompatibility(Enchantment enchantment) { + return super.checkCompatibility(enchantment) && !List.of(Enchantments.FIRE_ASPECT).contains(enchantment); + } +} diff --git a/src/main/java/net/mcreator/arisrandomadditions/init/ArisRandomAdditionsModEnchantments.java b/src/main/java/net/mcreator/arisrandomadditions/init/ArisRandomAdditionsModEnchantments.java index a32905a..6924ae7 100644 --- a/src/main/java/net/mcreator/arisrandomadditions/init/ArisRandomAdditionsModEnchantments.java +++ b/src/main/java/net/mcreator/arisrandomadditions/init/ArisRandomAdditionsModEnchantments.java @@ -10,6 +10,7 @@ import net.minecraftforge.registries.DeferredRegister; import net.minecraft.world.item.enchantment.Enchantment; +import net.mcreator.arisrandomadditions.enchantment.SweetBladeEnchantmentEnchantment; import net.mcreator.arisrandomadditions.enchantment.SunderingEnchantmentEnchantment; import net.mcreator.arisrandomadditions.enchantment.RuiningEnchantmentEnchantment; import net.mcreator.arisrandomadditions.enchantment.PassiveIncomeEnchantmentEnchantment; @@ -22,4 +23,5 @@ public class ArisRandomAdditionsModEnchantments { public static final RegistryObject RUINING_ENCHANTMENT = REGISTRY.register("ruining_enchantment", () -> new RuiningEnchantmentEnchantment()); public static final RegistryObject SUNDERING_ENCHANTMENT = REGISTRY.register("sundering_enchantment", () -> new SunderingEnchantmentEnchantment()); public static final RegistryObject LIFE_MENDING_ENCHANTMENT = REGISTRY.register("life_mending_enchantment", () -> new LifeMendingEnchantmentEnchantment()); + public static final RegistryObject SWEET_BLADE_ENCHANTMENT = REGISTRY.register("sweet_blade_enchantment", () -> new SweetBladeEnchantmentEnchantment()); } diff --git a/src/main/java/net/mcreator/arisrandomadditions/item/BedrockPickaxeItem.java b/src/main/java/net/mcreator/arisrandomadditions/item/BedrockPickaxeItem.java index f022a87..0438ee4 100644 --- a/src/main/java/net/mcreator/arisrandomadditions/item/BedrockPickaxeItem.java +++ b/src/main/java/net/mcreator/arisrandomadditions/item/BedrockPickaxeItem.java @@ -43,7 +43,7 @@ public class BedrockPickaxeItem extends PickaxeItem { @Override public boolean onEntitySwing(ItemStack itemstack, LivingEntity entity) { boolean retval = super.onEntitySwing(itemstack, entity); - BedrockPickaxeEntitySwingsItemProcedure.execute(entity.level(), entity); + BedrockPickaxeEntitySwingsItemProcedure.execute(entity.level(), entity, itemstack); return retval; } } diff --git a/src/main/java/net/mcreator/arisrandomadditions/procedures/BedrockPickaxeEntitySwingsItemProcedure.java b/src/main/java/net/mcreator/arisrandomadditions/procedures/BedrockPickaxeEntitySwingsItemProcedure.java index 8b4ce68..d7a4bfd 100644 --- a/src/main/java/net/mcreator/arisrandomadditions/procedures/BedrockPickaxeEntitySwingsItemProcedure.java +++ b/src/main/java/net/mcreator/arisrandomadditions/procedures/BedrockPickaxeEntitySwingsItemProcedure.java @@ -8,6 +8,8 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.Level; import net.minecraft.world.level.ClipContext; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.ItemStack; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.Entity; @@ -22,7 +24,7 @@ import net.mcreator.arisrandomadditions.init.ArisRandomAdditionsModBlocks; import java.util.Map; public class BedrockPickaxeEntitySwingsItemProcedure { - public static void execute(LevelAccessor world, Entity entity) { + public static void execute(LevelAccessor world, Entity entity, ItemStack itemstack) { if (entity == null) return; if (!world.isClientSide()) { @@ -63,14 +65,26 @@ public class BedrockPickaxeEntitySwingsItemProcedure { ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.stone.break")), SoundSource.BLOCKS, (float) 0.8, (float) 0.8, false); } } - if (world instanceof ServerLevel _level) { - ItemEntity entityToSpawn = new ItemEntity(_level, - (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getX()), - (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getY()), - (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getZ()), - new ItemStack(ArisRandomAdditionsModItems.BEDROCK_SHARD.get())); - entityToSpawn.setPickUpDelay(10); - _level.addFreshEntity(entityToSpawn); + if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) != 0) { + if (world instanceof ServerLevel _level) { + ItemEntity entityToSpawn = new ItemEntity(_level, + (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getX()), + (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getY()), + (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getZ()), + new ItemStack(Blocks.BEDROCK)); + entityToSpawn.setPickUpDelay(2); + _level.addFreshEntity(entityToSpawn); + } + } else { + if (world instanceof ServerLevel _level) { + ItemEntity entityToSpawn = new ItemEntity(_level, + (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getX()), + (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getY()), + (entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getZ()), + new ItemStack(ArisRandomAdditionsModItems.BEDROCK_SHARD.get())); + entityToSpawn.setPickUpDelay(2); + _level.addFreshEntity(entityToSpawn); + } } } else if ((world.getBlockState( new BlockPos(entity.level().clip(new ClipContext(entity.getEyePosition(1f), entity.getEyePosition(1f).add(entity.getViewVector(1f).scale(4.5)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getBlockPos().getX(), diff --git a/src/main/java/net/mcreator/arisrandomadditions/procedures/SweetBladeProcedureProcedure.java b/src/main/java/net/mcreator/arisrandomadditions/procedures/SweetBladeProcedureProcedure.java new file mode 100644 index 0000000..64555e6 --- /dev/null +++ b/src/main/java/net/mcreator/arisrandomadditions/procedures/SweetBladeProcedureProcedure.java @@ -0,0 +1,48 @@ +package net.mcreator.arisrandomadditions.procedures; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.event.entity.living.LivingDeathEvent; + +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.server.level.ServerLevel; + +import net.mcreator.arisrandomadditions.init.ArisRandomAdditionsModEnchantments; + +import javax.annotation.Nullable; + +@Mod.EventBusSubscriber +public class SweetBladeProcedureProcedure { + @SubscribeEvent + public static void onEntityDeath(LivingDeathEvent event) { + if (event != null && event.getEntity() != null) { + execute(event, event.getEntity().level(), event.getEntity().getX(), event.getEntity().getY(), event.getEntity().getZ(), event.getSource().getEntity()); + } + } + + public static void execute(LevelAccessor world, double x, double y, double z, Entity sourceentity) { + execute(null, world, x, y, z, sourceentity); + } + + private static void execute(@Nullable Event event, LevelAccessor world, double x, double y, double z, Entity sourceentity) { + if (sourceentity == null) + return; + if (!((sourceentity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == ItemStack.EMPTY.getItem()) + && EnchantmentHelper.getItemEnchantmentLevel(ArisRandomAdditionsModEnchantments.SWEET_BLADE_ENCHANTMENT.get(), (sourceentity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY)) != 0) { + for (int index0 = 0; index0 < (sourceentity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getEnchantmentLevel(ArisRandomAdditionsModEnchantments.SWEET_BLADE_ENCHANTMENT.get()); index0++) { + if (world instanceof ServerLevel _level) { + ItemEntity entityToSpawn = new ItemEntity(_level, x, y, z, new ItemStack(Items.SWEET_BERRIES)); + entityToSpawn.setPickUpDelay(10); + _level.addFreshEntity(entityToSpawn); + } + } + } + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 1b43f27..d72d945 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,10 +1,10 @@ modLoader="javafml" loaderVersion="[47,)" -license="Academic Free License v3.0" +license="MIT License" [[mods]] modId="aris_random_additions" -version="2.0.2" +version="2.0.3" displayName="Ari's Random Additions" displayURL="https://mcreator.net" logoFile="logo.png" diff --git a/src/main/resources/assets/aris_random_additions/lang/en_us.json b/src/main/resources/assets/aris_random_additions/lang/en_us.json index 762c64e..ba90bd9 100644 --- a/src/main/resources/assets/aris_random_additions/lang/en_us.json +++ b/src/main/resources/assets/aris_random_additions/lang/en_us.json @@ -177,6 +177,7 @@ "fluid.nims_random_bullshit.netherrack_juice": "Netherrack Juice", "item.nims_random_bullshit.wand_of_resizing.description_0": "DISCLAIMER: Does not work with Origins that periodically reset your scale!", "gui.nims_random_bullshit.mailbox_gui.outbox_z_coord": "0", + "enchantment.aris_random_additions.sweet_blade_enchantment": "Sweet Blade", "item.aris_random_additions.turd": "Turd", "item.aris_random_additions.pocket_lightning.description_0": "Spawns lightning wherever it lands.", "item.nims_random_bullshit.netherrackite_pickaxe": "Netherrackite Pickaxe",