Generic error correct
This commit is contained in:
parent
7c0cea635d
commit
9379788eb0
|
@ -1,197 +0,0 @@
|
|||
package resonantinduction.archaic.firebox;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
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.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import resonant.lib.prefab.block.BlockTile;
|
||||
import resonant.lib.utility.FluidUtility;
|
||||
import resonantinduction.core.Reference;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFirebox extends BlockTile
|
||||
{
|
||||
private IIcon topOn;
|
||||
private IIcon topOff;
|
||||
private IIcon sideOn;
|
||||
private IIcon sideOff;
|
||||
|
||||
private IIcon topElectricOn;
|
||||
private IIcon topElectricOff;
|
||||
private IIcon sideOnElectric;
|
||||
private IIcon sideOffElectric;
|
||||
|
||||
public BlockFirebox(int id)
|
||||
{
|
||||
super(id, Material.rock);
|
||||
setTickRandomly(true);
|
||||
setTextureName(Reference.PREFIX + "material_stone_slab");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg)
|
||||
{
|
||||
super.registerIcons(iconReg);
|
||||
sideOn = iconReg.registerIcon(Reference.PREFIX + "firebox_side_on");
|
||||
sideOff = iconReg.registerIcon(Reference.PREFIX + "firebox_side_off");
|
||||
topOn = iconReg.registerIcon(Reference.PREFIX + "firebox_top_on");
|
||||
topOff = iconReg.registerIcon(Reference.PREFIX + "firebox_top_off");
|
||||
|
||||
sideOnElectric = iconReg.registerIcon(Reference.PREFIX + "firebox_electric_side_on");
|
||||
sideOffElectric = iconReg.registerIcon(Reference.PREFIX + "firebox_electric_side_off");
|
||||
topElectricOn = iconReg.registerIcon(Reference.PREFIX + "firebox_electric_top_on");
|
||||
topElectricOff = iconReg.registerIcon(Reference.PREFIX + "firebox_electric_top_off");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileFirebox)
|
||||
{
|
||||
TileFirebox tile = (TileFirebox) tileEntity;
|
||||
extractItem(tile, 0, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tileEntity instanceof TileFirebox)
|
||||
{
|
||||
TileFirebox tile = (TileFirebox) tileEntity;
|
||||
|
||||
if (FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return interactCurrentItem(tile, 0, player);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getBlockTexture(IBlockAccess access, int x, int y, int z, int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return blockIcon;
|
||||
|
||||
boolean isElectric = access.getBlockMetadata(x, y, z) == 1;
|
||||
boolean isBurning = false;
|
||||
TileEntity tile = access.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileFirebox)
|
||||
{
|
||||
isBurning = ((TileFirebox) tile).isBurning();
|
||||
}
|
||||
|
||||
if (side == 1)
|
||||
{
|
||||
return isBurning ? (isElectric ? topElectricOn : topOn) : (isElectric ? topElectricOff : topOff);
|
||||
}
|
||||
|
||||
return isBurning ? (isElectric ? sideOnElectric : sideOn) : (isElectric ? sideOffElectric : sideOff);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if (side == 0)
|
||||
return blockIcon;
|
||||
|
||||
boolean isElectric = meta == 1;
|
||||
boolean isBurning = false;
|
||||
|
||||
if (side == 1)
|
||||
{
|
||||
return isBurning ? (isElectric ? topElectricOn : topOn) : (isElectric ? topElectricOff : topOff);
|
||||
}
|
||||
|
||||
return isBurning ? (isElectric ? sideOnElectric : sideOn) : (isElectric ? sideOffElectric : sideOff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random par5Random)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (((TileFirebox) tileEntity).isBurning())
|
||||
{
|
||||
float xDisplace = x + 0.5F;
|
||||
float yDisplace = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
|
||||
float zDisplace = z + 0.5F;
|
||||
float modifier = 0.52F;
|
||||
float randomValue = par5Random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
world.spawnParticle("smoke", xDisplace - modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", xDisplace - modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", xDisplace + modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", xDisplace + modifier, yDisplace, zDisplace + randomValue, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", xDisplace + randomValue, yDisplace, zDisplace - modifier, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", xDisplace + randomValue, yDisplace, zDisplace - modifier, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
world.spawnParticle("smoke", xDisplace + randomValue, yDisplace, zDisplace + modifier, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", xDisplace + randomValue, yDisplace, zDisplace + modifier, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
int blockIDAbove = world.getBlockId(x, y + 1, z);
|
||||
|
||||
if (blockIDAbove == Block.waterStill.blockID)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
world.spawnParticle("bubble", xDisplace + (par5Random.nextFloat() - 0.5), yDisplace + 1.5, zDisplace + (par5Random.nextFloat() - 0.5), 0.0D, 0.05D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockBrightness(IBlockAccess access, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = access.getTileEntity(x, y, z);
|
||||
|
||||
if (((TileFirebox) tileEntity).isBurning())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
return par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileFirebox();
|
||||
}
|
||||
}
|
|
@ -1,14 +1,25 @@
|
|||
package resonantinduction.archaic.firebox;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import resonant.content.spatial.block.SpatialBlock;
|
||||
import resonant.engine.grid.thermal.BoilEvent;
|
||||
import resonant.engine.grid.thermal.ThermalPhysics;
|
||||
import resonant.lib.network.discriminator.PacketAnnotation;
|
||||
import resonant.lib.network.discriminator.PacketTile;
|
||||
import resonant.lib.network.discriminator.PacketType;
|
||||
import resonant.lib.network.handle.IPacketReceiver;
|
||||
import resonant.lib.utility.FluidUtility;
|
||||
import resonantinduction.archaic.Archaic;
|
||||
import resonantinduction.archaic.fluid.gutter.TileGutter;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -28,6 +39,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
|
|||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonant.lib.network.Synced;
|
||||
import resonantinduction.core.CoreContent;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import resonantinduction.core.resource.TileMaterial;
|
||||
|
@ -35,6 +47,8 @@ import universalelectricity.core.transform.vector.Vector3;
|
|||
import resonant.lib.content.prefab.java.TileElectricInventory;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Meant to replace the furnace class.
|
||||
*
|
||||
|
@ -169,26 +183,6 @@ public class TileFirebox extends TileElectricInventory implements IPacketReceive
|
|||
heatEnergy = 0;
|
||||
}
|
||||
}
|
||||
else if (block == Archaic.blockGutter())
|
||||
{
|
||||
TileEntity tileEntity = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
|
||||
|
||||
if (tileEntity instanceof TileGutter)
|
||||
{
|
||||
usedHeat = true;
|
||||
int volume = Math.min(((TileGutter) tileEntity).getInternalTank().getFluidAmount(), 10);
|
||||
if (volume > 0 && heatEnergy >= getRequiredBoilWaterEnergy(volume))
|
||||
{
|
||||
if (FluidRegistry.getFluid("steam") != null)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new BoilEvent(worldObj, new Vector3(this).add(0, 1, 0), new FluidStack(FluidRegistry.WATER, volume), new FluidStack(FluidRegistry.getFluid("steam"), volume), 2, false));
|
||||
((TileGutter) tileEntity).drain(ForgeDirection.DOWN, volume, true);
|
||||
}
|
||||
|
||||
heatEnergy = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!usedHeat)
|
||||
{
|
||||
|
@ -315,4 +309,65 @@ public class TileFirebox extends TileElectricInventory implements IPacketReceive
|
|||
{
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg)
|
||||
{
|
||||
super.registerIcons(iconReg);
|
||||
SpatialBlock.icon().put("firebox_side_on", iconReg.registerIcon(Reference.prefix() + "firebox_side_on"));
|
||||
SpatialBlock.icon().put("firebox_side_off", iconReg.registerIcon(Reference.prefix() + "firebox_side_off"));
|
||||
SpatialBlock.icon().put("firebox_top_on", iconReg.registerIcon(Reference.prefix() + "firebox_top_on"));
|
||||
SpatialBlock.icon().put("firebox_top_off", iconReg.registerIcon(Reference.prefix() + "firebox_top_off"));
|
||||
|
||||
SpatialBlock.icon().put("firebox_electric_side_on", iconReg.registerIcon(Reference.prefix() + "firebox_electric_side_on"));
|
||||
SpatialBlock.icon().put("firebox_electric_side_off", iconReg.registerIcon(Reference.prefix() + "firebox_electric_side_off"));
|
||||
SpatialBlock.icon().put("firebox_electric_top_on", iconReg.registerIcon(Reference.prefix() + "firebox_electric_top_on"));
|
||||
SpatialBlock.icon().put("firebox_electric_top_off", iconReg.registerIcon(Reference.prefix() + "firebox_electric_top_off"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void click(EntityPlayer player)
|
||||
{
|
||||
if(server())
|
||||
extractItem((IInventory)this, 0, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean use(EntityPlayer player, int side, Vector3 hit)
|
||||
{
|
||||
|
||||
if (FluidUtility.playerActivatedFluidItem(world(), x(), y(), z(), player, side))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return interactCurrentItem((IInventory)this, 0, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
if (side == 0)
|
||||
return SpatialBlock.icon().get("firebox");
|
||||
|
||||
boolean isElectric = meta == 1;
|
||||
boolean isBurning = false;
|
||||
|
||||
if (side == 1)
|
||||
{
|
||||
return isBurning ? (isElectric ? SpatialBlock.icon().get("firebox_eletric_top_on") : SpatialBlock.icon().get("firebox_top_on")) : (isElectric ? SpatialBlock.icon().get("firebox_eletric_top_off") : SpatialBlock.icon().get("firebox_top_off"));
|
||||
}
|
||||
|
||||
return isBurning ? (isElectric ? SpatialBlock.icon().get("firebox_eletric_side_on") : SpatialBlock.icon().get("firebox_side_on")) : (isElectric ? SpatialBlock.icon().get("firebox_eletric_side_off") : SpatialBlock.icon().get("firebox_side_off"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import universalelectricity.api.core.grid.{INode, INodeProvider}
|
|||
|
||||
trait TraitNodeProvider extends TileMultipart with INodeProvider
|
||||
{
|
||||
def getNode[N <: INode](nodeType: Class[N], from: ForgeDirection): N =
|
||||
def getNode(nodeType: Class[INode], from: ForgeDirection): INode =
|
||||
{
|
||||
var part = partMap(from.ordinal)
|
||||
|
||||
|
@ -19,6 +19,6 @@ trait TraitNodeProvider extends TileMultipart with INodeProvider
|
|||
return part.asInstanceOf[INodeProvider].getNode(nodeType, from)
|
||||
}
|
||||
|
||||
return null.asInstanceOf[N]
|
||||
return null
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import net.minecraftforge.fluids.{FluidStack, FluidTank, IFluidHandler}
|
|||
import resonant.content.spatial.block.SpatialTile
|
||||
import resonant.lib.network.ByteBufWrapper.ByteBufWrapper
|
||||
import resonant.lib.network.discriminator.PacketType
|
||||
import resonant.lib.network.handle.{TPacketIDReceiver, TPacketIDSender}
|
||||
import resonant.lib.network.handle.{IPacketIDReceiver, TPacketIDSender}
|
||||
import resonant.lib.network.netty.PacketManager
|
||||
import resonant.lib.utility.FluidUtility
|
||||
import resonantinduction.core.ResonantInduction
|
||||
|
@ -26,7 +26,7 @@ object TileFluidNodeProvider extends Enumeration
|
|||
final val PACKET_DESCRIPTION, PACKET_RENDER, PACKET_TANK = Value
|
||||
}
|
||||
|
||||
abstract class TileFluidNodeProvider(material: Material) extends SpatialTile(material) with INodeProvider with IFluidHandler with TPacketIDReceiver with TPacketIDSender
|
||||
abstract class TileFluidNodeProvider(material: Material) extends SpatialTile(material) with INodeProvider with IFluidHandler with IPacketIDReceiver with TPacketIDSender
|
||||
{
|
||||
protected var tank: FluidTank
|
||||
protected var pressure = 0
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.init.Items;
|
|||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fluids.BlockFluidFinite;
|
||||
import resonant.lib.render.RenderUtility;
|
||||
import resonantinduction.core.CoreContent;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.prefab.FluidColored;
|
||||
|
@ -41,14 +42,13 @@ public class TextureHookHandler
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void postTextureHook(TextureStitchEvent.Post event)
|
||||
{
|
||||
Items.arrow
|
||||
for (BlockFluidFinite block : ResonantInduction.blockMixtureFluids.values())
|
||||
for (BlockFluidFinite block : CoreContent.blockMixtureFluids().values())
|
||||
{
|
||||
block.getFluid().setIcons(RenderUtility.getIcon(Reference.prefix() + "mixture_flow"));
|
||||
((FluidColored) block.getFluid()).setColor(ResourceGenerator.getColor(ResourceGenerator.mixtureToMaterial(block.getFluid().getName())));
|
||||
}
|
||||
|
||||
for (BlockFluidFinite block : ResonantInduction.blockMoltenFluid.values())
|
||||
for (BlockFluidFinite block : CoreContent.blockMoltenFluid().values())
|
||||
{
|
||||
block.getFluid().setIcons(RenderUtility.getIcon(Reference.prefix() + "molten_flow"));
|
||||
((FluidColored) block.getFluid()).setColor(ResourceGenerator.getColor(ResourceGenerator.moltenToMaterial(block.getFluid().getName())));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package resonantinduction.core.resource;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -11,9 +12,11 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import resonant.lib.utility.LanguageUtility;
|
||||
import resonantinduction.core.CoreContent;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import scala.collection.Iterator;
|
||||
|
||||
/**
|
||||
* An item used for auto-generated dusts based on registered ingots in the OreDict.
|
||||
|
@ -22,8 +25,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
*/
|
||||
public class ItemResourceDust extends Item
|
||||
{
|
||||
private Block block = ResonantInduction.blockRefinedDust;
|
||||
|
||||
public ItemResourceDust()
|
||||
{
|
||||
setHasSubtypes(true);
|
||||
|
@ -32,11 +33,11 @@ public class ItemResourceDust extends Item
|
|||
|
||||
public static String getMaterialFromStack(ItemStack itemStack)
|
||||
{
|
||||
return ResourceGenerator.getName(itemStack.getItemDamage());
|
||||
return ResourceGenerator.getName(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack is)
|
||||
public String getItemStackDisplayName(ItemStack is)
|
||||
{
|
||||
String material = getMaterialFromStack(is);
|
||||
|
||||
|
@ -62,9 +63,9 @@ public class ItemResourceDust extends Item
|
|||
/**
|
||||
* Allow refined dust to be placed down.
|
||||
*/
|
||||
if (itemStack.getItem() == ResonantInduction.itemDust || itemStack.getItem() == ResonantInduction.itemRefinedDust)
|
||||
if (itemStack.getItem() == CoreContent.dust() || itemStack.getItem() == CoreContent.refinedDust())
|
||||
{
|
||||
blockID = itemStack.getItem() == ResonantInduction.itemRefinedDust ? ResonantInduction.blockRefinedDust.blockID : ResonantInduction.blockDust.blockID;
|
||||
Block block = itemStack.getItem() == CoreContent.dust() ? CoreContent.blockDust() : CoreContent.blockRefinedDust();
|
||||
|
||||
if (itemStack.stackSize == 0)
|
||||
{
|
||||
|
@ -78,17 +79,16 @@ public class ItemResourceDust extends Item
|
|||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (world.getBlockId(x, y, z) == blockID && tile instanceof TileMaterial)
|
||||
if (world.getBlock(x, y, z) == block && tile instanceof TileMaterial)
|
||||
{
|
||||
if (getMaterialFromStack(itemStack).equals(((TileMaterial) tile).name))
|
||||
if (getMaterialFromStack(itemStack).equals(((TileMaterial) tile).name()))
|
||||
{
|
||||
Block block = Block.blocksList[blockID];
|
||||
int j1 = world.getBlockMetadata(x, y, z);
|
||||
int k1 = j1 & 7;
|
||||
|
||||
if (k1 <= 6 && world.checkNoEntityCollision(block.getCollisionBoundingBoxFromPool(world, x, y, z)) && world.setBlockMetadataWithNotify(x, y, z, k1 + 1 | j1 & -8, 2))
|
||||
{
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
--itemStack.stackSize;
|
||||
return true;
|
||||
}
|
||||
|
@ -125,15 +125,14 @@ public class ItemResourceDust extends Item
|
|||
++x;
|
||||
}
|
||||
|
||||
if (world.canPlaceEntityOnSide(blockID, x, y, z, false, side, player, itemStack))
|
||||
if (world.canPlaceEntityOnSide(block, x, y, z, false, side, player, itemStack))
|
||||
{
|
||||
Block block = Block.blocksList[blockID];
|
||||
int j1 = this.getMetadata(itemStack.getItemDamage());
|
||||
int k1 = Block.blocksList[blockID].onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, j1);
|
||||
int k1 = block.onBlockPlaced(world, x, y, z, side, hitX, hitY, hitZ, j1);
|
||||
|
||||
if (placeBlockAt(itemStack, player, world, x, y, z, side, hitX, hitY, hitZ, k1))
|
||||
{
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
|
||||
--itemStack.stackSize;
|
||||
}
|
||||
|
||||
|
@ -147,17 +146,17 @@ public class ItemResourceDust extends Item
|
|||
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
{
|
||||
blockID = stack.getItem() == ResonantInduction.itemRefinedDust ? ResonantInduction.blockRefinedDust.blockID : ResonantInduction.blockDust.blockID;
|
||||
Block block = stack.getItem() == CoreContent.refinedDust() ? CoreContent.blockRefinedDust() : CoreContent.blockDust();
|
||||
|
||||
if (!world.setBlock(x, y, z, this.blockID, metadata, 3))
|
||||
if (!world.setBlock(x, y, z, block, metadata, 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlockId(x, y, z) == this.blockID)
|
||||
if (world.getBlock(x, y, z) == block)
|
||||
{
|
||||
Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
Block.blocksList[this.blockID].onPostBlockPlaced(world, x, y, z, metadata);
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -165,17 +164,16 @@ public class ItemResourceDust extends Item
|
|||
|
||||
public ItemStack getStackFromMaterial(String name)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
itemStack.setItemDamage(ResourceGenerator.getID(name));
|
||||
return itemStack;
|
||||
return ResourceGenerator.getRefinedDust(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (String materialName : ResourceGenerator.materials.keySet())
|
||||
Iterator<String> it = ResourceGenerator.materials().iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
par3List.add(getStackFromMaterial(materialName));
|
||||
par3List.add(it.next());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,16 +181,6 @@ public class ItemResourceDust extends Item
|
|||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack itemStack, int par2)
|
||||
{
|
||||
/**
|
||||
* Auto-color based on the texture of the ingot.
|
||||
*/
|
||||
String name = ItemResourceDust.getMaterialFromStack(itemStack);
|
||||
|
||||
if (ResourceGenerator.materialColorCache.containsKey(name))
|
||||
{
|
||||
return ResourceGenerator.materialColorCache.get(name);
|
||||
}
|
||||
|
||||
return 16777215;
|
||||
return ResourceGenerator.getColor(ItemResourceDust.getMaterialFromStack(itemStack));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,4 @@ import net.minecraft.item.Item;
|
|||
*/
|
||||
public class ItemResourcePart extends Item
|
||||
{
|
||||
public ItemResourcePart(int par1)
|
||||
{
|
||||
super(par1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,10 @@ import scala.collection.mutable
|
|||
object ResourceGenerator
|
||||
{
|
||||
final val materials = mutable.Set.empty[String]
|
||||
private final val materialColorCache = mutable.HashMap.empty[String, Integer]
|
||||
private final val iconColorCache = mutable.HashMap.empty[IIcon, Integer]
|
||||
final val materialColorCache = mutable.HashMap.empty[String, Integer]
|
||||
final val iconColorCache = mutable.HashMap.empty[IIcon, Integer]
|
||||
|
||||
private final val category = "resource-generator"
|
||||
final val category = "resource-generator"
|
||||
|
||||
@Config(category = category)
|
||||
var enableAll: Boolean = true
|
||||
|
|
|
@ -3,6 +3,7 @@ package resonantinduction.core.resource.fluid;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
@ -24,6 +25,11 @@ public class TileFluidMixture extends TileMaterial
|
|||
public final Set<ItemStack> items = new HashSet<ItemStack>();
|
||||
public final Set<FluidStack> fluids = new HashSet<FluidStack>();
|
||||
|
||||
public TileFluidMixture()
|
||||
{
|
||||
super(Material.water);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate()
|
||||
{
|
||||
|
@ -32,14 +38,14 @@ public class TileFluidMixture extends TileMaterial
|
|||
|
||||
public boolean mix(ItemStack itemStack)
|
||||
{
|
||||
if (MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER.name(), itemStack).length > 0 && getBlockMetadata() < 8)
|
||||
if (MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER().toString(), itemStack).length > 0 && getBlockMetadata() < 8)
|
||||
{
|
||||
// TODO: Maybe we need to merge the stacks?
|
||||
items.add(itemStack);
|
||||
|
||||
if (name == null)
|
||||
if (name() == null)
|
||||
{
|
||||
name = ResourceGenerator.getName(itemStack.getItemDamage());
|
||||
name_$eq(ResourceGenerator.getName(itemStack));
|
||||
}
|
||||
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, getBlockMetadata() + 1, 3);
|
||||
|
@ -90,19 +96,19 @@ public class TileFluidMixture extends TileMaterial
|
|||
fluids.clear();
|
||||
items.clear();
|
||||
|
||||
NBTTagList fluidList = nbt.getTagList("Fluids");
|
||||
NBTTagList fluidList = nbt.getTagList("Fluids", 0);
|
||||
|
||||
for (int i = 0; i < fluidList.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound fluidNBT = (NBTTagCompound) fluidList.tagAt(i);
|
||||
NBTTagCompound fluidNBT = (NBTTagCompound) fluidList.getCompoundTagAt(i);
|
||||
fluids.add(FluidStack.loadFluidStackFromNBT(fluidNBT));
|
||||
}
|
||||
|
||||
NBTTagList itemList = nbt.getTagList("Items");
|
||||
NBTTagList itemList = nbt.getTagList("Items", 0);
|
||||
|
||||
for (int i = 0; i < itemList.tagCount(); ++i)
|
||||
{
|
||||
NBTTagCompound stackTag = (NBTTagCompound) itemList.tagAt(i);
|
||||
NBTTagCompound stackTag = (NBTTagCompound) itemList.getCompoundTagAt(i);
|
||||
items.add(ItemStack.loadItemStackFromNBT(stackTag));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue