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.

Featured Replies

Posted

Hey I have this mod that I made back in 1.7 and I wanted to update it to 1.8 and so I believe that with a little changing I fixed most of the problems but there are still some in one class that I don't know how to fix.

package net.glassDrops.mod;

import java.util.Random;

import net.minecraft.block.BlockGlass;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;

public class glassDrop  {

@net.minecraftforge.fml.common.eventhandler.SubscribeEvent
public void blockBreak(BreakEvent evt){

	if (evt.block == Blocks.glass){
		EntityItem item = new EntityItem(evt.world, evt.x, evt.y, evt.z, new ItemStack(Item.getItemFromBlock(Blocks.glass)));
		EntityPlayer player = evt.getPlayer();

		if(!player.capabilities.isCreativeMode) evt.world.spawnEntityInWorld(item);
	}

}}

The problems are with the evt.block and evt.x, evt.y, and evt.z It has bloxk x y and z underlined and says they cannot be resolved or is not a field. Can someone help me get that fixed?

  • Author

I don;t under stand. if I change the evt.x evt.y and evt.z to evt.pos evt.pos evt.pos it just creates a whole new problem and that also wont fix my problem with evt.block.

Hi

Do what diesieben07 said... the block positions provided in the event.

public void blockBreak(BreakEvent evt)
{
EntityItem item = new EntityItem(evt.world, evt.pos.getX(), evt.pos.getY(), evt.pos.getZ(), new ItemStack(Item.getItemFromBlock(Blocks.glass)));
}

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

Now there is one thing left when you mine the glass withe a tool that hes silk touch it drops 2 glass when I want it to only drop one. How can I fix that?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.