This commit is contained in:
nimsolated
2026-03-23 22:09:44 -07:00
parent 519ac6e06f
commit 0daca60588
11 changed files with 208 additions and 15 deletions

View File

@@ -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": [],

File diff suppressed because one or more lines are too long

View File

@@ -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
}
}

View File

@@ -0,0 +1,7 @@
{
"_fv": 73,
"_type": "procedure",
"definition": {
"procedurexml": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"event_trigger\" deletable=\"false\" x=\"159\" y=\"98\"><field name=\"trigger\">entity_dies</field><next><block type=\"controls_if\"><value name=\"IF0\"><block type=\"logic_binary_ops\" inline=\"false\"><field name=\"OP\">AND</field><value name=\"A\"><block type=\"logic_negate\"><value name=\"BOOL\"><block type=\"compare_mcitems\"><value name=\"a\"><block type=\"entity_iteminhand\"><value name=\"entity\"><block type=\"source_entity_from_deps\"></block></value></block></value><value name=\"b\"><block type=\"empty_itemstack\"></block></value></block></value></block></value><value name=\"B\"><block type=\"itemstack_has_enchantment\"><field name=\"enhancement\">CUSTOM:SweetBladeEnchantment</field><value name=\"item\"><block type=\"entity_iteminhand\"><value name=\"entity\"><block type=\"source_entity_from_deps\"></block></value></block></value></block></value></block></value><statement name=\"DO0\"><block type=\"controls_repeat_ext\"><value name=\"TIMES\"><block type=\"item_get_enhancement\"><field name=\"enhancement\">CUSTOM:SweetBladeEnchantment</field><value name=\"item\"><block type=\"entity_iteminhand\"><value name=\"entity\"><block type=\"source_entity_from_deps\"></block></value></block></value></block></value><statement name=\"DO\"><block type=\"spawn_gem\"><field name=\"despawn\">TRUE</field><value name=\"block\"><block type=\"mcitem_all\"><field name=\"value\">Items.SWEET_BERRIES</field></block></value><value name=\"x\"><block type=\"coord_x\"></block></value><value name=\"y\"><block type=\"coord_y\"></block></value><value name=\"z\"><block type=\"coord_z\"></block></value><value name=\"pickUpDelay\"><block type=\"math_number\"><field name=\"NUM\">10</field></block></value></block></statement></block></statement></block></next></block></xml>"
}
}

View File

@@ -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);
}
}

View File

@@ -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<Enchantment> RUINING_ENCHANTMENT = REGISTRY.register("ruining_enchantment", () -> new RuiningEnchantmentEnchantment());
public static final RegistryObject<Enchantment> SUNDERING_ENCHANTMENT = REGISTRY.register("sundering_enchantment", () -> new SunderingEnchantmentEnchantment());
public static final RegistryObject<Enchantment> LIFE_MENDING_ENCHANTMENT = REGISTRY.register("life_mending_enchantment", () -> new LifeMendingEnchantmentEnchantment());
public static final RegistryObject<Enchantment> SWEET_BLADE_ENCHANTMENT = REGISTRY.register("sweet_blade_enchantment", () -> new SweetBladeEnchantmentEnchantment());
}

View File

@@ -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;
}
}

View File

@@ -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,15 +65,27 @@ public class BedrockPickaxeEntitySwingsItemProcedure {
ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.stone.break")), SoundSource.BLOCKS, (float) 0.8, (float) 0.8, false);
}
}
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(10);
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(),
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(),

View File

@@ -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);
}
}
}
}
}

View File

@@ -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"

View File

@@ -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",