Jump to content

Recommended Posts

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?

Posted

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.

Posted

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]

Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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