v4.0.6 Release
*Merged all block sprites into "terrain.png." *Fixed Obsidian Bow texture. *Merged Platinum Ore, Platinum Block, Redstone Block, Refined Obsidian, Coal Block, and Refined Glowstone into a single block ID. *Added separate thread for retrieving news and newest version. *Lots more javadocs! *Started work on sound system. *Made tile entity handle machine facing. *Added NBT storage to save currentItemBurnTime, isActive, and facing. *Fixed packet system to retrieve block state from server on game startup. *Fixed block direction and isActive state not being loaded on game startup. *Only TileEntityMachine handles NBT saving/loading now. *Fixed strange characters in version number retrieving. *Added Forge Configuration support instead of generic Properties. *Renamed ThreadServerData to ThreadSendData. *Fixed double name-adding for Redstone Block. *Changed version number to 4.0.6.
No files matched your search
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 14 KiB |
@@ -1,61 +0,0 @@
|
||||
package net.uberkat.obsidian.common;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.registry.BlockProxy;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class BlockBase extends Block
|
||||
{
|
||||
public BlockBase(int i, int j)
|
||||
{
|
||||
super(i, j, Material.iron);
|
||||
|
||||
if(blockID == ObsidianIngots.platinumOreID)
|
||||
{
|
||||
setHardness(3F);
|
||||
setResistance(5F);
|
||||
}
|
||||
if(blockID == ObsidianIngots.refinedGlowstoneID || blockID == ObsidianIngots.refinedObsidianID || blockID == ObsidianIngots.coalBlockID || blockID == ObsidianIngots.redstoneBlockID || blockID == ObsidianIngots.platinumBlockID)
|
||||
{
|
||||
setHardness(5F);
|
||||
setResistance(10F);
|
||||
if(blockID == ObsidianIngots.refinedObsidianID)
|
||||
{
|
||||
setLightValue(0.5F);
|
||||
}
|
||||
if(blockID == ObsidianIngots.refinedGlowstoneID)
|
||||
{
|
||||
setLightValue(0.875F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int idDropped(int i, Random random)
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
if(blockID == ObsidianIngots.refinedObsidianID)
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 19, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getTextureFile() {
|
||||
return "/obsidian/terrain.png";
|
||||
}
|
||||
}
|
||||
@@ -12,20 +12,20 @@ public class BlockCombiner extends BlockMachine
|
||||
{
|
||||
public BlockCombiner(int par1)
|
||||
{
|
||||
super(par1, "Combiner.png");
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == metadata)
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? currentFrontTextureIndex : 17;
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 48 : 15;
|
||||
}
|
||||
else {
|
||||
return 16;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ public class BlockCombiner extends BlockMachine
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 17;
|
||||
return 15;
|
||||
}
|
||||
else {
|
||||
return 16;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@ public class BlockCrusher extends BlockMachine
|
||||
{
|
||||
public BlockCrusher(int par1)
|
||||
{
|
||||
super(par1, "terrain.png");
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == metadata)
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? 16 : 17;
|
||||
return isActive(world, x, y, z) ? 12 : 13;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
@@ -33,7 +33,7 @@ public class BlockCrusher extends BlockMachine
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 17;
|
||||
return 13;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
|
||||
@@ -12,17 +12,17 @@ public class BlockEnrichmentChamber extends BlockMachine
|
||||
{
|
||||
public BlockEnrichmentChamber(int par1)
|
||||
{
|
||||
super(par1, "terrain.png");
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == metadata)
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? 8 : 9;
|
||||
return isActive(world, x, y, z) ? 8 : 9;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
|
||||
@@ -10,20 +10,16 @@ public class BlockMachine extends BlockContainer
|
||||
{
|
||||
public Random machineRand = new Random();
|
||||
|
||||
public static int currentFrontTextureIndex = 0;
|
||||
public static int currentBackTextureIndex = 16;
|
||||
public static int currentSideTextureIndex = 32;
|
||||
|
||||
public String textureFile;
|
||||
public int textureIndex = 32;
|
||||
|
||||
public BlockMachine(int id, String texture)
|
||||
public BlockMachine(int id)
|
||||
{
|
||||
super(id, Material.iron);
|
||||
textureFile = "/obsidian/" + texture;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
int side = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int change = 3;
|
||||
|
||||
@@ -35,14 +31,14 @@ public class BlockMachine extends BlockContainer
|
||||
case 3: change = 4; break;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, change);
|
||||
tileEntity.setFacing(change);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (ObsidianUtils.isActive(world, x, y, z))
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
if (isActive(world, x, y, z))
|
||||
{
|
||||
float var7 = (float)x + 0.5F;
|
||||
float var8 = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
|
||||
@@ -50,22 +46,22 @@ public class BlockMachine extends BlockContainer
|
||||
float var10 = 0.52F;
|
||||
float var11 = random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (metadata == 4)
|
||||
if (tileEntity.facing == 4)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (metadata == 5)
|
||||
else if (tileEntity.facing == 5)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (metadata == 2)
|
||||
else if (tileEntity.facing == 2)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (metadata == 3)
|
||||
else if (tileEntity.facing == 3)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D);
|
||||
@@ -73,36 +69,22 @@ public class BlockMachine extends BlockContainer
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateTexture(World world, int x, int y, int z)
|
||||
/**
|
||||
* Checks if a machine is in it's active state.
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return if machine is active
|
||||
*/
|
||||
public boolean isActive(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if(currentFrontTextureIndex < 15 && currentFrontTextureIndex > -1)
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
if(tileEntity != null)
|
||||
{
|
||||
currentFrontTextureIndex++;
|
||||
return tileEntity.isActive;
|
||||
}
|
||||
if(currentFrontTextureIndex == 15)
|
||||
{
|
||||
currentFrontTextureIndex = 0;
|
||||
}
|
||||
|
||||
if(currentBackTextureIndex < 31 && currentBackTextureIndex > 15)
|
||||
{
|
||||
currentBackTextureIndex++;
|
||||
}
|
||||
if(currentBackTextureIndex == 31)
|
||||
{
|
||||
currentBackTextureIndex = 16;
|
||||
}
|
||||
|
||||
if(currentSideTextureIndex < 47 && currentSideTextureIndex > 31)
|
||||
{
|
||||
currentSideTextureIndex++;
|
||||
}
|
||||
if(currentSideTextureIndex == 47)
|
||||
{
|
||||
currentSideTextureIndex = 32;
|
||||
}
|
||||
|
||||
world.markBlockAsNeedsUpdate(x, y, z);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void breakBlock(World world, int par2, int par3, int par4, int i1, int i2)
|
||||
@@ -154,7 +136,7 @@ public class BlockMachine extends BlockContainer
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return textureFile;
|
||||
return "/obsidian/terrain.png";
|
||||
}
|
||||
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package net.uberkat.obsidian.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Block object for handling multiple IDs.
|
||||
* 0: Platinum Ore
|
||||
* 1: Platinum Block
|
||||
* 2: Redstone Block
|
||||
* 3: Refined Obsidian
|
||||
* 4: Coal Block
|
||||
* 5: Refined Glowstone
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class BlockMulti extends Block
|
||||
{
|
||||
public BlockMulti(int i)
|
||||
{
|
||||
super(i, Material.iron);
|
||||
setCreativeTab(CreativeTabs.tabBlock);
|
||||
setRequiresSelfNotify();
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
{
|
||||
switch(meta)
|
||||
{
|
||||
case 0:
|
||||
return 3;
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 0;
|
||||
case 4:
|
||||
return 10;
|
||||
case 5:
|
||||
return 11;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int damageDropped(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int i, CreativeTabs creativetabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, 0));
|
||||
list.add(new ItemStack(i, 1, 1));
|
||||
list.add(new ItemStack(i, 1, 2));
|
||||
list.add(new ItemStack(i, 1, 3));
|
||||
list.add(new ItemStack(i, 1, 4));
|
||||
list.add(new ItemStack(i, 1, 5));
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int i1, float f1, float f2, float f3)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(metadata == 3)
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(ObsidianIngots.instance, 19, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityliving)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
switch(metadata)
|
||||
{
|
||||
case 0:
|
||||
setHardness(3F).setResistance(5F);
|
||||
break;
|
||||
case 1:
|
||||
setHardness(5F).setResistance(10F);
|
||||
break;
|
||||
case 2:
|
||||
setHardness(5F).setResistance(10F);
|
||||
break;
|
||||
case 3:
|
||||
setHardness(10F).setResistance(15F).setLightValue(0.5F);
|
||||
break;
|
||||
case 4:
|
||||
setHardness(5F).setResistance(10F);
|
||||
break;
|
||||
case 5:
|
||||
setHardness(5F).setResistance(10F).setLightValue(0.875F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return "/obsidian/terrain.png";
|
||||
}
|
||||
}
|
||||
@@ -12,20 +12,20 @@ public class BlockPlatinumCompressor extends BlockMachine
|
||||
{
|
||||
public BlockPlatinumCompressor(int par1)
|
||||
{
|
||||
super(par1, "Compressor.png");
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == metadata)
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? currentFrontTextureIndex : 17;
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 32 : 14;
|
||||
}
|
||||
else {
|
||||
return 16;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ public class BlockPlatinumCompressor extends BlockMachine
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return 17;
|
||||
return 14;
|
||||
}
|
||||
else {
|
||||
return 16;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,29 +13,29 @@ public class BlockTheoreticalElementizer extends BlockMachine
|
||||
{
|
||||
public BlockTheoreticalElementizer(int par1)
|
||||
{
|
||||
super(par1, "Elementizer.png");
|
||||
super(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockTexture(IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? 52 : 50;
|
||||
return isActive(world, x, y, z) ? 20 : 18;
|
||||
}
|
||||
else {
|
||||
if(side == metadata)
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? currentFrontTextureIndex : 48;
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 64 : 16;
|
||||
}
|
||||
else if(side == ForgeDirection.getOrientation(metadata).getOpposite().ordinal())
|
||||
else if(side == ForgeDirection.getOrientation(tileEntity.facing).getOpposite().ordinal())
|
||||
{
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? currentBackTextureIndex : 49;
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 80 : 17;
|
||||
}
|
||||
else {
|
||||
return ObsidianUtils.isActive(world, x, y, z) ? currentSideTextureIndex : 51;
|
||||
return isActive(world, x, y, z) ? tileEntity.textureIndex + 96 : 19;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,14 +44,14 @@ public class BlockTheoreticalElementizer extends BlockMachine
|
||||
{
|
||||
if(side == 0 || side == 1)
|
||||
{
|
||||
return 50;
|
||||
return 18;
|
||||
}
|
||||
else if(side == 3)
|
||||
{
|
||||
return 48;
|
||||
return 16;
|
||||
}
|
||||
else {
|
||||
return 51;
|
||||
return 19;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CombinerRecipes
|
||||
addSmelting(ObsidianIngots.ObsidianDust.shiftedIndex, new ItemStack(Block.obsidian, 1));
|
||||
addSmelting(ObsidianIngots.IronDust.shiftedIndex, new ItemStack(Block.oreIron, 1));
|
||||
addSmelting(ObsidianIngots.GoldDust.shiftedIndex, new ItemStack(Block.oreGold, 1));
|
||||
addSmelting(ObsidianIngots.PlatinumDust.shiftedIndex, new ItemStack(ObsidianIngots.PlatinumOre, 1));
|
||||
addSmelting(ObsidianIngots.PlatinumDust.shiftedIndex, new ItemStack(ObsidianIngots.MultiBlock, 1, 0));
|
||||
addSmelting(Item.diamond.shiftedIndex, new ItemStack(Block.oreDiamond, 1));
|
||||
addSmelting(new ItemStack(Item.dyePowder, 1, 4).getItem().shiftedIndex, new ItemStack(Block.oreLapis, 1));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
/**
|
||||
* Client and server GUI hander for Obsidian Ingots.
|
||||
* Uses CommonProxy to get the server GUI and ClientProxy for the client GUI.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class CommonGuiHandler implements IGuiHandler
|
||||
{
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
/**
|
||||
@@ -22,10 +23,7 @@ public class CommonProxy
|
||||
/**
|
||||
* Register and load client-only render information.
|
||||
*/
|
||||
public void registerRenderInformation()
|
||||
{
|
||||
|
||||
}
|
||||
public void registerRenderInformation() {}
|
||||
|
||||
/**
|
||||
* Gets the world the client is using from ClientProxy.
|
||||
@@ -47,77 +45,32 @@ public class CommonProxy
|
||||
}
|
||||
|
||||
/**
|
||||
* Set and load the mod's common properties.
|
||||
* Set and load the mod's common configuration properties.
|
||||
*/
|
||||
public void setProperties()
|
||||
public void loadConfiguration()
|
||||
{
|
||||
Properties properties = new Properties();
|
||||
try
|
||||
{
|
||||
File config = ObsidianIngots.configuration;
|
||||
if(config.exists())
|
||||
{
|
||||
properties.load(new FileInputStream(config));
|
||||
ObsidianIngots.platinumOreID = Integer.parseInt(properties.getProperty("platinumOreID"));
|
||||
ObsidianIngots.platinumBlockID = Integer.parseInt(properties.getProperty("platinumBlockID"));
|
||||
ObsidianIngots.redstoneBlockID = Integer.parseInt(properties.getProperty("redstoneBlockID"));
|
||||
ObsidianIngots.obsidianTNTID = Integer.parseInt(properties.getProperty("obsidianTNTID"));
|
||||
ObsidianIngots.refinedObsidianID = Integer.parseInt(properties.getProperty("refinedObsidianID"));
|
||||
ObsidianIngots.elementizerID = Integer.parseInt(properties.getProperty("elementizerID"));
|
||||
ObsidianIngots.enrichmentChamberID = Integer.parseInt(properties.getProperty("enrichmentChamberID"));
|
||||
ObsidianIngots.platinumCompressorID = Integer.parseInt(properties.getProperty("platinumCompressorID"));
|
||||
ObsidianIngots.combinerID = Integer.parseInt(properties.getProperty("combinerID"));
|
||||
ObsidianIngots.crusherID = Integer.parseInt(properties.getProperty("crusherID"));
|
||||
ObsidianIngots.coalBlockID = Integer.parseInt(properties.getProperty("coalBlockID"));
|
||||
ObsidianIngots.refinedGlowstoneID = Integer.parseInt(properties.getProperty("refinedGlowstoneID"));
|
||||
ObsidianIngots.extrasEnabled = Boolean.parseBoolean(properties.getProperty("extrasEnabled"));
|
||||
ObsidianIngots.oreGenerationEnabled = Boolean.parseBoolean(properties.getProperty("oreGenerationEnabled"));
|
||||
ObsidianIngots.logger.info("[ObsidianIngots] Data loaded.");
|
||||
}
|
||||
else {
|
||||
config.createNewFile();
|
||||
ObsidianIngots.logger.info("[ObsidianIngots] Created 'ObsidianIngots.txt' configuration file.");
|
||||
FileOutputStream fileoutputstream = new FileOutputStream(config);
|
||||
properties.setProperty("platinumOreID", Integer.toString(200));
|
||||
properties.setProperty("platinumBlockID", Integer.toString(201));
|
||||
properties.setProperty("redstoneBlockID", Integer.toString(202));
|
||||
properties.setProperty("obsidianTNTID", Integer.toString(203));
|
||||
properties.setProperty("refinedObsidianID", Integer.toString(204));
|
||||
properties.setProperty("elementizerID", Integer.toString(205));
|
||||
properties.setProperty("enrichmentChamberID", Integer.toString(206));
|
||||
properties.setProperty("platinumCompressorID", Integer.toString(207));
|
||||
properties.setProperty("combinerID", Integer.toString(208));
|
||||
properties.setProperty("crusherID", Integer.toString(209));
|
||||
properties.setProperty("coalBlockID", Integer.toString(210));
|
||||
properties.setProperty("refinedGlowstoneID", Integer.toString(211));
|
||||
properties.setProperty("extrasEnabled", Boolean.toString(true));
|
||||
properties.setProperty("oreGenerationEnabled", Boolean.toString(true));
|
||||
properties.store(fileoutputstream, "Official Obsidian Ingots Configuration.");
|
||||
fileoutputstream.close();
|
||||
}
|
||||
|
||||
} catch (IOException ioexception)
|
||||
{
|
||||
System.err.println("[ObsidianIngots] An error occured while reading from configuration file.");
|
||||
ioexception.printStackTrace();
|
||||
}
|
||||
ObsidianIngots.configuration.load();
|
||||
ObsidianIngots.multiBlockID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("MultiBlock", 200).getInt();
|
||||
ObsidianIngots.obsidianTNTID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("ObsidianTNT", 201).getInt();
|
||||
ObsidianIngots.elementizerID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("TheoreticalElementizer", 202).getInt();
|
||||
ObsidianIngots.enrichmentChamberID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("EnrichmentChamber", 203).getInt();
|
||||
ObsidianIngots.platinumCompressorID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("PlatinumCompressor", 204).getInt();
|
||||
ObsidianIngots.combinerID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("Combiner", 205).getInt();
|
||||
ObsidianIngots.crusherID = ObsidianIngots.configuration.getOrCreateBlockIdProperty("Crusher", 206).getInt();
|
||||
ObsidianIngots.extrasEnabled = ObsidianIngots.configuration.getOrCreateBooleanProperty("ExtrasEnabled", Configuration.CATEGORY_GENERAL, true).getBoolean(true);
|
||||
ObsidianIngots.oreGenerationEnabled = ObsidianIngots.configuration.getOrCreateBooleanProperty("OreGenerationEnabled", Configuration.CATEGORY_GENERAL, true).getBoolean(true);
|
||||
ObsidianIngots.configuration.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and initiate utilities for the mod.
|
||||
* Load and initiate utilities for the mod's proxy.
|
||||
*/
|
||||
public void loadUtilities()
|
||||
{
|
||||
|
||||
}
|
||||
public void loadUtilities() {}
|
||||
|
||||
/**
|
||||
* Set up and load the client-only tick handler.
|
||||
*/
|
||||
public void loadTickHandler()
|
||||
{
|
||||
|
||||
}
|
||||
public void loadTickHandler() {}
|
||||
|
||||
/**
|
||||
* Get the actual interface for a GUI. Client-only.
|
||||
|
||||
@@ -26,7 +26,7 @@ public class EnrichmentChamberRecipes
|
||||
addSmelting(Block.obsidian.blockID, new ItemStack(ObsidianIngots.ObsidianDust, 1));
|
||||
addSmelting(Block.oreIron.blockID, new ItemStack(ObsidianIngots.IronDust, 1));
|
||||
addSmelting(Block.oreGold.blockID, new ItemStack(ObsidianIngots.GoldDust, 1));
|
||||
addSmelting(ObsidianIngots.platinumOreID, new ItemStack(ObsidianIngots.PlatinumDust, 1));
|
||||
addSmelting(new ItemStack(ObsidianIngots.MultiBlock, 1, 0).itemID, new ItemStack(ObsidianIngots.PlatinumDust, 1));
|
||||
addSmelting(Block.oreRedstone.blockID, new ItemStack(Item.redstone));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package net.uberkat.obsidian.common;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Item class for handling multiple IDs.
|
||||
* 0: Platinum Ore
|
||||
* 1: Platinum Block
|
||||
* 2: Redstone Block
|
||||
* 3: Refined Obsidian
|
||||
* 4: Coal Block
|
||||
* 5: Refined Glowstone
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ItemMulti extends ItemBlock
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
public ItemMulti(int id, Block block)
|
||||
{
|
||||
super(id);
|
||||
metaBlock = block;
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getBlockTextureFromSideAndMetadata(2, i);
|
||||
}
|
||||
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "PlatinumOre";
|
||||
break;
|
||||
case 1:
|
||||
name = "PlatinumBlock";
|
||||
break;
|
||||
case 2:
|
||||
name = "RedstoneBlock";
|
||||
break;
|
||||
case 3:
|
||||
name = "RefinedObsidian";
|
||||
break;
|
||||
case 4:
|
||||
name = "CoalBlock";
|
||||
break;
|
||||
case 5:
|
||||
name = "RefinedGlowstone";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
}
|
||||
return getItemName() + "." + name;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@ package net.uberkat.obsidian.common;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Hooks for Obsidian Ingots. Use to grab items or blocks out of different mods.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ObsidianHooks
|
||||
{
|
||||
private Class Ic2Items;
|
||||
@@ -22,6 +27,12 @@ public class ObsidianHooks
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an object out of the class Ic2Items.
|
||||
* @param name - name of the item
|
||||
* @param test - whether or not this is a test
|
||||
* @return the object
|
||||
*/
|
||||
public ItemStack getIC2Item(String name, boolean test)
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -31,11 +31,11 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
|
||||
/**
|
||||
* Obsidian Ingots mod -- adds in Tools, Armor, Weapons, Machines, and Magic. Universal files.
|
||||
* Obsidian Ingots mod -- adds in Tools, Armor, Weapons, Machines, and Magic. Universal source.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.0.5")
|
||||
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.0.6")
|
||||
@NetworkMod(channels = { "ObsidianIngots" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class ObsidianIngots
|
||||
{
|
||||
@@ -53,10 +53,11 @@ public class ObsidianIngots
|
||||
/** Obsidian Ingots hooks instance */
|
||||
public static ObsidianHooks hooks;
|
||||
|
||||
public static File configuration;
|
||||
/** Obsidian Ingots configuration instance */
|
||||
public static Configuration configuration;
|
||||
|
||||
//Initial Declarations
|
||||
public static Version versionNumber = new Version(4, 0, 5);
|
||||
public static Version versionNumber = new Version(4, 0, 6);
|
||||
public static String latestVersionNumber;
|
||||
public static String recentNews;
|
||||
public static String hostIP = "71.56.58.57";
|
||||
@@ -82,18 +83,13 @@ public class ObsidianIngots
|
||||
public static EnumArmorMaterial armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE", 18, new int[]{3, 7, 6, 3}, 50);
|
||||
|
||||
//Block IDs
|
||||
public static int platinumOreID = 200;
|
||||
public static int platinumBlockID = 201;
|
||||
public static int redstoneBlockID = 202;
|
||||
public static int obsidianTNTID = 203;
|
||||
public static int refinedObsidianID = 204;
|
||||
public static int elementizerID = 205;
|
||||
public static int enrichmentChamberID = 206;
|
||||
public static int platinumCompressorID = 207;
|
||||
public static int combinerID = 208;
|
||||
public static int crusherID = 209;
|
||||
public static int coalBlockID = 210;
|
||||
public static int refinedGlowstoneID = 211;
|
||||
public static int multiBlockID = 200;
|
||||
public static int obsidianTNTID = 201;
|
||||
public static int elementizerID = 202;
|
||||
public static int enrichmentChamberID = 203;
|
||||
public static int platinumCompressorID = 204;
|
||||
public static int combinerID = 205;
|
||||
public static int crusherID = 206;
|
||||
|
||||
//Base Items
|
||||
public static Item WoodPaxel;
|
||||
@@ -110,7 +106,6 @@ public class ObsidianIngots
|
||||
public static Item GoldDust;
|
||||
|
||||
//Glowstone Items
|
||||
public static Block RefinedGlowstone;
|
||||
public static Item GlowstoneIngot;
|
||||
public static Item GlowstonePaxel;
|
||||
public static Item GlowstonePickaxe;
|
||||
@@ -125,7 +120,6 @@ public class ObsidianIngots
|
||||
public static Item GlowstoneKnife;
|
||||
|
||||
//Redstone Items
|
||||
public static Block RedstoneBlock;
|
||||
public static Item RedstoneIngot;
|
||||
public static Item RedstonePaxel;
|
||||
public static Item RedstonePickaxe;
|
||||
@@ -140,8 +134,6 @@ public class ObsidianIngots
|
||||
public static Item RedstoneKnife;
|
||||
|
||||
//Platinum Items
|
||||
public static Block PlatinumOre;
|
||||
public static Block PlatinumBlock;
|
||||
public static Item PlatinumDust;
|
||||
public static Item PlatinumIngot;
|
||||
public static Item PlatinumPaxel;
|
||||
@@ -157,7 +149,6 @@ public class ObsidianIngots
|
||||
public static Item PlatinumKnife;
|
||||
|
||||
//Obsidian Items
|
||||
public static Block RefinedObsidian;
|
||||
public static Item ObsidianDust;
|
||||
public static Item ObsidianHelmet;
|
||||
public static Item ObsidianBody;
|
||||
@@ -194,13 +185,13 @@ public class ObsidianIngots
|
||||
public static Item EnrichedAlloy;
|
||||
|
||||
//Extra Blocks
|
||||
public static Block MultiBlock;
|
||||
public static Block ObsidianTNT;
|
||||
public static Block TheoreticalElementizer;
|
||||
public static Block EnrichmentChamber;
|
||||
public static Block PlatinumCompressor;
|
||||
public static Block Combiner;
|
||||
public static Block Crusher;
|
||||
public static Block CoalBlock;
|
||||
|
||||
//Boolean Values
|
||||
public static boolean extrasEnabled = true;
|
||||
@@ -210,9 +201,7 @@ public class ObsidianIngots
|
||||
public static float ObsidianTNTBlastRadius = 12.0F;
|
||||
public static int ObsidianTNTDelay = 100;
|
||||
|
||||
/**
|
||||
* Total ticks passed since thePlayer joined theWorld
|
||||
*/
|
||||
/** Total ticks passed since thePlayer joined theWorld */
|
||||
public static int ticksPassed = 0;
|
||||
|
||||
/**
|
||||
@@ -253,18 +242,18 @@ public class ObsidianIngots
|
||||
" ^", "I ", Character.valueOf('^'), Item.ingotGold, Character.valueOf('I'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Item.coal, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), CoalBlock
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 4)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(CoalBlock, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 4), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), Item.coal
|
||||
});
|
||||
|
||||
//Obsidian
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedObsidian, 0), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 3), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), ObsidianIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), new ItemStack(RefinedObsidian, 0)
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 3)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianHelmet, 1), new Object[] {
|
||||
"***", "* *", Character.valueOf('*'), ObsidianIngot
|
||||
@@ -278,22 +267,22 @@ public class ObsidianIngots
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianBoots, 1), new Object[] {
|
||||
"* *", "* *", Character.valueOf('*'), ObsidianIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianPaxel, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianPaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), ObsidianAxe, Character.valueOf('Y'), ObsidianPickaxe, Character.valueOf('Z'), ObsidianSpade, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianPickaxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianPickaxe, 1), new Object[] {
|
||||
"XXX", " T ", " T ", Character.valueOf('X'), ObsidianIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianAxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianAxe, 1), new Object[] {
|
||||
"XX", "XT", " T", Character.valueOf('X'), ObsidianIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianSpade, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianSpade, 1), new Object[] {
|
||||
"X", "T", "T", Character.valueOf('X'), ObsidianIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianHoe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianHoe, 1), new Object[] {
|
||||
"XX", " T", " T", Character.valueOf('X'), ObsidianIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianSword, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianSword, 1), new Object[] {
|
||||
"X", "X", "T", Character.valueOf('X'), ObsidianIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(ObsidianKnife, 1), new Object[] {
|
||||
@@ -301,28 +290,28 @@ public class ObsidianIngots
|
||||
});
|
||||
|
||||
//Glowstone
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedGlowstone, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 5), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), GlowstoneIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), RefinedGlowstone
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 5)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstonePaxel, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstonePaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), GlowstoneAxe, Character.valueOf('Y'), GlowstonePickaxe, Character.valueOf('Z'), GlowstoneSpade, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstonePickaxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstonePickaxe, 1), new Object[] {
|
||||
"XXX", " T ", " T ", Character.valueOf('X'), GlowstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneAxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneAxe, 1), new Object[] {
|
||||
"XX", "XT", " T", Character.valueOf('X'), GlowstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneSpade, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneSpade, 1), new Object[] {
|
||||
"X", "T", "T", Character.valueOf('X'), GlowstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneHoe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneHoe, 1), new Object[] {
|
||||
"XX", " T", " T", Character.valueOf('X'), GlowstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneSword, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneSword, 1), new Object[] {
|
||||
"X", "X", "T", Character.valueOf('X'), GlowstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(GlowstoneHelmet, 1), new Object[] {
|
||||
@@ -354,22 +343,22 @@ public class ObsidianIngots
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliBoots, 1), new Object[] {
|
||||
"* *", "* *", Character.valueOf('*'), new ItemStack(Item.dyePowder, 1, 4)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliPaxel, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliPaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), LazuliAxe, Character.valueOf('Y'), LazuliPickaxe, Character.valueOf('Z'), LazuliSpade, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliPickaxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliPickaxe, 1), new Object[] {
|
||||
"XXX", " T ", " T ", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliAxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliAxe, 1), new Object[] {
|
||||
"XX", "XT", " T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliSpade, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliSpade, 1), new Object[] {
|
||||
"X", "T", "T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliHoe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliHoe, 1), new Object[] {
|
||||
"XX", " T", " T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliSword, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliSword, 1), new Object[] {
|
||||
"X", "X", "T", Character.valueOf('X'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(LazuliKnife, 1), new Object[] {
|
||||
@@ -377,25 +366,25 @@ public class ObsidianIngots
|
||||
});
|
||||
|
||||
//Platinum
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumBlock, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 1), new Object[] {
|
||||
"XXX", "XXX", "XXX", Character.valueOf('X'), PlatinumIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumPaxel, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumPaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), PlatinumAxe, Character.valueOf('Y'), PlatinumPickaxe, Character.valueOf('Z'), PlatinumSpade, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumPickaxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumPickaxe, 1), new Object[] {
|
||||
"XXX", " T ", " T ", Character.valueOf('X'), PlatinumIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumAxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumAxe, 1), new Object[] {
|
||||
"XX", "XT", " T", Character.valueOf('X'), PlatinumIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumSpade, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumSpade, 1), new Object[] {
|
||||
"X", "T", "T", Character.valueOf('X'), PlatinumIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumHoe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumHoe, 1), new Object[] {
|
||||
"XX", " T", " T", Character.valueOf('X'), PlatinumIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumSword, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumSword, 1), new Object[] {
|
||||
"X", "X", "T", Character.valueOf('X'), PlatinumIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumHelmet, 1), new Object[] {
|
||||
@@ -411,35 +400,35 @@ public class ObsidianIngots
|
||||
"* *", "* *", Character.valueOf('*'), PlatinumIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), PlatinumBlock
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumKnife, 1), new Object[] {
|
||||
" ^", "I ", Character.valueOf('^'), PlatinumIngot, Character.valueOf('I'), Item.stick
|
||||
});
|
||||
|
||||
//Redstone
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneBlock, 1), new Object[] {
|
||||
GameRegistry.addRecipe(new ItemStack(MultiBlock, 1, 2), new Object[] {
|
||||
"***", "***", "***", Character.valueOf('*'), RedstoneIngot
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneIngot, 9), new Object[] {
|
||||
"*", Character.valueOf('*'), RedstoneBlock
|
||||
"*", Character.valueOf('*'), new ItemStack(MultiBlock, 1, 2)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstonePaxel, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(RedstonePaxel, 1), new Object[] {
|
||||
"XYZ", " T ", " T ", Character.valueOf('X'), RedstoneAxe, Character.valueOf('Y'), RedstonePickaxe, Character.valueOf('Z'), RedstoneSpade, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstonePickaxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(RedstonePickaxe, 1), new Object[] {
|
||||
"XXX", " T ", " T ", Character.valueOf('X'), RedstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneAxe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneAxe, 1), new Object[] {
|
||||
"XX", "XT", " T", Character.valueOf('X'), RedstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneSpade, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneSpade, 1), new Object[] {
|
||||
"X", "T", "T", Character.valueOf('X'), RedstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneHoe, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneHoe, 1), new Object[] {
|
||||
"XX", " T", " T", Character.valueOf('X'), RedstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneSword, 1), new Object[]{
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneSword, 1), new Object[] {
|
||||
"X", "X", "T", Character.valueOf('X'), RedstoneIngot, Character.valueOf('T'), Item.stick
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(RedstoneHelmet, 1), new Object[] {
|
||||
@@ -475,20 +464,20 @@ public class ObsidianIngots
|
||||
});
|
||||
}
|
||||
GameRegistry.addRecipe(new ItemStack(PlatinumCompressor, 1), new Object[] {
|
||||
"***", "*P*", "***", Character.valueOf('*'), Item.redstone, Character.valueOf('P'), PlatinumBlock
|
||||
"***", "*P*", "***", Character.valueOf('*'), Item.redstone, Character.valueOf('P'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(EnrichmentChamber, 1), new Object[] {
|
||||
"***", "*R*", "***", Character.valueOf('*'), PlatinumIngot, Character.valueOf('R'), Item.redstone
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Combiner, 1), new Object[] {
|
||||
"***", "*P*", "***", Character.valueOf('*'), Block.cobblestone, Character.valueOf('P'), PlatinumBlock
|
||||
"***", "*P*", "***", Character.valueOf('*'), Block.cobblestone, Character.valueOf('P'), new ItemStack(MultiBlock, 1, 1)
|
||||
});
|
||||
GameRegistry.addRecipe(new ItemStack(Crusher, 1), new Object[] {
|
||||
"***", "*L*", "***", Character.valueOf('*'), PlatinumIngot, Character.valueOf('L'), Item.bucketLava
|
||||
});
|
||||
|
||||
//Smelting
|
||||
GameRegistry.addSmelting(platinumOreID, new ItemStack(PlatinumIngot), 1.0F);
|
||||
GameRegistry.addSmelting(new ItemStack(MultiBlock, 1, 0).itemID, new ItemStack(PlatinumIngot), 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -509,7 +498,6 @@ public class ObsidianIngots
|
||||
LanguageRegistry.addName(GoldKnife, "Gold Knife");
|
||||
|
||||
//Obsidian
|
||||
LanguageRegistry.addName(RefinedObsidian, "Refined Obsidian");
|
||||
LanguageRegistry.addName(ObsidianDust, "Obsidian Dust");
|
||||
LanguageRegistry.addName(ObsidianHelmet, "Obsidian Helmet");
|
||||
LanguageRegistry.addName(ObsidianBody, "Obsidian Chestplate");
|
||||
@@ -538,8 +526,6 @@ public class ObsidianIngots
|
||||
LanguageRegistry.addName(LazuliKnife, "Lazuli Knife");
|
||||
|
||||
//Platinum
|
||||
LanguageRegistry.addName(PlatinumOre, "Platinum Ore");
|
||||
LanguageRegistry.addName(PlatinumBlock, "Platinum Block");
|
||||
LanguageRegistry.addName(PlatinumDust, "Platinum Dust");
|
||||
LanguageRegistry.addName(PlatinumHelmet, "Platinum Helmet");
|
||||
LanguageRegistry.addName(PlatinumBody, "Platinum Chestplate");
|
||||
@@ -555,8 +541,6 @@ public class ObsidianIngots
|
||||
LanguageRegistry.addName(PlatinumKnife, "Platinum Knife");
|
||||
|
||||
//Redstone
|
||||
LanguageRegistry.addName(RedstoneBlock, "Redstone Block");
|
||||
LanguageRegistry.addName(RedstoneBlock, "Redstone Block");
|
||||
LanguageRegistry.addName(RedstoneHelmet, "Redstone Helmet");
|
||||
LanguageRegistry.addName(RedstoneBody, "Redstone Chestplate");
|
||||
LanguageRegistry.addName(RedstoneLegs, "Redstone Leggings");
|
||||
@@ -568,11 +552,9 @@ public class ObsidianIngots
|
||||
LanguageRegistry.addName(RedstoneSpade, "Redstone Shovel");
|
||||
LanguageRegistry.addName(RedstoneHoe, "Redstone Hoe");
|
||||
LanguageRegistry.addName(RedstoneSword, "Redstone Sword");
|
||||
LanguageRegistry.addName(RedstoneBlock, "Redstone Block");
|
||||
LanguageRegistry.addName(RedstoneKnife, "Redstone Knife");
|
||||
|
||||
//Glowstone
|
||||
LanguageRegistry.addName(RefinedGlowstone, "Refined Glowstone Block");
|
||||
LanguageRegistry.addName(GlowstoneIngot, "Glowstone Ingot");
|
||||
LanguageRegistry.addName(GlowstonePaxel, "Glowstone Paxel");
|
||||
LanguageRegistry.addName(GlowstonePickaxe, "Glowstone Pickaxe");
|
||||
@@ -602,7 +584,14 @@ public class ObsidianIngots
|
||||
LanguageRegistry.addName(PlatinumCompressor, "Platinum Compressor");
|
||||
LanguageRegistry.addName(Combiner, "Combiner");
|
||||
LanguageRegistry.addName(Crusher, "Crusher");
|
||||
LanguageRegistry.addName(CoalBlock, "Coal Block");
|
||||
|
||||
//Localization for MultiBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.PlatinumOre.name", "Platinum Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.PlatinumBlock.name", "Platinum Block");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.RedstoneBlock.name", "Redstone Block");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.RefinedObsidian.name", "Refined Obsidian");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.CoalBlock.name", "Coal Block");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.RefinedGlowstone.name", "Refined Glowstone Block");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -799,10 +788,7 @@ public class ObsidianIngots
|
||||
public void addBlocks()
|
||||
{
|
||||
//Declarations
|
||||
RedstoneBlock = new BlockBase(redstoneBlockID, 1).setBlockName("RedstoneBlock").setCreativeTab(CreativeTabs.tabBlock);
|
||||
PlatinumOre = new BlockBase(platinumOreID, 3).setBlockName("PlatinumOre").setCreativeTab(CreativeTabs.tabBlock);
|
||||
PlatinumBlock = new BlockBase(platinumBlockID, 2).setBlockName("PlatinumBlock").setCreativeTab(CreativeTabs.tabBlock);
|
||||
RefinedObsidian = new BlockBase(refinedObsidianID, 0).setBlockName("RefinedObsidian").setCreativeTab(CreativeTabs.tabBlock);
|
||||
MultiBlock = new BlockMulti(multiBlockID).setBlockName("MultiBlock");
|
||||
ObsidianTNT = new BlockObsidianTNT(obsidianTNTID).setBlockName("ObsidianTNT").setCreativeTab(CreativeTabs.tabBlock);
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
@@ -812,14 +798,8 @@ public class ObsidianIngots
|
||||
PlatinumCompressor = new BlockPlatinumCompressor(platinumCompressorID).setBlockName("PlatinumCompressorIdle").setCreativeTab(CreativeTabs.tabBlock);
|
||||
Combiner = new BlockCombiner(combinerID).setBlockName("CombinerIdle").setCreativeTab(CreativeTabs.tabBlock);
|
||||
Crusher = new BlockCrusher(crusherID).setBlockName("CrusherIdle").setCreativeTab(CreativeTabs.tabBlock);
|
||||
CoalBlock = new BlockBase(coalBlockID, 10).setBlockName("CoalBlock").setCreativeTab(CreativeTabs.tabBlock);
|
||||
RefinedGlowstone = new BlockBase(refinedGlowstoneID, 11).setBlockName("RefinedGlowstone").setCreativeTab(CreativeTabs.tabBlock);
|
||||
|
||||
//Registrations
|
||||
GameRegistry.registerBlock(RedstoneBlock);
|
||||
GameRegistry.registerBlock(PlatinumOre);
|
||||
GameRegistry.registerBlock(PlatinumBlock);
|
||||
GameRegistry.registerBlock(RefinedObsidian);
|
||||
GameRegistry.registerBlock(ObsidianTNT);
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
@@ -829,8 +809,9 @@ public class ObsidianIngots
|
||||
GameRegistry.registerBlock(PlatinumCompressor);
|
||||
GameRegistry.registerBlock(Combiner);
|
||||
GameRegistry.registerBlock(Crusher);
|
||||
GameRegistry.registerBlock(CoalBlock);
|
||||
GameRegistry.registerBlock(RefinedGlowstone);
|
||||
|
||||
//Add ItemMulti into the itemsList array for BlockMulti
|
||||
Item.itemsList[multiBlockID] = new ItemMulti(multiBlockID - 256, MultiBlock).setItemName("MultiBlock");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -889,7 +870,7 @@ public class ObsidianIngots
|
||||
@PreInit
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
configuration = event.getSuggestedConfigurationFile();
|
||||
configuration = new Configuration(event.getSuggestedConfigurationFile());
|
||||
//Register the mod's ore handler
|
||||
GameRegistry.registerWorldGenerator(new OreHandler());
|
||||
//Register the mod's GUI handler
|
||||
@@ -897,8 +878,9 @@ public class ObsidianIngots
|
||||
//Set the mod's instance
|
||||
instance = this;
|
||||
System.out.println("[ObsidianIngots] Version " + versionNumber + " initializing...");
|
||||
new ThreadGetData();
|
||||
proxy.registerRenderInformation();
|
||||
proxy.setProperties();
|
||||
proxy.loadConfiguration();
|
||||
proxy.loadUtilities();
|
||||
proxy.loadTickHandler();
|
||||
|
||||
@@ -906,7 +888,7 @@ public class ObsidianIngots
|
||||
hooks = new ObsidianHooks();
|
||||
hooks.hook();
|
||||
System.out.println("[ObsidianIngots] Hooking complete.");
|
||||
|
||||
|
||||
//Add all items
|
||||
addItems();
|
||||
System.out.println("[ObsidianIngots] Items loaded.");
|
||||
|
||||
@@ -17,7 +17,7 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.server.FMLServerHandler;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.client.ThreadServerData;
|
||||
import net.uberkat.obsidian.client.ThreadSendData;
|
||||
|
||||
/**
|
||||
* Official Obsidian Ingots utilities. All miscellaneous methods are located here.
|
||||
@@ -48,7 +48,8 @@ public class ObsidianUtils
|
||||
public static String getLatestVersion()
|
||||
{
|
||||
String[] text = getHTML("http://dl.dropbox.com/u/90411166/Mod%20Versions/ObsidianIngots.txt").split(":");
|
||||
return text[0];
|
||||
if(!text[0].contains("UTF-8") && !text[0].contains("HTML")) return text[0];
|
||||
return "Error retrieving data.";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +59,7 @@ public class ObsidianUtils
|
||||
public static String getRecentNews()
|
||||
{
|
||||
String[] text = getHTML("http://dl.dropbox.com/u/90411166/Mod%20Versions/ObsidianIngots.txt").split(":");
|
||||
if(text.length > 1) return text[1];
|
||||
if(text.length > 1 && !text[1].contains("UTF-8") && !text[1].contains("HTML")) return text[1];
|
||||
return "There is no news to show.";
|
||||
}
|
||||
|
||||
@@ -159,22 +160,4 @@ public class ObsidianUtils
|
||||
world.spawnParticle("hugeexplosion", entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D);
|
||||
world.playSoundAtEntity(entityplayer, "random.explode", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a machine is in it's active state.
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return if machine is active
|
||||
*/
|
||||
public static boolean isActive(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
TileEntityMachine tileEntity = (TileEntityMachine)world.getBlockTileEntity(x, y, z);
|
||||
if(tileEntity != null)
|
||||
{
|
||||
return tileEntity.isActive;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package net.uberkat.obsidian.common;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.src.IChunkProvider;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.WorldGenMinable;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
@@ -34,7 +35,7 @@ public class OreHandler implements IWorldGenerator
|
||||
int randPosX = chunkX + random.nextInt(16);
|
||||
int randPosY = random.nextInt(60);
|
||||
int randPosZ = chunkZ + random.nextInt(16);
|
||||
(new WorldGenMinable(ObsidianIngots.PlatinumOre.blockID, 16)).generate(world, random, randPosX, randPosY, randPosZ);
|
||||
(new WorldGenMinable(new ItemStack(ObsidianIngots.MultiBlock, 1, 0).itemID, 16)).generate(world, random, randPosX, randPosY, randPosZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class PacketHandler implements IPacketHandler
|
||||
output.writeInt(sender.xCoord);
|
||||
output.writeInt(sender.yCoord);
|
||||
output.writeInt(sender.zCoord);
|
||||
output.writeInt(sender.facing);
|
||||
output.writeByte(sender.isActive ? 1 : 0);
|
||||
output.writeInt(sender.machineBurnTime);
|
||||
output.writeInt(sender.machineCookTime);
|
||||
|
||||
@@ -2,6 +2,11 @@ package net.uberkat.obsidian.common;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
/**
|
||||
* Simple physics handler that allows weapons, specifically knives, to knock back entities on contact.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class PhysicsHelper
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.uberkat.obsidian.common;
|
||||
|
||||
public class Sound
|
||||
{
|
||||
public String name;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public Sound(String s, int i, int j, int k)
|
||||
{
|
||||
name = s;
|
||||
x = i;
|
||||
y = j;
|
||||
z = k;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.uberkat.obsidian.common;
|
||||
|
||||
public class ThreadGetData extends Thread
|
||||
{
|
||||
public ThreadGetData()
|
||||
{
|
||||
setDaemon(true);
|
||||
start();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
ObsidianIngots.latestVersionNumber = ObsidianUtils.getLatestVersion();
|
||||
ObsidianIngots.recentNews = ObsidianUtils.getRecentNews();
|
||||
System.out.println("[ObsidianIngots] Successfully retrieved data from server.");
|
||||
try {
|
||||
finalize();
|
||||
} catch(Throwable t) {
|
||||
System.out.println("[ObsidianIngots] Unable to finalize server data.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,49 +126,6 @@ public class TileEntityCombiner extends TileEntityMachine
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
|
||||
machineCookTime = par1NBTTagCompound.getShort("CookTime");
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("BurnTime", (short)machineBurnTime);
|
||||
par1NBTTagCompound.setShort("CookTime", (short)machineCookTime);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
{
|
||||
|
||||
@@ -124,53 +124,10 @@ public class TileEntityCrusher extends TileEntityMachine
|
||||
int var1 = par1ItemStack.getItem().shiftedIndex;
|
||||
if (var1 == Item.redstone.shiftedIndex) return 600;
|
||||
if (var1 == ObsidianIngots.RedstoneIngot.shiftedIndex)
|
||||
if (par1ItemStack.getItem() instanceof ItemBlock && var1 == ObsidianIngots.RedstoneBlock.blockID) return 5400;
|
||||
if (var1 == new ItemStack(ObsidianIngots.MultiBlock, 1, 2).itemID) return 5400;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
|
||||
machineCookTime = par1NBTTagCompound.getShort("CookTime");
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("BurnTime", (short)machineBurnTime);
|
||||
par1NBTTagCompound.setShort("CookTime", (short)machineCookTime);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
{
|
||||
|
||||
@@ -128,49 +128,6 @@ public class TileEntityEnrichmentChamber extends TileEntityMachine
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
|
||||
machineCookTime = par1NBTTagCompound.getShort("CookTime");
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("BurnTime", (short)machineBurnTime);
|
||||
par1NBTTagCompound.setShort("CookTime", (short)machineCookTime);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
{
|
||||
|
||||
@@ -3,11 +3,15 @@ package net.uberkat.obsidian.common;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import cpw.mods.fml.server.FMLServerHandler;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.uberkat.obsidian.client.AudioManager;
|
||||
import net.uberkat.obsidian.client.AudioSource;
|
||||
|
||||
public class TileEntityMachine extends TileEntity implements IInventory, ISidedInventory, INetworkedMachine
|
||||
{
|
||||
@@ -35,8 +39,17 @@ public class TileEntityMachine extends TileEntity implements IInventory, ISidedI
|
||||
/** The machine's previous active state */
|
||||
public boolean prevActive;
|
||||
|
||||
/** The direction this machine is facing */
|
||||
public int facing;
|
||||
|
||||
/** How many ticks have passed since the last texture tick. */
|
||||
public int textureTick = 0;
|
||||
|
||||
/** The amount of update ticks have passed since the game started */
|
||||
public byte updateTicks = 0;
|
||||
|
||||
/** An integer that constantly cycles from 0 to 15. Used for animated textures. */
|
||||
public int textureIndex = 0;
|
||||
|
||||
/**
|
||||
* Instance of TileEntityMachine. Extend this for a head start on machine making.
|
||||
@@ -75,7 +88,16 @@ public class TileEntityMachine extends TileEntity implements IInventory, ISidedI
|
||||
public void updateEntity()
|
||||
{
|
||||
onUpdate();
|
||||
updateTextureTick();
|
||||
if(FMLCommonHandler.instance().getSidedDelegate().getSide().isClient())
|
||||
{
|
||||
updateTextureTick();
|
||||
}
|
||||
updateTick();
|
||||
|
||||
if(machineCookTime == 0 || machineCookTime == maxBurnTime && currentItemBurnTime != 0)
|
||||
{
|
||||
currentItemBurnTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,21 +106,27 @@ public class TileEntityMachine extends TileEntity implements IInventory, ISidedI
|
||||
public void onUpdate() {}
|
||||
|
||||
/**
|
||||
* Texture update call for machines. Use this to switch to a different texture. Called every 3 ticks.
|
||||
* Synchronizes the client with the server on startup by sending two packets.
|
||||
* Not exactly sure why it needs 5 packets, but it wouldn't work with only 4!
|
||||
*/
|
||||
public void updateTexture()
|
||||
public void updateTick()
|
||||
{
|
||||
BlockMachine.updateTexture(worldObj, xCoord, yCoord, zCoord);
|
||||
if(updateTicks < 5)
|
||||
{
|
||||
PacketHandler.sendMachinePacket(this);
|
||||
updateTicks++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant check to see when to run updateTexture(). Called every tick, but functions every 3.
|
||||
* Check to see when to run updateTexture(). Called every tick, but functions every 3.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateTextureTick()
|
||||
{
|
||||
if(textureTick % 3 == 0)
|
||||
if(textureTick % 5 == 0)
|
||||
{
|
||||
updateTexture();
|
||||
updateTexture(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
textureTick++;
|
||||
}
|
||||
@@ -207,6 +235,71 @@ public class TileEntityMachine extends TileEntity implements IInventory, ISidedI
|
||||
|
||||
prevActive = active;
|
||||
}
|
||||
|
||||
public void setFacing(int direction)
|
||||
{
|
||||
facing = direction;
|
||||
|
||||
PacketHandler.sendMachinePacket(this);
|
||||
}
|
||||
|
||||
public void updateTexture(World world, int x, int y, int z)
|
||||
{
|
||||
if(textureIndex < 15) textureIndex++;
|
||||
if(textureIndex == 15) textureIndex = 0;
|
||||
|
||||
world.markBlockAsNeedsUpdate(x, y, z);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
machineBurnTime = par1NBTTagCompound.getInteger("machineBurnTime");
|
||||
machineCookTime = par1NBTTagCompound.getInteger("machineCookTime");
|
||||
currentItemBurnTime = par1NBTTagCompound.getInteger("currentItemBurnTime");
|
||||
isActive = par1NBTTagCompound.getBoolean("isActive");
|
||||
facing = par1NBTTagCompound.getInteger("facing");
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setInteger("machineBurnTime", machineBurnTime);
|
||||
par1NBTTagCompound.setInteger("machineCookTime", machineCookTime);
|
||||
par1NBTTagCompound.setInteger("currentItemBurnTime", currentItemBurnTime);
|
||||
par1NBTTagCompound.setBoolean("isActive", isActive);
|
||||
par1NBTTagCompound.setInteger("facing", facing);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public void getBurnTime() {}
|
||||
|
||||
public void openChest() {}
|
||||
|
||||
@@ -215,10 +308,12 @@ public class TileEntityMachine extends TileEntity implements IInventory, ISidedI
|
||||
public void handlePacketData(NetworkManager network, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
try {
|
||||
facing = dataStream.readInt();
|
||||
isActive = dataStream.readByte() != 0;
|
||||
machineBurnTime = dataStream.readInt();
|
||||
machineCookTime = dataStream.readInt();
|
||||
currentItemBurnTime = dataStream.readInt();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[ObsidianIngots] Error while handling tile entity packet.");
|
||||
|
||||
@@ -127,52 +127,14 @@ public class TileEntityPlatinumCompressor extends TileEntityMachine
|
||||
{
|
||||
int var1 = par1ItemStack.getItem().shiftedIndex;
|
||||
if (var1 == ObsidianIngots.PlatinumIngot.shiftedIndex) return 200;
|
||||
if (par1ItemStack.getItem() instanceof ItemBlock && var1 == ObsidianIngots.PlatinumBlock.blockID) return 1800;
|
||||
if (var1 == new ItemStack(ObsidianIngots.MultiBlock, 1, 1).itemID) return 1800;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
public void getBurnTime()
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
|
||||
machineCookTime = par1NBTTagCompound.getShort("CookTime");
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("BurnTime", (short)machineBurnTime);
|
||||
par1NBTTagCompound.setShort("CookTime", (short)machineCookTime);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
|
||||
@@ -129,49 +129,6 @@ public class TileEntityTheoreticalElementizer extends TileEntityMachine
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
|
||||
machineItemStacks = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
|
||||
{
|
||||
NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
|
||||
byte var5 = var4.getByte("Slot");
|
||||
|
||||
if (var5 >= 0 && var5 < machineItemStacks.length)
|
||||
{
|
||||
machineItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
|
||||
}
|
||||
}
|
||||
|
||||
machineBurnTime = par1NBTTagCompound.getShort("BurnTime");
|
||||
machineCookTime = par1NBTTagCompound.getShort("CookTime");
|
||||
currentItemBurnTime = getItemBurnTime(machineItemStacks[1]);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("BurnTime", (short)machineBurnTime);
|
||||
par1NBTTagCompound.setShort("CookTime", (short)machineCookTime);
|
||||
NBTTagList var2 = new NBTTagList();
|
||||
|
||||
for (int var3 = 0; var3 < machineItemStacks.length; ++var3)
|
||||
{
|
||||
if (machineItemStacks[var3] != null)
|
||||
{
|
||||
NBTTagCompound var4 = new NBTTagCompound();
|
||||
var4.setByte("Slot", (byte)var3);
|
||||
machineItemStacks[var3].writeToNBT(var4);
|
||||
var2.appendTag(var4);
|
||||
}
|
||||
}
|
||||
|
||||
par1NBTTagCompound.setTag("Items", var2);
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
{
|
||||
return getItemBurnTime(par0ItemStack) > 0;
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package net.uberkat.obsidian.client;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
|
||||
import net.minecraft.src.SoundManager;
|
||||
import net.uberkat.obsidian.common.Sound;
|
||||
|
||||
import paulscode.sound.SoundSystem;
|
||||
|
||||
public class AudioManager
|
||||
{
|
||||
public static SoundSystem system;
|
||||
public static float defaultVolume = 1.2F;
|
||||
public static float fadingDistance = 16F;
|
||||
public static float masterVolume = 0.5F;
|
||||
public static int nextId = 0;
|
||||
|
||||
public static void getSoundSystem()
|
||||
{
|
||||
Field afield[] = (SoundManager.class).getDeclaredFields();
|
||||
int i = afield.length;
|
||||
int j = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (j >= i)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Field field = afield[j];
|
||||
|
||||
if (field.getType() == (paulscode.sound.SoundSystem.class))
|
||||
{
|
||||
field.setAccessible(true);
|
||||
|
||||
try
|
||||
{
|
||||
Object obj = field.get(null);
|
||||
|
||||
if (obj instanceof SoundSystem)
|
||||
{
|
||||
system = (SoundSystem)obj;
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
system = null;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
public static AudioSource getSource(Sound sound)
|
||||
{
|
||||
if (system == null)
|
||||
{
|
||||
getSoundSystem();
|
||||
}
|
||||
|
||||
if (system == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String id = getSourceName(nextId);
|
||||
nextId++;
|
||||
AudioSource audiosource = new AudioSource(system, sound, id);
|
||||
|
||||
return audiosource;
|
||||
}
|
||||
|
||||
private static String getSourceName(int i)
|
||||
{
|
||||
return (new StringBuilder()).append("asm_snd").append(i).toString();
|
||||
}
|
||||
|
||||
public static void playSoundOnce(Sound sound)
|
||||
{
|
||||
URL url = (SoundHandler.class).getClassLoader().getResource((new StringBuilder()).append("sounds/").append(sound.name).toString());
|
||||
|
||||
if (system == null)
|
||||
{
|
||||
getSoundSystem();
|
||||
}
|
||||
|
||||
if (system == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String audio = system.quickPlay(false, url, sound.name, false, sound.x, sound.y, sound.z, 2, fadingDistance * Math.max(defaultVolume, 1.0F));
|
||||
system.setVolume(audio, masterVolume * defaultVolume);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package net.uberkat.obsidian.client;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
|
||||
import paulscode.sound.SoundSystem;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.common.Sound;
|
||||
|
||||
public class AudioSource
|
||||
{
|
||||
public boolean isPlaying;
|
||||
public int xPos;
|
||||
public int yPos;
|
||||
public int zPos;
|
||||
public int soundTicks;
|
||||
public SoundSystem system;
|
||||
public String sourceName;
|
||||
public boolean valid;
|
||||
|
||||
public AudioSource(SoundSystem sys, Sound sound, String id)
|
||||
{
|
||||
valid = false;
|
||||
sourceName = sound.name;
|
||||
system = sys;
|
||||
xPos = sound.x;
|
||||
yPos = sound.y;
|
||||
zPos = sound.z;
|
||||
isPlaying = false;
|
||||
URL url = (AudioSource.class).getClassLoader().getResource((new StringBuilder()).append("sounds/").append(sound.name).toString());
|
||||
if(url != null)
|
||||
{
|
||||
sys.newSource(false, sound.name, url, id, false, sound.x, sound.y, sound.z, 0, AudioManager.fadingDistance * Math.max(AudioManager.defaultVolume, 1.0F));
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void activate()
|
||||
{
|
||||
if(valid)
|
||||
{
|
||||
system.activate(sourceName);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove()
|
||||
{
|
||||
if(valid)
|
||||
{
|
||||
stopSound();
|
||||
system.removeSource(sourceName);
|
||||
sourceName = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void playSound()
|
||||
{
|
||||
if(!isPlaying)
|
||||
{
|
||||
system.play(sourceName);
|
||||
isPlaying = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseSound()
|
||||
{
|
||||
if(isPlaying)
|
||||
{
|
||||
system.pause(sourceName);
|
||||
isPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopSound()
|
||||
{
|
||||
if(isPlaying)
|
||||
{
|
||||
system.stop(sourceName);
|
||||
isPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void flushSound()
|
||||
{
|
||||
if(isPlaying)
|
||||
{
|
||||
system.flush(sourceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,9 +72,7 @@ public class ClientProxy extends CommonProxy
|
||||
public void loadUtilities()
|
||||
{
|
||||
System.out.println("[ObsidianIngots] Beginning utility initiative...");
|
||||
ObsidianIngots.latestVersionNumber = ObsidianUtils.getLatestVersion();
|
||||
ObsidianIngots.recentNews = ObsidianUtils.getRecentNews();
|
||||
new ThreadServerData();
|
||||
new ThreadSendData();
|
||||
System.out.println("[ObsidianIngots] Utility initiative complete.");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ import net.uberkat.obsidian.common.ObsidianUtils;
|
||||
import cpw.mods.fml.common.ITickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
/**
|
||||
* Client-side tick handler for Obsidian Ingots. Used mainly for the update check upon startup.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ClientTickHandler implements ITickHandler
|
||||
{
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package net.uberkat.obsidian.client;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
|
||||
public class SoundHandler
|
||||
{
|
||||
public static final SoundHandler instance = new SoundHandler();
|
||||
|
||||
public final URL[] sounds = { getURL("chamber.ogg"), getURL("combiner.ogg"), getURL("compressor.ogg"), getURL("crusher.ogg"), getURL("elementizer.ogg") };
|
||||
|
||||
@ForgeSubscribe
|
||||
public void loadSoundEvents(SoundLoadEvent event)
|
||||
{
|
||||
for(int i = 0; i < sounds.length; i++)
|
||||
{
|
||||
URL url = getClass().getResource("/obsidian/" + sounds[i]);
|
||||
event.manager.soundPoolSounds.addSound("obsidian/" + sounds[i], url);
|
||||
|
||||
if(url != null)
|
||||
continue;
|
||||
System.err.println("[ObsidianIngots] Error loading sound file '" + sounds[i] + ".'");
|
||||
}
|
||||
}
|
||||
|
||||
public URL getURL(String url)
|
||||
{
|
||||
return getClass().getResource("/obsidian/" + url);
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,12 @@ import net.minecraft.src.ModLoader;
|
||||
import net.uberkat.obsidian.common.ObsidianIngots;
|
||||
import net.uberkat.obsidian.common.ObsidianUtils;
|
||||
|
||||
public class ThreadServerData extends Thread
|
||||
/**
|
||||
* Sends information about this mod to the Obsidian Ingots server.
|
||||
*/
|
||||
public class ThreadSendData extends Thread
|
||||
{
|
||||
/**
|
||||
* Sends information about this mod to the Obsidian Ingots server.
|
||||
*/
|
||||
public ThreadServerData()
|
||||
public ThreadSendData()
|
||||
{
|
||||
setDaemon(true);
|
||||
start();
|
||||
@@ -66,10 +66,14 @@ public class ThreadUpdate extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares to update to the latest version of Obsidian Ingots by deleting the files "ObsidianIngots.cfg" and "ObsidianIngots.jar."
|
||||
*/
|
||||
public void prepareForDownload()
|
||||
{
|
||||
File download = new File(new StringBuilder().append(ModLoader.getMinecraftInstance().getMinecraftDir()).append("/mods/ObsidianIngots.jar").toString());
|
||||
File config = new File(new StringBuilder().append(ModLoader.getMinecraftInstance().getMinecraftDir()).append("/config/mod_ObsidianIngots.txt").toString());
|
||||
File config = new File(new StringBuilder().append(ModLoader.getMinecraftInstance().getMinecraftDir()).append("/config/ObsidianIngots.cfg").toString());
|
||||
|
||||
if(download.exists())
|
||||
{
|
||||
download.delete();
|
||||
|
||||