Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

auriny

Members
  • Joined

  • Last visited

Everything posted by auriny

  1. are you talking about the one that activates on shift + f9? i thought you were talking about some kind of debugger in the game x)
  2. how to use debugger? where is it? yes
  3. public class EtherRenderer { Minecraft mc = Minecraft.getInstance(); @SubscribeEvent public void onRender(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) { onTickRender(event); } } private int getPercentage() { assert mc.player != null; Ether ether = mc.player.getCapability(EtherCapability.CAPABILITY_ETHER, null).orElse(Ether.createADefaultInstance()); float result = ether.getEther() / ether.getMaxEther() * 100; return (int) MathHelper.clamp(Math.floor(result), 0, 100); } @SuppressWarnings("deprecation") private void onTickRender(RenderGameOverlayEvent.Post event) { this.mc.getTextureManager().bindTexture(new ResourceLocation(CoSRPG.MOD_ID, "textures/gui/ether_bar.png")); if (mc.currentScreen == null) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); IngameGui gui = mc.ingameGUI; int x = this.mc.getMainWindow().getScaledWidth() - 111; int y = this.mc.getMainWindow().getScaledHeight() - 18; gui.blit(event.getMatrixStack(), x, y, 0, 9, 100, 9); gui.blit(event.getMatrixStack(), x, y, 0, 9, getPercentage(), 18); } } } still doesn't work... did i do something wrong? a bar is displayed, but it does not change depending on the ether (mana)
  4. hmm ok thanks going to try
  5. i.e. should i move ```this.mc.getTextureManager().bindTexture(new ResourceLocation(CoSRPG.MOD_ID, "textures/gui/ether_bar.png"));``` up?
  6. i don't know what to put in here lol. i tried null but it gives out npe, this thing worked with consume. is there other variants?
  7. I made mana through caps, it works, but I don’t know how to visually display it with a custom sprite. i made this code using minecraft and divinerpg sources as references but this code doesn't works. what wrong with it? public class EtherRenderer { Minecraft mc = Minecraft.getInstance(); @SubscribeEvent public void onRender(RenderGameOverlayEvent.Post event) { if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) { onTickRender(event); } } private int getPercentage() { assert mc.player != null; Ether ether = mc.player.getCapability(EtherCapability.CAPABILITY_ETHER, null).orElse(Ether.createADefaultInstance()); float result = ether.getEther() / ether.getMaxEther() * 100; return (int) MathHelper.clamp(Math.floor(result), 0, 100); } @SubscribeEvent @SuppressWarnings("deprecation") private void onTickRender(RenderGameOverlayEvent.Post event) { if (mc.currentScreen == null) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); IngameGui gui = mc.ingameGUI; int x = this.mc.getMainWindow().getScaledWidth() - 111; int y = this.mc.getMainWindow().getScaledHeight() - 18; gui.blit(event.getMatrixStack(), x, y, 0, 9, 100, 9); gui.blit(event.getMatrixStack(), x, y, 0, 9, getPercentage(), 18); this.mc.getTextureManager().bindTexture(new ResourceLocation(CoSRPG.MOD_ID, "textures/gui/ether_bar.png")); } } }
  8. hi, i wrote a little procedure for the item, it works great, but i wish i could put the skeleton skull and the skeleton skull with the skeleton without pressing shift. here is my code: @SuppressWarnings("deprecation") @Override public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { if(player.getHeldItem(hand).getItem() == CoSRPGItems.CosoriteScrap.get()) { if (!world.isRemote()) { BlockPos YblockPos = new BlockPos(pos.getX(),pos.getY() + 1,pos.getZ()); BlockState Yblock = world.getBlockState(YblockPos); if(Yblock.getBlock() == Blocks.SKELETON_SKULL || Yblock.getBlock() == Blocks.WITHER_SKELETON_SKULL) { if (!player.isCreative()) player.getHeldItem(hand).shrink(1); world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.PARTICLE_SOUL_ESCAPE, SoundCategory.BLOCKS, 1.7f, 0.7f); world.setBlockState(pos.up(1), Blocks.AIR.getDefaultState()); if (!player.inventory.addItemStackToInventory(new ItemStack(CoSRPGItems.Cosorite.get()))) player.dropItem(new ItemStack(CoSRPGItems.Cosorite.get()), false); } } else return ActionResultType.FAIL; } return ActionResultType.CONSUME; } how to implement it?
  9. thank you, sound worked, but didnt particles
  10. 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
  11. oh thank you it worked
  12. 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
  13. 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
  14. 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))); } }
  15. 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?
  16. 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; } }
  17. 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; } } }
  18. 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" }
  19. 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")); } }
  20. oh, i understood, thanks, but i dont understood how to register this class... can you tell me, please?
  21. i.e. should I specify '"type": "cosrpg:global_loot_modifiers"'?

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.