Jump to content

[1.7.10] [SOLVED!] Trouble removing drops from a block


HappyKiller1O1

Recommended Posts

So, my item destroys a 3x3 area of blocks. To do this, I use the onBlockDestroyed method in Item in my item's class. Within the method, I basically check if it has a certain boolean set true within the Item NBT and, if so remove the drops from the block and add it's smelted variant. When trying this, it does not clear the drops but, still adds the smelted variant. But then, doesn't drop the smelted variant. I am quite confused but I am sure it's something simple I am missing. Here's how I am TRYING to do it:

 

NOTE: I can't use the HarvestBlockEvent because, it doesn't register the blocks I destroy through my class. :P

if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) {
		ArrayList<ItemStack> drops = block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));

		LogHelper.logInfo("Drops: " + drops);

		if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block)) != null) {
			ItemStack stackToDrop = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, meta)).copy();

			ItemStack stackToDrop1 = new ItemStack(stackToDrop.getItem(), 1);

			drops.clear();

			drops.add(stackToDrop1);

			LogHelper.logInfo("Drops: " + drops);
		}
	}

 

And here's what pops out in the console when destroying it (Happens eight times):

[22:38:35] [server thread/INFO] [Crew Mod]: Drops: [1xtile.oreGold@0]
[22:38:35] [server thread/INFO] [Crew Mod]: Drops: [1xitem.ingotGold@0]

 

Would appreciate some help!

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

Im removing drops like so

if (event.drops != null && event.drops.size() != 0) {
			for (int x = event.drops.size() - 1; x >= 0; x--) {
                                          event.drops.remove(x); 

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Link to comment
Share on other sites

This code makes it nothing to clear the drops.

ArrayList<ItemStack> drops = block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));

A new instance of drops is made there, so changing that has no effect!

 

You cannot change drops in the Item#onBlockDestroyed(...). You should subscribe to the BlockEvent#HarvestDropsEvent.

 

+ 'it doesn't register the blocks I destroy through my class' means there is something wrong with your logic.

What do you mean by 'destroy through my class'?

If you are trying to break blocks within your logic, Please post relevant code.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Can you post your code for the full onBlocksDestroyed() method?

 

What I would do is break the block clicked on normally, and then destroy the other blocks with a setBlock() method which I'm pretty sure does not call the break or harvest events. As you destroy the other blocks, you can drop what you want.

 

Alternatively, as you destroy the blocks you can force the break event by posting it yourself with a ForgeHooks.onBlockBreakEvent() method call. Then you can handle the break event by checking if player is holding your item and proceeding accordingly.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

So basically, people from previous posts told me I should use the onBlockDestroyed method in the Item class to allow me to destroy extra blocks around the area (I previously used the BreakEvent). In doing this, I put all the breaking code for extra blocks in my Item Class. Here is my entire Item class. It is messy so ignore some parts that are quite long. Still developing it and will make it neater later. :P

 

CrewHammer.java

public class CrewHammer extends ItemPickaxe {

public CrewHammer(ToolMaterial tm) {
	super(tm);
	this.setCreativeTab(CrewMod.tabCrewTools);
	this.setUnlocalizedName("CrewHammer");
	this.setTextureName(MR.TNAME + "CrewHammer");
	this.setFull3D();
	this.setMaxStackSize(1);
}

public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean flag) {
	fixNBT(stack);
}

public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) {
	list.add(EnumChatFormatting.RED + "Use SHIFT + Right-Click to");
	list.add(EnumChatFormatting.RED + "open the modification menu.");
	list.add("");
	list.add(EnumChatFormatting.GREEN + "Right-Click to quickly");
	list.add(EnumChatFormatting.GREEN + "change between mining sizes");
}

public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
	if(player.isSneaking()) {
		FMLNetworkHandler.openGui(player, CrewMod.instance, GuiId.guiCrewHammerID, world, (int)player.posX, (int)player.posY, (int)player.posZ);
	}

	return stack;
}

public static void fixNBT(ItemStack stack){
	if(stack.stackTagCompound == null) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack NBTTagCompound was null. Attempting fix...");

		stack.stackTagCompound = new NBTTagCompound();
	}

	/*if(!stack.stackTagCompound.hasKey("HammerTag")) {
		stack.stackTagCompound.setTag("HammerTag", new NBTTagCompound());
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'HammerTag'. Attempting fix...");
	}*/

	if(!stack.stackTagCompound.hasKey("MiningSize")) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'MiningSize'. Attempting fix...");

		stack.stackTagCompound.setString("MiningSize", "3x3");
	}

	if(!stack.stackTagCompound.hasKey("AutoSmelt")) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'AutoSmelt'. Attempting fix...");

		stack.stackTagCompound.setBoolean("AutoSmelt", true);
	}

	if(!stack.stackTagCompound.hasKey("AutoRepair")) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'AutoRepair'. Attempting fix...");

		stack.stackTagCompound.setBoolean("AutoRepair", false);
	}

	if(!stack.stackTagCompound.hasKey("Has3x3")) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'Has3x3'. Attempting fix...");

		stack.stackTagCompound.setBoolean("Has3x3", false);
	}

	if(!stack.stackTagCompound.hasKey("Has5x5")) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'Has5x5'. Attempting fix...");

		stack.stackTagCompound.setBoolean("Has5x5", false);
	}

	if(!stack.stackTagCompound.hasKey("Has7x7")) {
		LogHelper.logWarn("[CrewHammer] " + "The ItemStack did not contain the key 'Has7x7'. Attempting fix...");

		stack.stackTagCompound.setBoolean("Has7x7", false);
	}
}

/**
 * Used for setting the mining size of the Crew Hammer in seperate classes.
 * 
 * @param stack The Hammer.
 * @param miningSize The size to be set (3x3, 5x5, 7x7).
 */
public static void setMiningSize(ItemStack stack, String miningSize) {
	fixNBT(stack);

	stack.stackTagCompound.setString("MiningSize", miningSize);

	LogHelper.logInfo("[CrewHammer#setMiningSize] Method ran successfully! Mining Size is now: " + stack.stackTagCompound.getString("MiningSize"));
}

/**
 * Used for setting the mining size of the Crew Hammer in seperate classes.
 * 
 * @param stack The Hammer.
 * @param canAutoSmelt True if stack has the Auto Smelt mod. False otherwse.
 */
public static void setCanAutoSmelt(ItemStack stack, boolean canAutoSmelt) {
	fixNBT(stack);

	stack.stackTagCompound.setBoolean("AutoSmelt", canAutoSmelt);

	LogHelper.logInfo("[CrewHammer#setCanAutoSmelt] Method ran successfully! Auto Smelt is now: " + stack.stackTagCompound.getBoolean("AutoSmelt"));
}

/**
 * Used for setting the mining size of the Crew Hammer in seperate classes.
 * 
 * @param stack The Hammer.
 * @param canAutoRepair True if stack has the Auto Repair mod. False otherwise.
 */
public static void setCanAutoRepair(ItemStack stack, boolean canAutoRepair) {
	fixNBT(stack);

	stack.stackTagCompound.setBoolean("AutoRepair", canAutoRepair);

	LogHelper.logInfo("[CrewHammer#setCanAutoRepair] Method ran successfully! Auto Repair is now: " + stack.stackTagCompound.getBoolean("AutoRepair"));
}

public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase entity) {
	fixNBT(stack);

	EntityPlayer player = (EntityPlayer)entity;

	//LogHelper.logInfo("CALLED");

	LogHelper.logInfo("STACK: " + stack);
	LogHelper.logInfo("TAG: " + stack.getTagCompound());

	if(world != null && player != null) {
		LogHelper.logInfo("WORLD WAS NOT NULL NOR WAS PLAYER");

		MovingObjectPosition mop = EntityHelper.raytraceFromEntity(world, player, true, 5.0D);

		int sideHit = mop.sideHit;

		if(player.inventory.getCurrentItem() != null) {
			if(player.inventory.getCurrentItem().getItem().equals(CrewMod.crewHammer)) {
				int direction = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

				//ItemStack hammer = stack;

				//System.out.println("ITEM IN HAND IS CREW HAMMER");

				//Block block = event.block;

				//World world = event.world;

				//int x = event.x;
				//int y = event.y;
				//int z = event.z;

				//CrewHammer.fixNBT(hammer);

				//NBTTagCompound cmp = hammer.stackTagCompound;

				//if(event.isCanceled())
					//return;

				String miningArea = null;

				if(stack.hasTagCompound()) {
					miningArea = stack.getTagCompound().getString("MiningSize");

					//System.out.println("CMP WAS NOT NULL");
				}

				LogHelper.logInfo(miningArea);

				this.breakBlock(world, player, stack, x, y, z, direction, miningArea, sideHit);
			}else {
				super.onBlockDestroyed(stack, world, block, x, y, z, entity);
			}
		}else {
			super.onBlockDestroyed(stack, world, block, x, y, z, entity);
		}
	}

	return true;
}

/**
 * Used for breaking an area of blocks depending on the miningSize.
 * 
 * @param world Instance of the Minecraft world.
 * @param player Player breaking the block.
 * @param stack Stack in the player's hand.
 * @param x X coordinate of the block to be broken.
 * @param y	Y coordinate of the block to be broken.
 * @param z	Z coordinate of the block to be broken.
 * @param playerFacing The direction the player is facing: NORTH, SOUTH, EAST or, WEST.
 * @param miningArea The area of blocks to be destroyed: 1x1 = 0, 3x3 = 1, 5x5 = 2, 7x7 = 3.
 */
public void breakBlock(World world, EntityPlayer player, ItemStack stack, int x, int y, int z, int playerFacing, String miningArea, int sideHit) { //TODO Address Shift-Clicking error with onCrafted.
	System.out.println("BREAK BLOCK RUN");

	Block block = world.getBlock(x, y, z);
	int meta = world.getBlockMetadata(x, y, z);

	/*MovingObjectPosition mop = player.rayTrace(5.0D, 1.0F);

	if(mop == null) {
		LogHelper.logErr("[CrewHammer] " + "Ray Trace has failed!");
		return;
	}*/

	//int sideHit = -1;

	//if(world.isRemote)
	//	sideHit = mop.sideHit;
	//else
	//	return;

	LogHelper.logInfo("[CrewHammer] Side Hit: " + sideHit);

	int refX = x;
	int refY = y;
	int refZ = z;

	if(!isEffective(block, meta, stack))
		return;

	int miningSize = 0;

	if(miningArea != null) {
		if(miningArea.equals("3x3"))
			miningSize = 1;
		else if(miningArea == "5x5")
			miningSize = 2;
		else if(miningArea == "7x7")
			miningSize = 3;
		else
			miningSize = 0;
	}else {
		LogHelper.logErr("[CrewHammer] The Mining Area was null!");
	}

	System.out.println(miningArea);
	System.out.println(miningSize);

	if(playerFacing == 0 || playerFacing == 2) {
		//System.out.println("PLAYER FACING 0 or 2");

		if(miningSize == 0) {
			return;
		}else if(miningSize == 1) {
			System.out.println("MINING IS 3x3");

			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
		}else if(miningSize == 2) {
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
		}else {
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x - 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y, z, true, refX, refY, refZ, sideHit, 0, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x - 1, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x - 1, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 1, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 2, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 2, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x - 3, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x + 3, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
		}
	}else {
		//System.out.println("PLAYER FACING 1 or 3");

		if(miningSize == 0) {
			return;
		}else if(miningSize == 1) {
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing);
		}else if(miningSize == 2) {
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z - 2, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z + 2, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
		}else {
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 1, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 1, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y, z - 1, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z + 1, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z - 2, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z + 2, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z - 3, true, refX, refY, refZ, sideHit, 0, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y, z + 3, true, refX, refY, refZ, sideHit, 0, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 2, z, true, refX, refY, refZ, sideHit, 1, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 2, z, true, refX, refY, refZ, sideHit, 2, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 1, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 2, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z - 3, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z + 3, true, refX, refY, refZ, sideHit, 1, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y + 3, z, true, refX, refY, refZ, sideHit, 1, playerFacing);

			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 1, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 2, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z - 3, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z + 3, true, refX, refY, refZ, sideHit, 2, playerFacing);
			this.destroyBlockIfAllowed(world, stack, player, x, y - 3, z, true, refX, refY, refZ, sideHit, 2, playerFacing);
		}
	}
}

/**
 * Destroys a block at the given coords if allowed.
 * 
 * @param world The instance of the World.
 * @param player The player destroying said block.
 * @param x X Coordinate of the block to be destroyed.
 * @param y Y Coordinate of the block to be destroyed.
 * @param z Z Coordinate of the block to be destroyed.
 * @param addDrops If true, adds drops to the block broken.
 * @param refX Reference point X of the center block if destroying multiple ones.
 * @param refY Reference point Y of the center block if destroying multiple ones.
 * @param refZ Reference point Z of the center block if destroying multiple ones.
 * @param Ymodifer Used to determine if the Y variable is added to or, subtracted from. 0 = Nothing, 1 = Added to, 2 = Subtracted from.
 * @param playerDirection The direction the player is facing: NORTH, SOUTH, EAST or, WEST.
 */
public void destroyBlockIfAllowed(World world, ItemStack stack, EntityPlayer player, int x, int y, int z, boolean addDrops, int refX, int refY, int refZ, int sideHit, int Ymodifer, int playerDirection) {
	int actualX = x;
	int actualY = y;
	int actualZ = z;

	if(sideHit == 0 || sideHit == 1) {
		//System.out.println("Z updated");

		actualY = refY;

		int amountToAdd = refY > y ? refY - y : y - refY;

		if(playerDirection == 0 || playerDirection == 2) {
			if(Ymodifer == 0)
				actualZ += 0;
			else if(Ymodifer == 1)
				actualZ += amountToAdd;
			else
				actualZ -= amountToAdd;
		}else {
			if(Ymodifer == 0)
				actualX += 0;
			else if(Ymodifer == 1)
				actualX += amountToAdd;
			else
				actualX -= amountToAdd;
		}

		/*System.out.println("Z: " + actualZ);
		System.out.println(additionZ);
		System.out.println("Y: " + y);
		System.out.println("refY: " + refY);*/
	}

	if(world.isAirBlock(actualX, actualY, actualZ))
		return;

	Block block = world.getBlock(actualX, actualY, actualZ);
	int meta = world.getBlockMetadata(actualX, actualY, actualZ);

	if(!isEffective(block, meta, stack))
		return;

	Block refBlock = world.getBlock(refX, refY, refZ);
        
        float refStrength = refBlock.getBlockHardness(world, refX, refY, refZ);
        float strength = block.getBlockHardness(world, actualX, actualY, actualZ);
        
        float strDifference = strength/refStrength;
        
        System.out.println(strDifference);

	if(!ForgeHooks.canHarvestBlock(block, player, meta) || strength <= -1 || strDifference > 10)
		return;

	EntityPlayerMP playerEntity = (EntityPlayerMP)player;

	if(block.getExpDrop(world, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)) > 0 && !stack.stackTagCompound.getBoolean("AutoSmelt"))
		block.dropXpOnBlockBreak(world, actualX, actualY, actualZ, block.getExpDrop(world, meta, 0));


	if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) {

		//LogHelper.logInfo("Drops: " + drops);

		if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block)) != null) {
					block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)).add(stackToDrop1);

			//drops.clear();

			//drops.add(stackToDrop1);

			LogHelper.logInfo("Drops: " + block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)));
		}
	}

	world.func_147480_a(actualX, actualY, actualZ, addDrops);

	int damage = stack.getItemDamage() + 1;

	if(!player.capabilities.isCreativeMode)
		stack.setItemDamage(damage);
}

public boolean isEffective(Block block, int meta, ItemStack stack) {
	if(ForgeHooks.canToolHarvestBlock(block, meta, stack))
		return true;

	return false; 
	block.getDrops(world, actualX, actualY, actualZ, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)).clear();

			ItemStack stackToDrop = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, meta)).copy();

			ItemStack stackToDrop1 = new ItemStack(stackToDrop.getItem(), 1);

}

/*//Makes it so the item stays in the crafting grid
    public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) {
        return false;
    }
    
    //Tells the game your item has a container item
    public boolean hasContainerItem() {
    	return true;
    }
    
    //Sets teh container item
    public ItemStack getContainerItem(ItemStack itemStack) {
    	itemStack.attemptDamageItem(1, itemRand);
    	
    	return itemStack;
    }*/
}

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

Use Block#harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) to drop the block drops.

Remind that Block#getDrops(...) just gets the new instance of the drops.

Using the Block#harvestBlock(...), you can use BlockEvent.HarvestDropsEvent to check and smelt the drops.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

I actually fixed this. :P I created a new ItemStack ArrayList in my breakBlock method and copied over a spawning method from Block.java. After that, because I use World#func_147480_a to destroy the block (which has a boolean to enable drops or not); I simply cancel the drops and spawn the items. :P Kinda confusing though so, here's my code. :P

 

public void destroyBlockIfAllowed(World world, ItemStack stack, EntityPlayer player, int x, int y, int z, boolean addDrops, int refX, int refY, int refZ, int sideHit, int Ymodifer, int playerDirection) {
	int actualX = x;
	int actualY = y;
	int actualZ = z;

	if(sideHit == 0 || sideHit == 1) {
		//System.out.println("Z updated");

		actualY = refY;

		int amountToAdd = refY > y ? refY - y : y - refY;

		if(playerDirection == 0 || playerDirection == 2) {
			if(Ymodifer == 0)
				actualZ += 0;
			else if(Ymodifer == 1)
				actualZ += amountToAdd;
			else
				actualZ -= amountToAdd;
		}else {
			if(Ymodifer == 0)
				actualX += 0;
			else if(Ymodifer == 1)
				actualX += amountToAdd;
			else
				actualX -= amountToAdd;
		}
	}

	if(world.isAirBlock(actualX, actualY, actualZ))
		return;

	Block block = world.getBlock(actualX, actualY, actualZ);
	int meta = world.getBlockMetadata(actualX, actualY, actualZ);

	if(!isEffective(block, meta, stack))
		return;

	Block refBlock = world.getBlock(refX, refY, refZ);
        
        float refStrength = refBlock.getBlockHardness(world, refX, refY, refZ);
        float strength = block.getBlockHardness(world, actualX, actualY, actualZ);
        
        float strDifference = strength/refStrength;
        
        System.out.println(strDifference);

	if(!ForgeHooks.canHarvestBlock(block, player, meta) || strength <= -1 || strDifference > 10)
		return;

	EntityPlayerMP playerEntity = (EntityPlayerMP)player;

	if(block.getExpDrop(world, meta, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)) > 0 && !stack.stackTagCompound.getBoolean("AutoSmelt"))
		block.dropXpOnBlockBreak(world, actualX, actualY, actualZ, block.getExpDrop(world, meta, 0));


	if(stack.stackTagCompound.getBoolean("AutoSmelt") == true) {
		ArrayList<ItemStack> drops = getFurnaceDrops(world, actualX, actualY, actualZ, 0, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack), 1, block, meta, player);

		LogHelper.logInfo("Drops: " + drops);

		for(ItemStack item : drops) {
			dropCustomItems(world, actualX, actualY, actualZ, item);
		}
	}

	world.func_147480_a(actualX, actualY, actualZ, stack.stackTagCompound.getBoolean("AutoSmelt") ? false : addDrops);

	if(!player.capabilities.isCreativeMode)
		stack.attemptDamageItem(1, world.rand);
}

public boolean isEffective(Block block, int meta, ItemStack stack) {
	if(ForgeHooks.canToolHarvestBlock(block, meta, stack))
		return true;

	return false;		
}

/**
     * Spawns EntityItem in the world for the given ItemStack if the world is not remote.
     */
    protected void dropCustomItems(World world, int x, int y, int z, ItemStack stack) {
        if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops") && !world.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe
            float f = 0.7F;
            
            double d0 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
            double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
            double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
            
            EntityItem entityitem = new EntityItem(world, (double)x + d0, (double)y + d1, (double)z + d2, stack);
            
            entityitem.delayBeforeCanPickup = 10;
            
            world.spawnEntityInWorld(entityitem);
        }
    }
    
    /**
     * This returns a complete list of items dropped from this block.
     *
     * @param world The current world
     * @param x X Position
     * @param y Y Position
     * @param z Z Position
     * @param metadata Current metadata
     * @param fortune Breakers fortune level
     * @return A ArrayList containing all items this block drops
     */
    public ArrayList<ItemStack> getFurnaceDrops(World world, int x, int y, int z, int meta, int fortune, int quantity, Block block, int blockMeta, EntityPlayer player) {
        ArrayList<ItemStack> ret = new ArrayList<ItemStack>();

        int count = quantity;
        
        for(int i = 0; i < count; i++) {
            if(FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)) != null) {
            	
            	int itemMeta = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItemDamage();
            	
            	float xpToDrop = FurnaceRecipes.smelting().func_151398_b(new ItemStack(block, 1, blockMeta));
            	
            	LogHelper.logInfo("XP: " + xpToDrop);
            
            Item item = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, blockMeta)).getItem();
            
            LogHelper.logInfo("Item Meta: " + itemMeta);
            
            if (item != null) {
                ret.add(new ItemStack(item, 1, itemMeta));
            }
            }else {
            	if(block.canSilkHarvest(world, player, x, y, z, meta))
            		ret.add(new ItemStack(block, 1, meta));
            	else
            		ret.add(new ItemStack(block.getItemDropped(blockMeta, world.rand, fortune)));
            }
        }
        
        return ret;
    }

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

You should remind that the code would be incompatible with many mods.

(edit) Many mods uses Block#getDrops(...) and HarvestDropsEvent to modify the drops,

but your code just smelts the block and drop it. Do you want your tool to be silk touch with auto-smelting?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Ok, the method above is called when the block is destroyed by my item. (I basically have an onBlockDestroyed method that is not showed that calls the method destroyBlockIfAllowed) I also use World#func_147480_a() which destroys the block (adds sounds and such) along with telling the game to drop it's items or not. When the block is destroyed with the CrewHammer, it then destroys the blocks around the block destroyed (calling the method I stated above) and then does all of it's shit. xD It shouldn't affect any blocks unless the player is holding my hammer. So, it shouldn't affect other mods.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

So what do you want is silk touch+auto smelting?

But still, there are many problems. You are not dropping anything if the hammer does not have Auto-Smelting trait.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

I check the NBT tag of the stack before editing the drops. The silk touch is there for now because I want stone to drop stone considering it's drop can be smelted into stone. I will be editing it to ignore some blocks. :P It doesn't work on blocks that can not be harvested by a pickaxe.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

I check the NBT tag of the stack before editing the drops. The silk touch is there for now because I want stone to drop stone considering it's drop can be smelted into stone. I will be editing it to ignore some blocks. :P It doesn't work on blocks that can not be harvested by a pickaxe.

That's the problem that I exactly wanted to say. Your logic breaks there.

And, with the code, breaking lapis lazuli would give you the lapis lazuli block. Is that what you want?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Oh no. :P Lapis has a smelting recipe so it would not fall under the else statement. But, I do understand I need to add the fortune effect and such to make the blocks work right. :P Still a bit of testing going on. xD

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

Oh no. :P Lapis has a smelting recipe so it would not fall under the else statement. But, I do understand I need to add the fortune effect and such to make the blocks work right. :P Still a bit of testing going on. xD

That's not only the problem. There are tons of blocks added by mods works like lapis.

Also, some of them uses HarvestDropsEvent, so you should fix lots of the logic.

  (As you want it to have fortune effects, etc.)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Don't worry, I will. I plan to use the QuantityDropped variable and, if it is greater than one; basically don't "smelt" it. :P Fortune I will just figure out how Minecraft does it and go from there. Thank you for your concern though considering a lot of people tend not to point out potential incompatibilities like that. :P

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

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.