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.

Hubmac

Members
  • Joined

  • Last visited

  1. Ok thanks, it works. I still have a question, how can I download "ServerPlayerEntity" in my case I convert "LivingEntity" to "ServerPlayerEntity" but is there any way to get "ServerPlayerEntity" from anywhere
  2. Hi there i have problem with my mod. I create this mod for learning forge. Mod adds new item to minecraft and in the overided method "OnBlockDestroyed" i give to player 2 diamonds but when i click on this item in inventory dissapear or when i drop this item. Code: package com.example.examplemod; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.datafix.fixes.ItemStackUUID; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.common.registry.GameRegistry; public class Hammer extends Item { public Hammer() { super(new Item.Properties().group(ItemGroup.TOOLS).maxStackSize(4).addToolType(ToolType.AXE, 3).defaultMaxDamage(100).maxDamage(200)); } @Override public boolean onBlockDestroyed(ItemStack itemStack, World world, BlockState blockState, BlockPos blockPos, LivingEntity livingEntity) { ClientPlayerEntity clientPlayerEntity = Minecraft.getInstance().player; clientPlayerEntity.sendChatMessage("You destroy: "+ blockState.getBlock().getRegistryName()); clientPlayerEntity.inventory.addItemStackToInventory(new ItemStack(Items.DIAMOND, 2)); return super.onBlockDestroyed(itemStack, world, blockState, blockPos, livingEntity); } }

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.