Some hackey work on world transmutation. Need a more intelligent way of handling metadata on in world transmutation

This commit is contained in:
pahimar 2012-12-21 13:04:48 -05:00
parent 30ae7db6c0
commit c80e797957
3 changed files with 30 additions and 1 deletions

View file

@ -1,5 +1,7 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
@ -112,7 +114,15 @@ public class WorldTransmutationHandler {
int id = event.world.getBlockId(event.x, event.y, event.z);
int meta = event.world.getBlockMetadata(event.x, event.y, event.z);
Material material = event.world.getBlockMaterial(event.x, event.y, event.z);
boolean result = false;
if ((material == Material.leaves) && (id == Block.leaves.blockID)) {
meta = meta & 4;
}
else if ((material == Material.pumpkin) && (id == Block.pumpkin.blockID)) {
meta = 0;
}
ItemStack worldStack = new ItemStack(id, 1, meta);
ItemStack targetStack = new ItemStack(event.targetID, 1, event.targetMeta);

View file

@ -4,8 +4,10 @@ import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSand;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemLeaves;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -49,8 +51,21 @@ public class TransmutationHelper {
public static void updateTargetBlock(World world, int x, int y, int z) {
currentBlockStack = new ItemStack(world.getBlockId(x, y, z), 1, world.getBlockMetadata(x, y, z));
int id = world.getBlockId(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
Material material = world.getBlockMaterial(x, y, z);
if ((material == Material.leaves) && (id == Block.leaves.blockID)) {
meta = meta & 4;
}
else if ((material == Material.pumpkin) && (id == Block.pumpkin.blockID)) {
meta = 0;
}
currentBlockStack = new ItemStack(id, 1, meta);
System.out.format("%d %d\n", id, meta);
if (previousBlockStack == null) {
previousBlockStack = currentBlockStack;
targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage());

View file

@ -195,10 +195,14 @@ public class RecipesTransmutationStone {
EquivalencyHandler.instance().addObjects(Block.mushroomRed, Block.mushroomBrown);
EquivalencyHandler.instance().addObjects(Item.pumpkinSeeds, Item.melonSeeds);
EquivalencyHandler.instance().addObjects(Block.pumpkin, Block.melon);
EquivalencyHandler.instance().addObjects(Block.pumpkinStem, Block.melonStem);
EquivalencyHandler.instance().addObjects(Block.stairsWoodSpruce, Block.stairsWoodBirch, Block.stairsWoodJungle);
EquivalencyHandler.instance().addObjects(new ItemStack(Item.paper, 3), new ItemStack(Item.reed, 3));
EquivalencyHandler.instance().addObjects(new ItemStack(Item.flint, 2), new ItemStack(Block.gravel, 2), new ItemStack(Block.sandStone, 2, 0), new ItemStack(Block.sandStone, 2, 1), new ItemStack(Block.sandStone, 2, 2));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.planks, 4));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.wood, 4));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.woodSingleSlab, 4));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.woodDoubleSlab, 4));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.sapling, 4));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.leaves, 4));
EquivalencyHandler.instance().addObjects(RecipeHelper.getMetaCycle(Block.tallGrass, 3));