ChangesToPairClass

This commit is contained in:
DarkGuardsman 2013-09-23 13:35:59 -04:00
parent a03af80087
commit 9543e46c0b
6 changed files with 52 additions and 15 deletions

View file

@ -222,9 +222,9 @@ public class ProcessorRecipes
//Read chance output map
Pair<ItemStack, Float> ree = mapChance.get(blockSet);
if (ree != null && random.nextFloat() >= ree.getValue())
if (ree != null && random.nextFloat() >= ree.right())
{
return new ItemStack[] { convert(ree.getKey()) };
return new ItemStack[] { convert(ree.left()) };
}
//Start salvaging items

View file

@ -118,8 +118,8 @@ public abstract class RecipeLoader
public RecipeGrid(Object stack, Pair one, Pair two)
{
this(stack);
this.setRowOne(one.getKey(), one.getValue());
this.setRowTwo(two.getKey(), two.getValue());
this.setRowOne(one.left(), one.right());
this.setRowTwo(two.left(), two.right());
this.hight = 2;
this.width = 2;
}

View file

@ -8,6 +8,7 @@ import com.builtbroken.common.Pair;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
@ -123,6 +124,30 @@ public class BlockDebug extends BlockMachine
}
@Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
return false;
}
@Override
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
return false;
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
return false;
}
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
return this.onUseWrench(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ);
}
public static enum DebugBlocks
{
SOURCE("UnlimitedPower", TileEntityInfSupply.class, "infSource"),

View file

@ -37,12 +37,11 @@ public class ItemWorldHelper
public static List<EntityItem> filterEntityItemsList(List<EntityItem> entityItems, List<ItemStack> disiredItems)
{
List<EntityItem> newItemList = new ArrayList<EntityItem>();
for (EntityItem entityItem : entityItems)
{
for (ItemStack itemStack : disiredItems)
{
if (entityItem.getEntityItem().itemID == itemStack.itemID && entityItem.getEntityItem().getItemDamage() == itemStack.getItemDamage() && !newItemList.contains(entityItem))
for (EntityItem entityItem : entityItems)
{
if (entityItem.getEntityItem().isItemEqual(itemStack) && !newItemList.contains(entityItem))
{
newItemList.add(entityItem);
break;

View file

@ -6,6 +6,7 @@ import com.builtbroken.common.Pair;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
@ -17,13 +18,14 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.parts.INetworkPart;
import dark.core.common.DarkMain;
import dark.core.interfaces.IBlockActivated;
import dark.core.prefab.IExtraInfo.IExtraBlockInfo;
import dark.core.prefab.ModPrefab;
import dark.core.registration.ModObjectRegistry.BlockBuildData;
/** Basic TileEntity Container class designed to be used by generic machines. It is suggested that
* each mod using this create there own basic block extending this to reduce need to use build
* data per block.
* each mod using this create there own basic block extending this to reduce need to use build data
* per block.
*
* @author Darkguardsman */
public abstract class BlockMachine extends BlockTile implements IExtraBlockInfo
@ -120,4 +122,15 @@ public abstract class BlockMachine extends BlockTile implements IExtraBlockInfo
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
TileEntity entity = world.getBlockTileEntity(x, y, z);
if (entity instanceof IBlockActivated && ((IBlockActivated) entity).onActivated(entityPlayer))
{
return true;
}
return super.onBlockActivated(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ);
}
}

View file

@ -190,7 +190,7 @@ public class ModObjectRegistry
{
for (Pair<String, Class<? extends TileEntity>> par : data.tiles)
{
GameRegistry.registerTileEntityWithAlternatives(par.getValue(), par.getKey(), "DM" + par.getKey());
GameRegistry.registerTileEntityWithAlternatives(par.right(), par.left(), "DM" + par.left());
}
}
if (data.creativeTab != null)
@ -215,7 +215,7 @@ public class ModObjectRegistry
((IExtraBlockInfo) block).getTileEntities(block.blockID, tileListNew);
for (Pair<String, Class<? extends TileEntity>> par : tileListNew)
{
GameRegistry.registerTileEntityWithAlternatives(par.getValue(), par.getKey(), "DM" + par.getKey());
GameRegistry.registerTileEntityWithAlternatives(par.right(), par.left(), "DM" + par.left());
}
}
}