ChangesToPairClass
This commit is contained in:
parent
a03af80087
commit
9543e46c0b
6 changed files with 52 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ItemWorldHelper
|
|||
}
|
||||
|
||||
/** Gets all EntityItems in an area and sorts them by a list of itemStacks
|
||||
*
|
||||
*
|
||||
* @param world - world being worked in
|
||||
* @param start - start point
|
||||
* @param end - end point
|
||||
|
@ -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)
|
||||
{
|
||||
for (ItemStack itemStack : disiredItems)
|
||||
for (EntityItem entityItem : entityItems)
|
||||
{
|
||||
if (entityItem.getEntityItem().itemID == itemStack.itemID && entityItem.getEntityItem().getItemDamage() == itemStack.getItemDamage() && !newItemList.contains(entityItem))
|
||||
if (entityItem.getEntityItem().isItemEqual(itemStack) && !newItemList.contains(entityItem))
|
||||
{
|
||||
newItemList.add(entityItem);
|
||||
break;
|
||||
|
@ -69,7 +68,7 @@ public class ItemWorldHelper
|
|||
}
|
||||
|
||||
/** filter a list of itemStack to another list of itemStacks
|
||||
*
|
||||
*
|
||||
* @param totalItems - full list of items being filtered
|
||||
* @param desiredItems - list the of item that are being filtered too
|
||||
* @return a list of item from the original that are wanted */
|
||||
|
@ -92,7 +91,7 @@ public class ItemWorldHelper
|
|||
}
|
||||
|
||||
/** grabs all the items that the block can drop then pass them onto dropBlockAsItem_do
|
||||
*
|
||||
*
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue