v5 Beta #2
*Removed all hawk-related stuff. *Updated textures. *Added animation when using lightning rod. *Merged all ingots into a single ID. *Merged all dusts into a single ID. *Updated MachineryManager to function correctly. *Various bugfixes.
This commit is contained in:
parent
8b2a156f79
commit
711e6279a2
30 changed files with 89 additions and 1664 deletions
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 17 KiB |
|
@ -1,105 +0,0 @@
|
|||
|
||||
package hawk.api;
|
||||
|
||||
/**
|
||||
*
|
||||
* Used in order to store Endium Teleporter coordinates.
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public class EndiumTeleporterCoords
|
||||
{
|
||||
private int xCoord;
|
||||
private int yCoord;
|
||||
private int zCoord;
|
||||
private int dimensionID;
|
||||
private int symbolA;
|
||||
private int symbolB;
|
||||
private int symbolC;
|
||||
|
||||
public EndiumTeleporterCoords(int x, int y, int z, int dimension, int symbol1, int symbol2, int symbol3)
|
||||
{
|
||||
if (symbol1 != 0 && symbol2 != 0 && symbol3 != 0)
|
||||
{
|
||||
this.xCoord = x;
|
||||
this.yCoord = y;
|
||||
this.zCoord = z;
|
||||
this.dimensionID = dimension;
|
||||
this.symbolA = symbol1;
|
||||
this.symbolB = symbol2;
|
||||
this.symbolC = symbol3;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("Hawk's Machinery: Symbol cannot be 0!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isEqual(int symbol1, int symbol2, int symbol3)
|
||||
{
|
||||
return this.symbolA == symbol1 && this.symbolB == symbol2 && this.symbolC == symbol3;
|
||||
}
|
||||
|
||||
public boolean isEqualXYZ(int x, int y, int z)
|
||||
{
|
||||
return this.xCoord == x && this.yCoord == y && this.zCoord == z;
|
||||
}
|
||||
|
||||
public int x()
|
||||
{
|
||||
return this.xCoord;
|
||||
}
|
||||
|
||||
public int y()
|
||||
{
|
||||
return this.yCoord;
|
||||
}
|
||||
|
||||
public int z()
|
||||
{
|
||||
return this.zCoord;
|
||||
}
|
||||
|
||||
public int symA()
|
||||
{
|
||||
return this.symbolA;
|
||||
}
|
||||
|
||||
public int symB()
|
||||
{
|
||||
return this.symbolB;
|
||||
}
|
||||
|
||||
public int symC()
|
||||
{
|
||||
return this.symbolC;
|
||||
}
|
||||
|
||||
public int dimension()
|
||||
{
|
||||
return this.dimensionID;
|
||||
}
|
||||
|
||||
public void setSymbolA(int symbol)
|
||||
{
|
||||
this.symbolA = symbol;
|
||||
}
|
||||
|
||||
public void setSymbolB(int symbol)
|
||||
{
|
||||
this.symbolB = symbol;
|
||||
}
|
||||
|
||||
public void setSymbolC(int symbol)
|
||||
{
|
||||
this.symbolC = symbol;
|
||||
}
|
||||
|
||||
public void setDimension(int dimension)
|
||||
{
|
||||
this.dimensionID = dimension;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
|
||||
package hawk.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public class ProcessingRecipes
|
||||
{
|
||||
private static Map washerSecondaries = new HashMap();
|
||||
private static Map washerRarities = new HashMap();
|
||||
|
||||
private static Map quantityMapping = new HashMap();
|
||||
|
||||
/**
|
||||
*
|
||||
* Instead of IDs, processing now uses enums.
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public enum EnumProcessing
|
||||
{
|
||||
CRUSHING_EXPLOSIVES(new HashMap()),
|
||||
|
||||
WASHING(new HashMap()),
|
||||
|
||||
STAR_FORGE(new HashMap()),
|
||||
|
||||
ENDIUM_FORGE(new HashMap()),
|
||||
|
||||
HM_E2MM(new HashMap());
|
||||
|
||||
private Map processingList;
|
||||
|
||||
EnumProcessing(Map recipeList)
|
||||
{
|
||||
processingList = recipeList;
|
||||
}
|
||||
|
||||
public Map getRecipeList()
|
||||
{
|
||||
return processingList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Adds a processing recipe.
|
||||
*
|
||||
* @param input The input.
|
||||
* @param output The output.
|
||||
* @param processType What type of processing this recipe is for.
|
||||
*/
|
||||
public static void addHMProcessingRecipe(ItemStack input, ItemStack output, EnumProcessing processType)
|
||||
{
|
||||
processType.getRecipeList().put(Arrays.asList(input.getItem(), input.isItemStackDamageable() ? 0 : input.getItemDamage(), input.isItemEnchanted(), input.stackTagCompound != null), output);
|
||||
quantityMapping.put(Arrays.asList(input.getItem(), input.getItemDamage(), processType), (Integer)input.stackSize);
|
||||
|
||||
}
|
||||
|
||||
public static void addHMProcessingRecipe(Item input, ItemStack output, EnumProcessing processType)
|
||||
{
|
||||
addHMProcessingRecipe(new ItemStack(input), output, processType);
|
||||
}
|
||||
|
||||
public static void addHMProcessingRecipe(Item input, Item output, EnumProcessing processType)
|
||||
{
|
||||
addHMProcessingRecipe(new ItemStack(input), new ItemStack(output), processType);
|
||||
}
|
||||
|
||||
public static void addHMProcessingRecipe(Item input, Block output, EnumProcessing processType)
|
||||
{
|
||||
addHMProcessingRecipe(new ItemStack(input), new ItemStack(output), processType);
|
||||
}
|
||||
|
||||
public static void addHMProcessingRecipe(Block input, ItemStack output, EnumProcessing processType)
|
||||
{
|
||||
addHMProcessingRecipe(new ItemStack(input), output, processType);
|
||||
}
|
||||
|
||||
public static void addHMProcessingRecipe(Block input, Item output, EnumProcessing processType)
|
||||
{
|
||||
addHMProcessingRecipe(new ItemStack(input), new ItemStack(output), processType);
|
||||
}
|
||||
|
||||
public static void addHMProcessingRecipe(Block input, Block output, EnumProcessing processType)
|
||||
{
|
||||
addHMProcessingRecipe(new ItemStack(input), new ItemStack(output), processType);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Forge Ore Dictionary supported version.
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
* @param processingType
|
||||
*/
|
||||
public static void addHMFoDProcessingRecipe(String input, ItemStack output, EnumProcessing processType)
|
||||
{
|
||||
for (ItemStack ore : OreDictionary.getOres(input))
|
||||
{
|
||||
if (ore != null)
|
||||
{
|
||||
addHMProcessingRecipe(ore, output, processType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void addHMWashingSecondary(ItemStack input, Object output, boolean isCommon)
|
||||
{
|
||||
if (isCommon)
|
||||
{
|
||||
washerSecondaries.put(Arrays.asList(input.getItem(), input.getItemDamage()), output);
|
||||
}
|
||||
else
|
||||
{
|
||||
washerRarities.put(Arrays.asList(input.getItem(), input.getItemDamage()), output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ItemStack getResult(ItemStack input, EnumProcessing processType)
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemStack output = (ItemStack)processType.getRecipeList().get(Arrays.asList(input.getItem(), input.isItemStackDamageable() ? 0 : input.getItemDamage(), input.isItemEnchanted(), input.stackTagCompound != null));
|
||||
|
||||
if (output != null)
|
||||
{
|
||||
if (input.isItemEqual(output) && input.isItemStackDamageable() && output.isItemStackDamageable())
|
||||
{
|
||||
output.setItemDamage(input.getItemDamage());
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getQuantity(ItemStack item, EnumProcessing processType)
|
||||
{
|
||||
return (Integer)quantityMapping.get(Arrays.asList(item.getItem(), item.getItemDamage(), processType));
|
||||
}
|
||||
|
||||
public static ItemStack getWashingSecondaryResult(ItemStack item, Random random)
|
||||
{
|
||||
int secondaryChance = random.nextInt(100);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (secondaryChance < 5)
|
||||
{
|
||||
ItemStack ret = (ItemStack)washerRarities.get(Arrays.asList(item.getItem(), item.getItemDamage()));
|
||||
|
||||
if (ret != null)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
else if (secondaryChance < 10)
|
||||
{
|
||||
ItemStack ret = (ItemStack)washerSecondaries.get(Arrays.asList(item.getItem(), item.getItemDamage()));
|
||||
|
||||
if (ret != null)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
|
||||
package hawk.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityPlayerMP;
|
||||
import net.minecraft.src.ServerConfigurationManager;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public class TeleportationHelper
|
||||
{
|
||||
private List<EndiumTeleporterCoords> coordsList;
|
||||
private static TeleportationHelper INSTANCE;
|
||||
|
||||
public TeleportationHelper()
|
||||
{
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
public boolean registerCoords(EndiumTeleporterCoords coords)
|
||||
{
|
||||
for (EndiumTeleporterCoords otherCoords : this.coordsList)
|
||||
{
|
||||
if (otherCoords.isEqual(coords.symA(), coords.symB(), coords.symC()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.coordsList.add(coords);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean removeCoords(EndiumTeleporterCoords coords)
|
||||
{
|
||||
return this.coordsList.remove(coords);
|
||||
}
|
||||
|
||||
public EndiumTeleporterCoords getCoordsFromSymbols(int sym1, int sym2, int sym3)
|
||||
{
|
||||
for (EndiumTeleporterCoords coords : this.coordsList)
|
||||
{
|
||||
if (coords.isEqual(sym1, sym2, sym3))
|
||||
{
|
||||
return coords;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void teleportEntity(Entity entity, EndiumTeleporterCoords coords)
|
||||
{
|
||||
if (new Random().nextInt(100) > 10)
|
||||
{
|
||||
entity.travelToTheEnd(entity.dimension);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.worldObj.isRemote)
|
||||
{
|
||||
if (coords.dimension() != entity.dimension)
|
||||
{
|
||||
ServerConfigurationManager manager = MinecraftServer.getServer().getConfigurationManager();
|
||||
|
||||
if (entity instanceof EntityPlayerMP)
|
||||
{
|
||||
manager.transferPlayerToDimension(((EntityPlayerMP)entity), coords.dimension());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
manager.func_82448_a(entity, coords.dimension(), DimensionManager.getWorld(entity.dimension), DimensionManager.getWorld(coords.dimension()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
entity.setPosition(coords.x() - 0.5, coords.y(), coords.z() - 0.5);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static TeleportationHelper instance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,9 +7,6 @@ import cpw.mods.fml.common.Side;
|
|||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityDamagableMachine;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityTeleporter;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
|
||||
/**
|
||||
* Block class for handling multiple machine block IDs.
|
||||
|
@ -18,8 +15,6 @@ import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
|||
* 2: Combiner
|
||||
* 3: Crusher
|
||||
* 4: Theoretical Elementizer
|
||||
* 5: Washer
|
||||
* 6: Teleporter
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -59,41 +54,36 @@ public class BlockMachine extends BlockContainer
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta != 5 && meta != 6)
|
||||
{
|
||||
TileEntityBasicMachine tileEntity = (TileEntityBasicMachine)world.getBlockTileEntity(x, y, z);
|
||||
if (isActive(world, x, y, z))
|
||||
{
|
||||
float xRandom = (float)x + 0.5F;
|
||||
float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
|
||||
float zRandom = (float)z + 0.5F;
|
||||
float iRandom = 0.52F;
|
||||
float jRandom = random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (tileEntity.facing == 4)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 5)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 2)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 3)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
TileEntityBasicMachine tileEntity = (TileEntityBasicMachine)world.getBlockTileEntity(x, y, z);
|
||||
if (isActive(world, x, y, z))
|
||||
{
|
||||
float xRandom = (float)x + 0.5F;
|
||||
float yRandom = (float)y + 0.0F + random.nextFloat() * 6.0F / 16.0F;
|
||||
float zRandom = (float)z + 0.5F;
|
||||
float iRandom = 0.52F;
|
||||
float jRandom = random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (tileEntity.facing == 4)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom - iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 5)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + iRandom), (double)yRandom, (double)(zRandom + jRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 2)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom - iRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
else if (tileEntity.facing == 3)
|
||||
{
|
||||
world.spawnParticle("smoke", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("reddust", (double)(xRandom + jRandom), (double)yRandom, (double)(zRandom + iRandom), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
|
@ -152,34 +142,6 @@ public class BlockMachine extends BlockContainer
|
|||
return 19;
|
||||
}
|
||||
}
|
||||
else if(meta == 5)
|
||||
{
|
||||
if(side == 1)
|
||||
{
|
||||
return 29;
|
||||
}
|
||||
else if(side == 3)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
else {
|
||||
return 31;
|
||||
}
|
||||
}
|
||||
else if(meta == 6)
|
||||
{
|
||||
if(side == 0)
|
||||
{
|
||||
return 34;
|
||||
}
|
||||
else if(side == 1)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
else {
|
||||
return 33;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -252,34 +214,6 @@ public class BlockMachine extends BlockContainer
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(metadata == 5)
|
||||
{
|
||||
if(side == 1)
|
||||
{
|
||||
return 29;
|
||||
}
|
||||
else if(side == tileEntity.facing)
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
else {
|
||||
return 31;
|
||||
}
|
||||
}
|
||||
else if(metadata == 6)
|
||||
{
|
||||
if(side == 0)
|
||||
{
|
||||
return 34;
|
||||
}
|
||||
else if(side == 1)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
else {
|
||||
return 33;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -298,8 +232,6 @@ public class BlockMachine extends BlockContainer
|
|||
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));
|
||||
list.add(new ItemStack(i, 1, 6));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -371,10 +303,9 @@ public class BlockMachine extends BlockContainer
|
|||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//If the block isn't a washer
|
||||
else {
|
||||
TileEntityBasicMachine tileEntity = (TileEntityBasicMachine)world.getBlockTileEntity(x, y, z);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
@ -391,12 +322,10 @@ public class BlockMachine extends BlockContainer
|
|||
else if(metadata == 3) id = 6;
|
||||
else if(metadata == 4) id = 7;
|
||||
else if(metadata == 5) id = 10;
|
||||
else if(metadata == 6) id = 11;
|
||||
|
||||
entityplayer.openGui(ObsidianIngots.instance, id, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -429,14 +358,6 @@ public class BlockMachine extends BlockContainer
|
|||
{
|
||||
return new TileEntityTheoreticalElementizer();
|
||||
}
|
||||
else if(metadata == MachineType.WASHER.index)
|
||||
{
|
||||
return new TileEntityWasher();
|
||||
}
|
||||
else if(metadata == MachineType.TELEPORTER.index)
|
||||
{
|
||||
return new TileEntityTeleporter();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
@ -454,9 +375,7 @@ public class BlockMachine extends BlockContainer
|
|||
PLATINUM_COMPRESSOR(1),
|
||||
COMBINER(2),
|
||||
CRUSHER(3),
|
||||
THEORETICAL_ELEMENTIZER(4),
|
||||
WASHER(5),
|
||||
TELEPORTER(6);
|
||||
THEORETICAL_ELEMENTIZER(4);
|
||||
|
||||
private int index;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import cpw.mods.fml.common.asm.SideOnly;
|
|||
|
||||
import net.minecraft.src.*;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityEndiumChunkloader;
|
||||
|
||||
/**
|
||||
* Block class for handling multiple metal block IDs.
|
||||
|
@ -17,14 +16,11 @@ import net.uberkat.obsidian.hawk.common.TileEntityEndiumChunkloader;
|
|||
* 2: Refined Obsidian
|
||||
* 3: Coal Block
|
||||
* 4: Refined Glowstone
|
||||
* 5: Endium Chunkloader
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class BlockMulti extends Block
|
||||
{
|
||||
public TileEntityEndiumChunkloader tileChunkloader;
|
||||
|
||||
public BlockMulti(int i)
|
||||
{
|
||||
super(i, Material.iron);
|
||||
|
@ -65,7 +61,6 @@ public class BlockMulti extends Block
|
|||
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)
|
||||
|
@ -97,21 +92,6 @@ public class BlockMulti extends Block
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasTileEntity(int metadata)
|
||||
{
|
||||
return metadata == 5;
|
||||
}
|
||||
|
||||
public TileEntity createTileEntity(World world, int metadata)
|
||||
{
|
||||
if(metadata == 5)
|
||||
{
|
||||
tileChunkloader = new TileEntityEndiumChunkloader();
|
||||
return tileChunkloader;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
||||
{
|
||||
|
@ -171,11 +151,6 @@ public class BlockMulti extends Block
|
|||
world.updateAllLightTypes(x, y, z);
|
||||
}
|
||||
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer)
|
||||
{
|
||||
ForgeChunkManager.releaseTicket(tileChunkloader.heldChunk);
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
{
|
||||
return "/textures/terrain.png";
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.src.*;
|
|||
/**
|
||||
* Block class for handling multiple ore block IDs.
|
||||
* 0: Platinum Ore
|
||||
* 1: Endium Ore
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -35,8 +34,6 @@ public class BlockOre extends Block
|
|||
{
|
||||
case 0:
|
||||
return 3;
|
||||
case 1:
|
||||
return 28;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -50,7 +47,6 @@ public class BlockOre extends Block
|
|||
public void getSubBlocks(int i, CreativeTabs creativetabs, List list)
|
||||
{
|
||||
list.add(new ItemStack(i, 1, 0));
|
||||
list.add(new ItemStack(i, 1, 1));
|
||||
}
|
||||
|
||||
public String getTextureFile()
|
||||
|
|
|
@ -11,12 +11,6 @@ import net.minecraft.src.Container;
|
|||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.uberkat.obsidian.hawk.client.GuiTeleporter;
|
||||
import net.uberkat.obsidian.hawk.client.GuiWasher;
|
||||
import net.uberkat.obsidian.hawk.common.ContainerTeleporter;
|
||||
import net.uberkat.obsidian.hawk.common.ContainerWasher;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityTeleporter;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
/**
|
||||
|
@ -127,11 +121,6 @@ public class CommonProxy
|
|||
case 9:
|
||||
TileEntityGenerator tileentity6 = (TileEntityGenerator)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerGenerator(player.inventory, tileentity6);
|
||||
case 10:
|
||||
TileEntityWasher tileentity7 = (TileEntityWasher)world.getBlockTileEntity(x, y, z);
|
||||
return new ContainerWasher(player.inventory, tileentity7);
|
||||
case 11:
|
||||
return new ContainerTeleporter(player.inventory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package net.uberkat.obsidian.common;
|
||||
|
||||
import net.minecraft.src.*;
|
||||
|
||||
public class ItemBlockBase extends ItemBlock
|
||||
{
|
||||
public ItemBlockBase(int i, Block block)
|
||||
{
|
||||
super(i);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
switch(itemstack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
name = "baseObsidian";
|
||||
break;
|
||||
case 1:
|
||||
name = "baseRedstone";
|
||||
break;
|
||||
case 2:
|
||||
name = "basePlatinum";
|
||||
break;
|
||||
case 3:
|
||||
name = "basePlatinumOre";
|
||||
break;
|
||||
case 4:
|
||||
name = "baseCoal";
|
||||
break;
|
||||
case 5:
|
||||
name = "baseGlowstone";
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
|
@ -11,8 +11,6 @@ import net.minecraft.src.ItemStack;
|
|||
* 2: Combiner
|
||||
* 3: Crusher
|
||||
* 4: Theoretical Elementizer
|
||||
* 5: Washer
|
||||
* 6: Teleporter
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -57,12 +55,6 @@ public class ItemBlockMachine extends ItemBlock
|
|||
case 4:
|
||||
name = "TheoreticalElementizer";
|
||||
break;
|
||||
case 5:
|
||||
name = "Washer";
|
||||
break;
|
||||
case 6:
|
||||
name = "Teleporter";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.src.*;
|
|||
* 2: Refined Obsidian
|
||||
* 3: Coal Block
|
||||
* 4: Refined Glowstone
|
||||
* 5: Endium Chunkloader
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -34,15 +33,6 @@ public class ItemBlockMulti extends ItemBlock
|
|||
return metaBlock.getBlockTextureFromSideAndMetadata(2, i);
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack item)
|
||||
{
|
||||
if(item.getItemDamage() == 5)
|
||||
{
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
return EnumRarity.common;
|
||||
}
|
||||
|
||||
public String getItemNameIS(ItemStack itemstack)
|
||||
{
|
||||
String name = "";
|
||||
|
@ -63,9 +53,6 @@ public class ItemBlockMulti extends ItemBlock
|
|||
case 4:
|
||||
name = "RefinedGlowstone";
|
||||
break;
|
||||
case 5:
|
||||
name = "EndiumChunkloader";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.src.*;
|
|||
/**
|
||||
* Item class for handling multiple ore block IDs.
|
||||
* 0: Platinum Ore
|
||||
* 1: Endium Ore
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -38,9 +37,6 @@ public class ItemBlockOre extends ItemBlock
|
|||
case 0:
|
||||
name = "PlatinumOre";
|
||||
break;
|
||||
case 1:
|
||||
name = "EndiumOre";
|
||||
break;
|
||||
default:
|
||||
name = "Unknown";
|
||||
break;
|
||||
|
|
|
@ -9,8 +9,7 @@ import net.minecraft.src.*;
|
|||
public class ItemDust extends ItemObsidian
|
||||
{
|
||||
public static String[] en_USNames = {"Iron", "Gold", "Platinum",
|
||||
"Obsidian", "Diamond", "Glass",
|
||||
"Emerald", "Star", "Endium"};
|
||||
"Obsidian"};
|
||||
|
||||
public ItemDust(int id)
|
||||
{
|
||||
|
@ -27,18 +26,13 @@ public class ItemDust extends ItemObsidian
|
|||
case 1: return 250;
|
||||
case 2: return 242;
|
||||
case 3: return 241;
|
||||
case 4: return 249;
|
||||
case 5: return 251;
|
||||
case 6: return 252;
|
||||
case 7: return 253;
|
||||
case 8: return 254;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void getSubItems(int id, CreativeTabs tabs, List itemList)
|
||||
{
|
||||
for (int counter = 0; counter <= 8; ++counter)
|
||||
for (int counter = 0; counter <= 3; ++counter)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, counter));
|
||||
}
|
||||
|
@ -46,6 +40,6 @@ public class ItemDust extends ItemObsidian
|
|||
|
||||
public String getItemNameIS(ItemStack item)
|
||||
{
|
||||
return en_USNames[item.getItemDamage()].toLowerCase() + "Dust";
|
||||
return "item." + en_USNames[item.getItemDamage()].toLowerCase() + "Dust";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.src.*;
|
|||
public class ItemIngot extends ItemObsidian
|
||||
{
|
||||
public static String[] en_USNames = {"Obsidian", "Platinum", "Redstone",
|
||||
"Glowstone", "Endium"};
|
||||
"Glowstone"};
|
||||
|
||||
public ItemIngot(int id)
|
||||
{
|
||||
|
@ -26,14 +26,13 @@ public class ItemIngot extends ItemObsidian
|
|||
case 1: return 162;
|
||||
case 2: return 163;
|
||||
case 3: return 164;
|
||||
case 4: return 174;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void getSubItems(int id, CreativeTabs tabs, List itemList)
|
||||
{
|
||||
for (int counter = 0; counter <= 4; ++counter)
|
||||
for (int counter = 0; counter <= 3; ++counter)
|
||||
{
|
||||
itemList.add(new ItemStack(this, 1, counter));
|
||||
}
|
||||
|
@ -41,6 +40,6 @@ public class ItemIngot extends ItemObsidian
|
|||
|
||||
public String getItemNameIS(ItemStack item)
|
||||
{
|
||||
return en_USNames[item.getItemDamage()].toLowerCase() + "Ingot";
|
||||
return "item." + en_USNames[item.getItemDamage()].toLowerCase() + "Ingot";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,10 @@ import java.util.Random;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraftforge.common.*;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.client.SoundHandler;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityEndiumChunkloader;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityTeleporter;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.*;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
|
@ -42,7 +41,7 @@ import cpw.mods.fml.common.registry.TickRegistry;
|
|||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "4.3")
|
||||
@Mod(modid = "ObsidianIngots", name = "Obsidian Ingots", version = "5.0.0")
|
||||
@NetworkMod(channels = { "ObsidianIngots" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class ObsidianIngots
|
||||
{
|
||||
|
@ -64,7 +63,7 @@ public class ObsidianIngots
|
|||
public static Configuration configuration;
|
||||
|
||||
/** Obsidian Ingots version number */
|
||||
public static Version versionNumber = new Version(4, 3, 0);
|
||||
public static Version versionNumber = new Version(5, 0, 0);
|
||||
|
||||
/** Obsidian Ingots creative tab */
|
||||
public static CreativeTabOI tabOBSIDIAN = new CreativeTabOI();
|
||||
|
@ -214,6 +213,9 @@ public class ObsidianIngots
|
|||
|
||||
//MultiID Items
|
||||
public static Item Dust;
|
||||
public static ItemStack IronDust;
|
||||
public static ItemStack GoldDust;
|
||||
public static ItemStack ObsidianDust;
|
||||
public static Item Ingot;
|
||||
|
||||
//Boolean Values
|
||||
|
@ -659,7 +661,6 @@ public class ObsidianIngots
|
|||
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");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MultiBlock.EndiumChunkloader.name", "Endium Chunkloader");
|
||||
|
||||
//Localization for MachineBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.EnrichmentChamber.name", "Enrichment Chamber");
|
||||
|
@ -667,12 +668,9 @@ public class ObsidianIngots
|
|||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Combiner.name", "Combiner");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Crusher.name", "Crusher");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.TheoreticalElementizer.name", "Theoretical Elementizer");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Washer.name", "Washer");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.MachineBlock.Teleporter.name", "Teleporter");
|
||||
|
||||
//Localization for OreBlock
|
||||
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.PlatinumOre.name", "Platinum Ore");
|
||||
LanguageRegistry.instance().addStringLocalization("tile.OreBlock.EndiumOre.name", "Endium Ore");
|
||||
|
||||
//Localization for PowerUnit
|
||||
LanguageRegistry.instance().addStringLocalization("tile.PowerUnit.PowerUnit.name", "Power Unit");
|
||||
|
@ -686,18 +684,12 @@ public class ObsidianIngots
|
|||
LanguageRegistry.instance().addStringLocalization("item.goldDust.name", "Gold Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.platinumDust.name", "Platinum Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.obsidianDust.name", "Obsidian Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.diamondDust.name", "Diamond Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.glassDust.name", "Glass Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.emeraldDust.name", "Emerald Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.starDust.name", "Star Dust");
|
||||
LanguageRegistry.instance().addStringLocalization("item.endiumDust.name", "Endium Dust");
|
||||
|
||||
//Localization for Ingot
|
||||
LanguageRegistry.instance().addStringLocalization("item.obsidianIngot.name", "Obsidian Ingot");
|
||||
LanguageRegistry.instance().addStringLocalization("item.platinumIngot.name", "Platinum Ingot");
|
||||
LanguageRegistry.instance().addStringLocalization("item.redstoneIngot.name", "Redstone Ingot");
|
||||
LanguageRegistry.instance().addStringLocalization("item.glowstoneIngot.name", "Glowstone Ingot");
|
||||
LanguageRegistry.instance().addStringLocalization("item.endiumIngot.name", "Endium Ingot");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -922,20 +914,38 @@ public class ObsidianIngots
|
|||
{
|
||||
Ic2Recipes.addMaceratorRecipe(new ItemStack(Block.obsidian), new ItemStack(Dust, 1, 3));
|
||||
}
|
||||
|
||||
if(hooks.IC2Loaded)
|
||||
{
|
||||
IronDust = hooks.IC2IronDust;
|
||||
GoldDust = hooks.IC2GoldDust;
|
||||
}
|
||||
else {
|
||||
IronDust = new ItemStack(Dust, 1, 0);
|
||||
GoldDust = new ItemStack(Dust, 1, 1);
|
||||
}
|
||||
|
||||
if(hooks.RailcraftLoaded)
|
||||
{
|
||||
ObsidianDust = hooks.RailcraftObsidianDust;
|
||||
}
|
||||
else {
|
||||
ObsidianDust = new ItemStack(Dust, 1, 3);
|
||||
}
|
||||
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(Dust, 1, 3));
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(Dust, 2, 0));
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(Dust, 2, 1));
|
||||
RecipeHandler.addPlatinumCompressorRecipe(new ItemStack(Dust, 1, 3), new ItemStack(Ingot, 1, 0));
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(Dust, 1, 3), new ItemStack(Block.obsidian));
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(Dust, 2, 0), new ItemStack(Block.oreIron));
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(Dust, 2, 1), new ItemStack(Block.oreGold));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Ingot, 1, 0), new ItemStack(Dust, 1, 3));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.ingotIron), new ItemStack(Dust, 1, 0));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.ingotGold), new ItemStack(Dust, 1, 1));
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.obsidian), ObsidianDust);
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreIron), new ItemStack(IronDust.itemID, 2, 0));
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Block.oreGold), new ItemStack(GoldDust.itemID, 2, 1));
|
||||
RecipeHandler.addPlatinumCompressorRecipe(ObsidianDust, new ItemStack(Ingot, 1, 0));
|
||||
RecipeHandler.addCombinerRecipe(ObsidianDust, new ItemStack(Block.obsidian));
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(IronDust.itemID, 2, 0), new ItemStack(Block.oreIron));
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(GoldDust.itemID, 2, 1), new ItemStack(Block.oreGold));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Ingot, 1, 0), new ItemStack(ObsidianDust.itemID, 1, 3));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.ingotIron), new ItemStack(IronDust.itemID, 1, 0));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.ingotGold), new ItemStack(GoldDust.itemID, 1, 1));
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(EnrichedAlloy, 1), new Object[] {
|
||||
Item.redstone, Item.lightStoneDust, new ItemStack(Dust, 1, 0), new ItemStack(Dust, 1, 1), new ItemStack(Dust, 1, 3), new ItemStack(Dust, 1, 2)
|
||||
Item.redstone, Item.lightStoneDust, IronDust, GoldDust, ObsidianDust, new ItemStack(Dust, 1, 2)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -961,9 +971,6 @@ public class ObsidianIngots
|
|||
GameRegistry.registerTileEntity(TileEntityPowerUnit.class, "PowerUnit");
|
||||
GameRegistry.registerTileEntity(TileEntityAdvancedPowerUnit.class, "AdvancedPowerUnit");
|
||||
GameRegistry.registerTileEntity(TileEntityHeatGenerator.class, "HeatGenerator");
|
||||
GameRegistry.registerTileEntity(TileEntityWasher.class, "Washer");
|
||||
GameRegistry.registerTileEntity(TileEntityTeleporter.class, "TeleporterSender");
|
||||
GameRegistry.registerTileEntity(TileEntityEndiumChunkloader.class, "EndiumChunkloader");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.src.Packet;
|
|||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraft.src.World;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
|
@ -385,84 +384,6 @@ public class PacketHandler implements IPacketHandler
|
|||
PacketDispatcher.sendPacketToAllAround(sender.xCoord, sender.yCoord, sender.zCoord, distance, sender.worldObj.provider.dimensionId, packet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a damagable machine update packet from server to client. This will send the data int '4,' as well as
|
||||
* the machine's x, y, and z coordinates, along with it's facing, active state, operating ticks, energy stored, max energy,
|
||||
* HP, and water units.
|
||||
* @param sender - tile entity who is sending the packet
|
||||
*/
|
||||
public static void sendWasherPacket(TileEntityWasher sender)
|
||||
{
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(bytes);
|
||||
|
||||
try {
|
||||
output.writeInt(EnumPacketType.TILE_ENTITY.id);
|
||||
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.operatingTicks);
|
||||
output.writeInt(sender.energyStored);
|
||||
output.writeInt(sender.currentMaxEnergy);
|
||||
output.writeInt(sender.currentTicksRequired);
|
||||
output.writeFloat(sender.waterUnits);
|
||||
} catch (IOException e)
|
||||
{
|
||||
System.err.println("[ObsidianIngots] Error while writing tile entity packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "ObsidianIngots";
|
||||
packet.data = bytes.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
|
||||
if(FMLCommonHandler.instance().getMinecraftServerInstance() != null)
|
||||
{
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().sendPacketToAllPlayers(packet);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a damagable machine update packet from server to client with a defined range. This will send the data int '4,' as well as
|
||||
* the machine's x, y, and z coordinates, along with it's facing, active state, operating ticks, energy stored, max energy,
|
||||
* HP, and water units.
|
||||
* @param sender - tile entity who is sending the packet
|
||||
* @param distance - radius to send packet in
|
||||
*/
|
||||
public static void sendWasherPacketWithRange(TileEntityWasher sender, double distance)
|
||||
{
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
DataOutputStream output = new DataOutputStream(bytes);
|
||||
|
||||
try {
|
||||
output.writeInt(EnumPacketType.TILE_ENTITY.id);
|
||||
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.operatingTicks);
|
||||
output.writeInt(sender.energyStored);
|
||||
output.writeInt(sender.currentMaxEnergy);
|
||||
output.writeInt(sender.currentTicksRequired);
|
||||
output.writeFloat(sender.waterUnits);
|
||||
} catch (IOException e)
|
||||
{
|
||||
System.err.println("[ObsidianIngots] Error while writing tile entity packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "ObsidianIngots";
|
||||
packet.data = bytes.toByteArray();
|
||||
packet.length = packet.data.length;
|
||||
|
||||
PacketDispatcher.sendPacketToAllAround(sender.xCoord, sender.yCoord, sender.zCoord, distance, sender.worldObj.provider.dimensionId, packet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the server the defined packet data int.
|
||||
* @param type - packet type
|
||||
|
|
|
@ -2,7 +2,6 @@ package net.uberkat.obsidian.common;
|
|||
|
||||
import java.util.*;
|
||||
import net.minecraft.src.*;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
|
||||
/**
|
||||
* Class used to handle machine recipes. This is used for both adding recipes and checking outputs.
|
||||
|
|
|
@ -54,6 +54,9 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
/** The previous active state for this block. */
|
||||
public boolean prevActive;
|
||||
|
||||
/** Whether or not this machine has been registered with the MachineryManager. */
|
||||
public boolean registered;
|
||||
|
||||
/** The GUI texture path for this machine. */
|
||||
public String guiTexturePath;
|
||||
|
||||
|
@ -86,6 +89,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
|
||||
public void onUpdate()
|
||||
{
|
||||
if(!registered && worldObj != null && !worldObj.isRemote)
|
||||
{
|
||||
ObsidianIngots.manager.register(this);
|
||||
registered = true;
|
||||
}
|
||||
|
||||
if(audio == null && worldObj != null && worldObj.isRemote)
|
||||
{
|
||||
if(FMLClientHandler.instance().getClient().sndManager.sndSystem != null)
|
||||
|
@ -137,6 +146,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
if(!worldObj.isRemote && registered)
|
||||
{
|
||||
ObsidianIngots.manager.remove(this);
|
||||
registered = false;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote && audio != null)
|
||||
{
|
||||
audio.remove();
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.Slot;
|
||||
|
||||
public class ContainerTeleporter extends Container
|
||||
{
|
||||
public ContainerTeleporter(InventoryPlayer playerInv)
|
||||
{
|
||||
for (int counter = 0; counter < 3; ++counter)
|
||||
{
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInv, var4 + counter * 9 + 9, 8 + var4 * 18, 84 + counter * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int counter = 0; counter < 9; ++counter)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInv, counter, 8 + counter * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import hawk.api.ProcessingRecipes;
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Slot;
|
||||
import net.minecraft.src.SlotFurnace;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import universalelectricity.prefab.SlotElectricItem;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
|
||||
public class ContainerWasher extends Container
|
||||
{
|
||||
private TileEntityWasher tileEntity;
|
||||
|
||||
public ContainerWasher(InventoryPlayer playerInventory, TileEntityWasher tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new SlotElectricItem(tileEntity, 0, 36, 47));//Electric item
|
||||
addSlotToContainer(new Slot(tileEntity, 1, 58, 52));//Water input
|
||||
addSlotToContainer(new Slot(tileEntity, 2, 36, 15));//Actual input
|
||||
addSlotToContainer(new SlotFurnace(playerInventory.player, tileEntity, 3, 107, 32));
|
||||
addSlotToContainer(new SlotFurnace(playerInventory.player, tileEntity, 4, 125, 32));
|
||||
addSlotToContainer(new SlotFurnace(playerInventory.player, tileEntity, 5, 143, 32));
|
||||
|
||||
for (int counter = 0; counter < 3; ++counter)
|
||||
{
|
||||
for (int var4 = 0; var4 < 9; ++var4)
|
||||
{
|
||||
addSlotToContainer(new Slot(playerInventory, var4 + counter * 9 + 9, 8 + var4 * 18, 84 + counter * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int counter = 0; counter < 9; ++counter)
|
||||
{
|
||||
addSlotToContainer(new Slot(playerInventory, counter, 8 + counter * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer var1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack func_82846_b(EntityPlayer player, int par1)
|
||||
{
|
||||
ItemStack var2 = null;
|
||||
Slot var3 = (Slot)inventorySlots.get(par1);
|
||||
|
||||
if (var3 != null && var3.getHasStack())
|
||||
{
|
||||
ItemStack var4 = var3.getStack();
|
||||
var2 = var4.copy();
|
||||
|
||||
if (par1 == 2)
|
||||
{
|
||||
if (!mergeItemStack(var4, 3, 39, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var3.onSlotChange(var4, var2);
|
||||
}
|
||||
else if (par1 != 1 && par1 != 0)
|
||||
{
|
||||
if (var4.getItem() instanceof IItemElectric)
|
||||
{
|
||||
if (!mergeItemStack(var4, 0, 1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (ProcessingRecipes.getResult(var4, ProcessingRecipes.EnumProcessing.WASHING) != null)
|
||||
{
|
||||
if (!mergeItemStack(var4, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (par1 >= 3 && par1 < 30)
|
||||
{
|
||||
if (!mergeItemStack(var4, 30, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (par1 >= 30 && par1 < 39 && !mergeItemStack(var4, 3, 30, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!mergeItemStack(var4, 3, 39, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var4.stackSize == 0)
|
||||
{
|
||||
var3.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var3.onSlotChanged();
|
||||
}
|
||||
|
||||
if (var4.stackSize == var2.stackSize)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var3.func_82870_a(player, var4);
|
||||
}
|
||||
|
||||
return var2;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
|
||||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.src.Achievement;
|
||||
import net.minecraft.src.AchievementList;
|
||||
import net.minecraft.src.ChunkProviderEnd;
|
||||
import net.minecraft.src.ChunkProviderGenerate;
|
||||
import net.minecraft.src.ChunkProviderHell;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EntityVillager;
|
||||
import net.minecraft.src.IChunkProvider;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.MerchantRecipe;
|
||||
import net.minecraft.src.MerchantRecipeList;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.uberkat.obsidian.common.ObsidianIngots;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public class HawkCore implements LoadingCallback, ICraftingHandler
|
||||
{
|
||||
private static int chunkLimit;
|
||||
|
||||
public static int partsID;
|
||||
public static int endiumPlateID;
|
||||
public static int rivetsID;
|
||||
public static int rivetGunID;
|
||||
public static int ingotsID;
|
||||
|
||||
public static int ACHprospector;
|
||||
public static int ACHtimeToCrush;
|
||||
public static int ACHminerkiin;
|
||||
public static int ACHwash;
|
||||
|
||||
public static int washerTicks;
|
||||
public static int maxChunksLoaded;
|
||||
|
||||
public static boolean enableUpdateChecking;
|
||||
public static boolean enableAutoDL;
|
||||
public static boolean enableChunkloader;
|
||||
|
||||
public static Configuration HMConfig = new Configuration(new File(Loader.instance().getConfigDir(), "HawksMachinery/HMConfig.cfg"));
|
||||
|
||||
public static void loadConfig()
|
||||
{
|
||||
|
||||
HMConfig.load();
|
||||
|
||||
//NOTE ID #3964 saved for the Endium Chunkloader.
|
||||
//endiumTeleporterID = HMConfig.getBlock("Endium Teleporter", 3965).getInt(3965);
|
||||
|
||||
enableUpdateChecking = HMConfig.get(Configuration.CATEGORY_GENERAL, "Enable Update Checking", true).getBoolean(true);
|
||||
enableAutoDL = HMConfig.get(Configuration.CATEGORY_GENERAL, "Enable Auto DL", true).getBoolean(true);
|
||||
enableChunkloader = HMConfig.get(Configuration.CATEGORY_GENERAL, "Enable Chunkloader Block", true).getBoolean(true);
|
||||
|
||||
if (enableChunkloader)
|
||||
{
|
||||
maxChunksLoaded = HMConfig.get("Max Chunks Loaded", Configuration.CATEGORY_GENERAL, 25).getInt(25);
|
||||
|
||||
}
|
||||
|
||||
partsID = HMConfig.get(Configuration.CATEGORY_ITEM, "Parts", 24152).getInt(24152);
|
||||
endiumPlateID = HMConfig.get(Configuration.CATEGORY_ITEM, "Endium Plate", 24154).getInt(24154);
|
||||
rivetsID = HMConfig.get(Configuration.CATEGORY_ITEM, "Rivets", 24155).getInt(24155);
|
||||
rivetGunID = HMConfig.get(Configuration.CATEGORY_ITEM, "Rivet Gun", 24156).getInt(24156);
|
||||
ingotsID = HMConfig.get(Configuration.CATEGORY_ITEM, "Ingots", 24157).getInt(24157);
|
||||
|
||||
ACHprospector = HMConfig.get(Configuration.CATEGORY_GENERAL, "ACH Prospector", 1500).getInt(1500);
|
||||
ACHtimeToCrush = HMConfig.get(Configuration.CATEGORY_GENERAL, "ACH Time To Crush", 1501).getInt(1501);
|
||||
ACHminerkiin = HMConfig.get(Configuration.CATEGORY_GENERAL, "ACH Minerkiin", 1503).getInt(1503);
|
||||
ACHwash = HMConfig.get(Configuration.CATEGORY_GENERAL, "ACH Wash", 1504).getInt(1504);
|
||||
|
||||
if (FMLCommonHandler.instance().getSide().isServer())
|
||||
{
|
||||
HMConfig.addCustomCategoryComment("advanced_settings", "Advanced server OP settings, don't be a moron with them.");
|
||||
washerTicks = HMConfig.get("advanced_settings", "Washer Ticks", 100).getInt(100);
|
||||
|
||||
}
|
||||
|
||||
HMConfig.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ticketsLoaded(List<Ticket> tickets, World world)
|
||||
{
|
||||
for (Ticket ticket : tickets)
|
||||
{
|
||||
int xPos = ticket.getModData().getInteger("xCoord");
|
||||
int yPos = ticket.getModData().getInteger("yCoord");
|
||||
int zPos = ticket.getModData().getInteger("zCoord");
|
||||
|
||||
if (world.getBlockTileEntity(xPos, yPos, zPos) != null)
|
||||
{
|
||||
if (world.getBlockTileEntity(xPos, yPos, zPos) instanceof TileEntityEndiumChunkloader)
|
||||
{
|
||||
((TileEntityEndiumChunkloader)world.getBlockTileEntity(xPos, yPos, zPos)).forceChunkLoading(ticket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
|
||||
{
|
||||
if (item.equals(new ItemStack(ObsidianIngots.MachineBlock, 1, 5)))
|
||||
{
|
||||
item.setTagCompound(new NBTTagCompound());
|
||||
item.stackTagCompound.setInteger("MachineHP", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSmelting(EntityPlayer player, ItemStack item) {}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
|
||||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import hawk.api.ProcessingRecipes;
|
||||
import hawk.api.ProcessingRecipes.EnumProcessing;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import obsidian.api.ItemRetriever;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.prefab.ItemElectric;
|
||||
import universalelectricity.prefab.network.ConnectionHandler;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.prefab.ore.OreGenBase;
|
||||
import universalelectricity.prefab.ore.OreGenerator;
|
||||
import net.minecraft.src.Achievement;
|
||||
import net.minecraft.src.AchievementList;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.CraftingManager;
|
||||
import net.minecraft.src.CreativeTabs;
|
||||
import net.minecraft.src.Enchantment;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.EnumRarity;
|
||||
import net.minecraft.src.EnumToolMaterial;
|
||||
import net.minecraft.src.FurnaceRecipes;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.Material;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.StepSound;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.DungeonHooks;
|
||||
import net.minecraftforge.common.EnumHelper;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ICraftingHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Metadata;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.asm.SideOnly;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
|
||||
public class HawksMachinery
|
||||
{
|
||||
public static ProcessingRecipes PROCESS_RECIPES;
|
||||
public static EnumProcessing WASH = EnumProcessing.WASHING;
|
||||
|
||||
public static HawkCore CORE = new HawkCore();
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import hawk.api.ProcessingRecipes.EnumProcessing;
|
||||
|
||||
import java.util.Random;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.implement.IRotatable;
|
||||
import universalelectricity.prefab.TileEntityElectricityReceiver;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
import universalelectricity.core.Vector3;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.NBTTagList;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.uberkat.obsidian.common.TileEntityBasicMachine;
|
||||
|
||||
/**
|
||||
*
|
||||
* Extend this if you'd like to make a machine slightly faster.
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public abstract class TileEntityDamagableMachine extends TileEntityBasicMachine
|
||||
{
|
||||
public EnumProcessing machineEnum;
|
||||
|
||||
protected boolean isProcessor;
|
||||
|
||||
public TileEntityDamagableMachine(String soundPath, String name, String path, int perTick, int ticksRequired, int maxEnergy)
|
||||
{
|
||||
super(soundPath, name, path, perTick, ticksRequired, maxEnergy);
|
||||
}
|
||||
|
||||
protected void explodeMachine(float strength)
|
||||
{
|
||||
worldObj.createExplosion((Entity)null, xCoord, yCoord, zCoord, strength, true);
|
||||
}
|
||||
|
||||
public void handlePacketData(INetworkManager network, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import net.minecraft.src.ChunkCoordIntPair;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
import net.uberkat.obsidian.common.ObsidianIngots;
|
||||
|
||||
public class TileEntityEndiumChunkloader extends TileEntity
|
||||
{
|
||||
public Ticket heldChunk;
|
||||
|
||||
public void invalidate()
|
||||
{
|
||||
forceChunkLoading(null);
|
||||
}
|
||||
|
||||
public void validate()
|
||||
{
|
||||
forceChunkLoading(null);
|
||||
}
|
||||
|
||||
public void forceChunkLoading(Ticket ticket)
|
||||
{
|
||||
if (ticket != null)
|
||||
{
|
||||
heldChunk = ticket;
|
||||
ForgeChunkManager.forceChunk(heldChunk, new ChunkCoordIntPair(xCoord >> 4, zCoord >> 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (heldChunk == null)
|
||||
{
|
||||
Ticket newTicket = ForgeChunkManager.requestTicket(ObsidianIngots.instance, worldObj, Type.NORMAL);
|
||||
newTicket.getModData().setInteger("xCoord", xCoord);
|
||||
newTicket.getModData().setInteger("yCoord", yCoord);
|
||||
newTicket.getModData().setInteger("zCoord", zCoord);
|
||||
newTicket.setChunkListDepth(HawksMachinery.CORE.maxChunksLoaded);
|
||||
heldChunk = newTicket;
|
||||
}
|
||||
else
|
||||
{
|
||||
ForgeChunkManager.releaseTicket(heldChunk);
|
||||
heldChunk = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import hawk.api.EndiumTeleporterCoords;
|
||||
import hawk.api.TeleportationHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import net.minecraft.src.Entity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class TileEntityTeleporter extends TileEntityDamagableMachine
|
||||
{
|
||||
public EndiumTeleporterCoords coords;
|
||||
|
||||
public TileEntityTeleporter()
|
||||
{
|
||||
super("hawk/Teleporter.ogg", "Teleporter", "/gui/hawk/Teleporter.png", 200, 0, 100000);
|
||||
}
|
||||
|
||||
public boolean isReadyToTeleport()
|
||||
{
|
||||
return energyStored == MAX_ENERGY && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && coords != null;
|
||||
}
|
||||
|
||||
public void teleportEntity(Entity entity)
|
||||
{
|
||||
TeleportationHelper.instance().teleportEntity(entity, coords);
|
||||
energyStored = 0;
|
||||
}
|
||||
|
||||
public boolean canReceiveFromSide(ForgeDirection side)
|
||||
{
|
||||
return side.ordinal() == 0;
|
||||
}
|
||||
|
||||
public boolean canOperate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void operate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List getRecipes()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendPacket()
|
||||
{
|
||||
//Nothing to see here
|
||||
}
|
||||
|
||||
public void sendPacketWithRange()
|
||||
{
|
||||
//Nothing to see here either.
|
||||
}
|
||||
}
|
|
@ -1,266 +0,0 @@
|
|||
package net.uberkat.obsidian.hawk.common;
|
||||
|
||||
import hawk.api.ProcessingRecipes;
|
||||
import hawk.api.ProcessingRecipes.EnumProcessing;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
import obsidian.api.IEnergizedItem;
|
||||
|
||||
import buildcraft.api.core.Orientations;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import net.minecraft.src.EntityItem;
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.Block;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.NBTTagList;
|
||||
import net.minecraft.src.INetworkManager;
|
||||
import net.minecraft.src.Packet;
|
||||
import net.minecraft.src.Packet250CustomPayload;
|
||||
import net.minecraft.src.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import net.uberkat.obsidian.common.PacketHandler;
|
||||
import net.uberkat.obsidian.common.TileEntityBasicMachine;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import universalelectricity.prefab.TileEntityElectricityReceiver;
|
||||
import universalelectricity.implement.IItemElectric;
|
||||
import universalelectricity.implement.IRedstoneReceptor;
|
||||
import universalelectricity.implement.IRotatable;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
public class TileEntityWasher extends TileEntityDamagableMachine
|
||||
{
|
||||
public static Vector recipes;
|
||||
|
||||
public float waterUnits = 0;
|
||||
|
||||
public float WATER_LIMIT = 25.0F;
|
||||
|
||||
public TileEntityWasher()
|
||||
{
|
||||
super("hawk/Washer.ogg", "Washer", "/gui/hawk/GuiWasher.png", 10, 200, 1200);
|
||||
inventory = new ItemStack[6];
|
||||
machineEnum = EnumProcessing.WASHING;
|
||||
isProcessor = true;
|
||||
}
|
||||
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if (inventory[0] != null)
|
||||
{
|
||||
if(energyStored < currentMaxEnergy)
|
||||
{
|
||||
if(inventory[0].getItem() instanceof IEnergizedItem)
|
||||
{
|
||||
int received = 0;
|
||||
int energyNeeded = currentMaxEnergy - energyStored;
|
||||
IEnergizedItem item = (IEnergizedItem)inventory[0].getItem();
|
||||
if(item.getRate() <= energyNeeded)
|
||||
{
|
||||
received = item.discharge(inventory[0], item.getRate());
|
||||
}
|
||||
else if(item.getRate() > energyNeeded)
|
||||
{
|
||||
received = item.discharge(inventory[0], energyNeeded);
|
||||
}
|
||||
|
||||
setEnergy(energyStored + received);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inventory[1] != null)
|
||||
{
|
||||
if (inventory[1].getItem() == Item.bucketWater && waterUnits + 1.0F <= WATER_LIMIT)
|
||||
{
|
||||
waterUnits += 1.0;
|
||||
inventory[1] = new ItemStack(Item.bucketEmpty, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (canOperate())
|
||||
{
|
||||
if (inventory[2] != null && operatingTicks == 0)
|
||||
{
|
||||
operatingTicks = TICKS_REQUIRED;
|
||||
}
|
||||
|
||||
if (canOperate() && operatingTicks > 0)
|
||||
{
|
||||
--operatingTicks;
|
||||
waterUnits -= 0.01F;
|
||||
|
||||
if (operatingTicks == 1)
|
||||
{
|
||||
operate();
|
||||
operatingTicks = 0;
|
||||
}
|
||||
|
||||
energyStored = energyStored - ENERGY_PER_TICK;
|
||||
}
|
||||
else
|
||||
{
|
||||
operatingTicks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (waterUnits > WATER_LIMIT)
|
||||
{
|
||||
waterUnits = WATER_LIMIT;
|
||||
}
|
||||
|
||||
if (worldObj.getBlockId(xCoord, yCoord + 1, zCoord) == Block.waterStill.blockID && waterUnits + 1.0F <= WATER_LIMIT)
|
||||
{
|
||||
waterUnits += 1.0F;
|
||||
worldObj.setBlockWithNotify(xCoord, yCoord + 1, zCoord, 0);
|
||||
}
|
||||
|
||||
if (!canOperate() && operatingTicks != 0)
|
||||
{
|
||||
operatingTicks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canOperate()
|
||||
{
|
||||
if (inventory[2] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (energyStored >= ENERGY_PER_TICK * 2 && waterUnits >= 1.0F && !isDisabled())
|
||||
{
|
||||
ItemStack var1 = ProcessingRecipes.getResult(inventory[2], machineEnum);
|
||||
if (var1 == null) return false;
|
||||
if (inventory[3] == null) return true;
|
||||
if (!inventory[3].isItemEqual(var1)) return false;
|
||||
int result = inventory[3].stackSize + var1.stackSize;
|
||||
return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void operate()
|
||||
{
|
||||
if (canOperate())
|
||||
{
|
||||
ItemStack newItem = ProcessingRecipes.getResult(inventory[2], machineEnum);
|
||||
|
||||
if (inventory[3] == null)
|
||||
{
|
||||
inventory[3] = newItem.copy();
|
||||
}
|
||||
else if (inventory[3].isItemEqual(newItem))
|
||||
{
|
||||
inventory[3].stackSize += newItem.stackSize;
|
||||
}
|
||||
|
||||
inventory[2].stackSize -= ProcessingRecipes.getQuantity(inventory[2], machineEnum);
|
||||
|
||||
if (inventory[2].stackSize <= 0)
|
||||
{
|
||||
inventory[2] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handlePacketData(INetworkManager network, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
try {
|
||||
facing = dataStream.readInt();
|
||||
isActive = dataStream.readByte() != 0;
|
||||
operatingTicks = dataStream.readInt();
|
||||
energyStored = dataStream.readInt();
|
||||
currentMaxEnergy = dataStream.readInt();
|
||||
currentTicksRequired = dataStream.readInt();
|
||||
waterUnits = dataStream.readFloat();
|
||||
worldObj.markBlockAsNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[ObsidianIngots] Error while handling tile entity packet.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public int getWashingStatus(int par1)
|
||||
{
|
||||
return operatingTicks * par1 / 200;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound NBTTag)
|
||||
{
|
||||
super.readFromNBT(NBTTag);
|
||||
waterUnits = NBTTag.getFloat("waterUnits");
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound NBTTag)
|
||||
{
|
||||
super.writeToNBT(NBTTag);
|
||||
NBTTag.setFloat("waterUnits", waterUnits);
|
||||
}
|
||||
|
||||
public void sendPacket()
|
||||
{
|
||||
PacketHandler.sendWasherPacket(this);
|
||||
}
|
||||
|
||||
public void sendPacketWithRange()
|
||||
{
|
||||
PacketHandler.sendWasherPacketWithRange(this, 50);
|
||||
}
|
||||
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return new String[] {"getStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded", "getWater", "getWaterNeeded"};
|
||||
}
|
||||
|
||||
public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case 0:
|
||||
return new Object[] {energyStored};
|
||||
case 1:
|
||||
return new Object[] {operatingTicks};
|
||||
case 2:
|
||||
return new Object[] {isActive};
|
||||
case 3:
|
||||
return new Object[] {facing};
|
||||
case 4:
|
||||
return new Object[] {canOperate()};
|
||||
case 5:
|
||||
return new Object[] {currentMaxEnergy};
|
||||
case 6:
|
||||
return new Object[] {(currentMaxEnergy-energyStored)};
|
||||
case 7:
|
||||
return new Object[] {waterUnits};
|
||||
case 8:
|
||||
return new Object[] {(WATER_LIMIT - waterUnits)};
|
||||
default:
|
||||
System.err.println("[ObsidianIngots] Attempted to call unknown method with computer ID " + computer.getID());
|
||||
return new Object[] {"Unknown command."};
|
||||
}
|
||||
}
|
||||
|
||||
public List getRecipes()
|
||||
{
|
||||
return recipes;
|
||||
}
|
||||
}
|
|
@ -35,10 +35,6 @@ import net.uberkat.obsidian.common.TileEntityGenerator;
|
|||
import net.uberkat.obsidian.common.TileEntityPlatinumCompressor;
|
||||
import net.uberkat.obsidian.common.TileEntityPowerUnit;
|
||||
import net.uberkat.obsidian.common.TileEntityTheoreticalElementizer;
|
||||
import net.uberkat.obsidian.hawk.client.GuiTeleporter;
|
||||
import net.uberkat.obsidian.hawk.client.GuiWasher;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityTeleporter;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
|
||||
/**
|
||||
* Client proxy for Obsidian Ingots mod.
|
||||
|
@ -130,12 +126,6 @@ public class ClientProxy extends CommonProxy
|
|||
case 9:
|
||||
TileEntityGenerator tileentity6 = (TileEntityGenerator)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiGenerator(player.inventory, tileentity6);
|
||||
case 10:
|
||||
TileEntityWasher tileentity7 = (TileEntityWasher)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiWasher(player.inventory, tileentity7);
|
||||
case 11:
|
||||
TileEntityTeleporter tileentity8 = (TileEntityTeleporter)world.getBlockTileEntity(x, y, z);
|
||||
return new GuiTeleporter(player.inventory, tileentity8);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
package net.uberkat.obsidian.hawk.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.src.GuiButton;
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.uberkat.obsidian.hawk.common.ContainerTeleporter;
|
||||
import net.uberkat.obsidian.hawk.common.HawksMachinery;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityTeleporter;
|
||||
|
||||
public class GuiTeleporter extends GuiContainer
|
||||
{
|
||||
public TileEntityTeleporter tileEntity;
|
||||
|
||||
private int containerWidth;
|
||||
private int containerHeight;
|
||||
|
||||
public GuiTeleporter(InventoryPlayer player, TileEntityTeleporter tentity)
|
||||
{
|
||||
super(new ContainerTeleporter(player));
|
||||
tileEntity = tentity;
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
controlList.add(new GuiButton(0, containerHeight - 9, containerWidth - 9, 16, 16, null));
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(mc.renderEngine.getTexture("/gui/GuiEndiumTeleporter.png"));
|
||||
containerWidth = (width - xSize) / 2;
|
||||
containerHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(containerWidth, containerHeight, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
|
||||
package net.uberkat.obsidian.hawk.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import universalelectricity.electricity.ElectricInfo;
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.StatCollector;
|
||||
import net.uberkat.obsidian.hawk.common.ContainerWasher;
|
||||
import net.uberkat.obsidian.hawk.common.HawksMachinery;
|
||||
import net.uberkat.obsidian.hawk.common.TileEntityWasher;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Elusivehawk
|
||||
*/
|
||||
public class GuiWasher extends GuiContainer
|
||||
{
|
||||
private TileEntityWasher tileEntity;
|
||||
|
||||
private int containerWidth;
|
||||
private int containerHeight;
|
||||
|
||||
public GuiWasher(InventoryPlayer playerInv, TileEntityWasher tentity)
|
||||
{
|
||||
super(new ContainerWasher(playerInv, tentity));
|
||||
tileEntity = tentity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRenderer.drawString(ElectricInfo.getDisplayShort(tileEntity.getVoltage(), ElectricInfo.ElectricUnit.VOLTAGE), 116, 60, 4210752);
|
||||
fontRenderer.drawString(ElectricInfo.getDisplayShort(tileEntity.energyStored, ElectricInfo.ElectricUnit.WATT), 116, 70, 4210752);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
||||
{
|
||||
int var4 = mc.renderEngine.getTexture("/gui/GuiWasher.png");
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(var4);
|
||||
containerWidth = (width - xSize) / 2;
|
||||
containerHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(containerWidth, containerHeight, 0, 0, xSize, ySize);
|
||||
|
||||
if (tileEntity.operatingTicks > 0)
|
||||
{
|
||||
int scale = tileEntity.getWashingStatus(tileEntity.TICKS_REQUIRED);
|
||||
drawTexturedModalRect(containerWidth + 52, containerHeight + 28, 176, 0, 52 - scale, 20);
|
||||
}
|
||||
|
||||
drawTexturedModalRect(containerWidth - 32, containerHeight - 16, 0, 232, 240, 16);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue