Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

auriny's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. thank you, sound worked, but didnt particles
  2. howdy! i ran into a problem. it lies in the fact that I wrote such a code that should work, but there are no sounds and particles on entity hits. public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker, World world) { if (!attacker.world.isRemote()) { target.addPotionEffect(new EffectInstance(Effects.SLOWNESS, 45, 1)); world.playSound(null, attacker.getPosX(), attacker.getPosY(), attacker.getPosZ(), SoundEvents.BLOCK_ANCIENT_DEBRIS_BREAK, SoundCategory.PLAYERS, 1, 1); world.addParticle(new BlockParticleData(ParticleTypes.BLOCK, Blocks.ANCIENT_DEBRIS.getDefaultState()), true, target.getPosX(), target.getPosY() + 0.5D, target.getPosZ(), 0, 1, 0); } return super.hitEntity(stack, target, attacker); } as I understand it, the problem is that there is no world in the return, but it is impossible to embed it there, because. the hitEntity method initially did not have such a parameter. how to be? snapshot mappings
  3. hi, im making sword that grants an effect to attacker. i need to hide potion particles like in minecraft command i can write time, amplifier, but i cannot write hideParticles parameter (true or false) what to do? here is code: i have tried this: and this: nothing not worked
  4. I had in mind a little different: I need the player to build the structure himself and the block checks if there are certain blocks around. but I already figured out how to implement it
  5. hello, I have a problem, I created a music disc, but for some reason the sound in it is not voluminous and works all over world. how to fix? what i did wrong? public static final RegistryObject<Item> YellowPeachMusicDisc = ITEMS.register("yellow_peach_music_disc", () -> new MusicDiscItem(10, ModSoundEvents.YELLOW_PEACH::get, new Item.Properties().maxStackSize(1).group(CoSRPGItemGroups.COSRPG_MUSIC_DISCS))); public class ModSoundEvents { public static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, CoSRPG.MOD_ID); public static void register(IEventBus eventBus) { SOUND_EVENTS.register(eventBus); } public static final RegistryObject<SoundEvent> YELLOW_PEACH = registerSoundEvent("yellow_peach"); private static RegistryObject<SoundEvent> registerSoundEvent(String name) { return SOUND_EVENTS.register(name, () -> new SoundEvent(new ResourceLocation(CoSRPG.MOD_ID, name))); } }
  6. hello, I need to make a block that will execute its functionality (open gui) only if there are certain blocks around it in a certain order, how to implement this?
  7. hello again, I want to write сustom tier, but I don’t know where and how to write attack speed. can you help me? item class: package com.auriny.cosrpg.items; import net.minecraft.item.ItemGroup; import net.minecraft.item.SwordItem; public class RinkrilSword extends SwordItem { public RinkrilSword() { //3.4F is the attack speed, but in game it's 7.3 super(CustomTier.RINKRIL_TIER, 0, 3.4F, new Properties() .isImmuneToFire() .maxStackSize(1) .group(ItemGroup.COMBAT)); } } custom tier class: package com.auriny.cosrpg.items; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.crafting.Ingredient; public enum CustomTier implements IItemTier { RINKRIL_TIER(0, 2500, 4.0F, 14.0F, 5, Ingredient.fromStacks(new ItemStack(Items.DIAMOND, 5))); private final int harvestLevel; private final int maxUses; private final float efficiency; private final float attackDamage; private final int enchantability; private final Ingredient repairMaterial; CustomTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Ingredient repairMaterialIn) { this.harvestLevel = harvestLevelIn; this.maxUses = maxUsesIn; this.efficiency = efficiencyIn; this.attackDamage = attackDamageIn; this.enchantability = enchantabilityIn; this.repairMaterial = repairMaterialIn; } @Override public int getMaxUses() { return this.maxUses; } @Override public float getEfficiency() { return this.efficiency; } @Override public float getAttackDamage() { return this.attackDamage; } @Override public int getHarvestLevel() { return this.harvestLevel; } @Override public int getEnchantability() { return this.enchantability; } @Override public Ingredient getRepairMaterial() { return this.repairMaterial; } }
  8. package com.auriny.cosrpg.events.loot; import com.google.gson.JsonObject; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.loot.LootContext; import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.util.JSONUtils; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.loot.LootModifier; import net.minecraftforge.registries.ForgeRegistries; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; public class RinkrilAdditionModifier extends LootModifier { private Item addition; public RinkrilAdditionModifier(ILootCondition[] conditionsIn, Item addition) { super(conditionsIn); this.addition = addition; } @Nonnull @Override public List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { List<ItemStack> stack = new ArrayList<ItemStack>(); stack.add(new ItemStack(addition)); return stack; } public static class Serializer extends GlobalLootModifierSerializer<RinkrilAdditionModifier> { @Override public RinkrilAdditionModifier read(ResourceLocation name, JsonObject object, ILootCondition[] conditionsIn) { Item addition = ForgeRegistries.ITEMS.getValue(new ResourceLocation(JSONUtils.getString(object, "addition"))); return new RinkrilAdditionModifier(conditionsIn, addition); } @Override public JsonObject write(RinkrilAdditionModifier instance) { JsonObject json = makeConditions(instance.conditions); json.addProperty("addition", ForgeRegistries.ITEMS.getKey(instance.addition).toString()); return json; } } }
  9. i wanted the blaze to still be able to drop rods but when i added this the blazes started only dropping what i typed in how to fix it? global_loot_modifiers.json { "replace": false, "entries": [ "cosrpg:blaze_rinkril" ] } blaze_rinkril.json { "type": "cosrpg:blaze_rinkril", "conditions": [ { "condition": "forge:loot_table_id", "loot_table_id": "minecraft:entities/blaze" } ], "addition": "cosrpg:rinkril" }
  10. solved, problem was in serialize registry if you need, here's code: package com.auriny.cosrpg.events; import com.auriny.cosrpg.CoSRPG; import com.auriny.cosrpg.events.loot.RinkrilAdditionModifier; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.IForgeRegistry; @Mod.EventBusSubscriber(modid = CoSRPG.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModEventBusEvents { @SubscribeEvent public static void registerModifierSerializers(final RegistryEvent.Register<GlobalLootModifierSerializer<?>> event) { IForgeRegistry<GlobalLootModifierSerializer<?>> registry = event.getRegistry(); register(registry, new RinkrilAdditionModifier.Serializer(), "blaze_rinkril"); } private static void register(IForgeRegistry<GlobalLootModifierSerializer<?>> registry, GlobalLootModifierSerializer<?> serializer, String name) { registry.register(serializer.setRegistryName(CoSRPG.MOD_ID, "blaze_rinkril")); } }
  11. oh, i understood, thanks, but i dont understood how to register this class... can you tell me, please?
  12. i.e. should I specify '"type": "cosrpg:global_loot_modifiers"'?
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.