v5.0.7 Release
*Bumped versions to 5.0.7. *Removed lightning rod -- it's OP, buggy, and doesn't make sense. *Sound effects for Heat Generator and Metallurgic Infuser. *Hydrogen Generator voltage bumped to 240. *Fixed Hydrogen Generator not working when below hydrogen level of 11. *Fixed machinery BuildCraft support. *Machines and generators light up when in active state. *Fixed Metallurgic Infuser output bug.
This commit is contained in:
parent
4f7bc5f635
commit
c328e393bf
BIN
bin/minecraft/resources/mekanism/sound/HeatGenerator.ogg
Normal file
BIN
bin/minecraft/resources/mekanism/sound/HeatGenerator.ogg
Normal file
Binary file not shown.
BIN
bin/minecraft/resources/mekanism/sound/MetallurgicInfuser.ogg
Normal file
BIN
bin/minecraft/resources/mekanism/sound/MetallurgicInfuser.ogg
Normal file
Binary file not shown.
|
@ -27,6 +27,7 @@ import mekanism.generators.common.TileEntityHydrogenGenerator;
|
|||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
|
|
@ -61,7 +61,7 @@ public class SoundHandler
|
|||
* @param z - z coord
|
||||
* @return Sound instance
|
||||
*/
|
||||
public Sound getSound(String name, String path, World world, int x, int y, int z)
|
||||
public Sound getSound(String path, World world, int x, int y, int z)
|
||||
{
|
||||
synchronized(sounds)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.IActiveState;
|
||||
import mekanism.client.ClientProxy;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -100,6 +101,22 @@ public class BlockMachine extends BlockContainer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IActiveState)
|
||||
{
|
||||
if(((IActiveState)tileEntity).getActive())
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
|
|
|
@ -156,6 +156,12 @@ public class ContainerSmeltingFactory extends Container
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, tileEntity.inventory.length, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
|
||||
{
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
package mekanism.common;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemLightningRod extends ItemMekanism
|
||||
{
|
||||
public ItemLightningRod(int i)
|
||||
{
|
||||
super(i);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(100);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack par1ItemStack)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
if(itemstack.getItemDamage() == 0)
|
||||
{
|
||||
MovingObjectPosition movingobjectposition = entityplayer.rayTrace(75.0D, 1.0F);
|
||||
if(movingobjectposition == null)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
Vec3 vec3 = movingobjectposition.hitVec;
|
||||
double x = vec3.xCoord;
|
||||
double y = vec3.yCoord;
|
||||
double z = vec3.zCoord;
|
||||
int i = MathHelper.floor_double(x);
|
||||
int j = MathHelper.floor_double(y);
|
||||
int k = MathHelper.floor_double(z);
|
||||
if(world.canBlockSeeTheSky(i, j, k) == false)
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
EntityLightningBolt entitybolt = new EntityLightningBolt(world, 0D, 0D, 0D);
|
||||
entitybolt.setLocationAndAngles(x, y, z, 0, 0.0F);
|
||||
world.spawnEntityInWorld(entitybolt);
|
||||
entityplayer.swingItem();
|
||||
if(!entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
itemstack.damageItem(99, entityplayer);
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
|
||||
{
|
||||
if(itemstack.getItemDamage() > 0)
|
||||
{
|
||||
itemstack.damageItem(-1, (EntityLiving)entity);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.0.5")
|
||||
@Mod(modid = "Mekanism", name = "Mekanism", version = "5.0.7")
|
||||
@NetworkMod(channels = {"Mekanism"}, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||
public class Mekanism
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ public class Mekanism
|
|||
public static Configuration configuration;
|
||||
|
||||
/** Mekanism version number */
|
||||
public static Version versionNumber = new Version(5, 0, 5);
|
||||
public static Version versionNumber = new Version(5, 0, 7);
|
||||
|
||||
/** Mekanism creative tab */
|
||||
public static CreativeTabMekanism tabMekanism = new CreativeTabMekanism();
|
||||
|
@ -103,7 +103,6 @@ public class Mekanism
|
|||
|
||||
//Extra Items
|
||||
public static ItemElectricBow ElectricBow;
|
||||
public static Item LightningRod;
|
||||
public static Item Stopwatch;
|
||||
public static Item WeatherOrb;
|
||||
public static Item EnrichedAlloy;
|
||||
|
@ -324,7 +323,6 @@ public class Mekanism
|
|||
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
LanguageRegistry.addName(LightningRod, "Lightning Rod");
|
||||
LanguageRegistry.addName(Stopwatch, "Steve's Stopwatch");
|
||||
LanguageRegistry.addName(WeatherOrb, "Weather Orb");
|
||||
LanguageRegistry.addName(EnrichedAlloy, "Enriched Alloy");
|
||||
|
@ -399,7 +397,6 @@ public class Mekanism
|
|||
{
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
LightningRod.setIconIndex(225);
|
||||
Stopwatch.setIconIndex(224);
|
||||
WeatherOrb.setIconIndex(226);
|
||||
EnrichedAlloy.setIconIndex(227);
|
||||
|
@ -426,7 +423,6 @@ public class Mekanism
|
|||
ElectricBow = (ItemElectricBow) new ItemElectricBow(11200).setItemName("ElectricBow");
|
||||
if(extrasEnabled == true)
|
||||
{
|
||||
LightningRod = new ItemLightningRod(11201).setItemName("LightningRod");
|
||||
Stopwatch = new ItemStopwatch(11202).setItemName("Stopwatch");
|
||||
WeatherOrb = new ItemWeatherOrb(11203).setItemName("WeatherOrb");
|
||||
}
|
||||
|
|
|
@ -321,6 +321,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
currentMaxElectricity = dataStream.readDouble();
|
||||
currentTicksRequired = dataStream.readInt();
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -10,6 +10,7 @@ import mekanism.api.IElectricMachine;
|
|||
import mekanism.client.Sound;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import universalelectricity.core.electricity.ElectricityConnections;
|
||||
|
@ -85,6 +86,12 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(powerProvider != null)
|
||||
{
|
||||
int received = (int)(powerProvider.useEnergy(0, (float)((currentMaxElectricity-electricityStored)*Mekanism.TO_BC), true)*10);
|
||||
setJoules(electricityStored + received);
|
||||
}
|
||||
|
||||
if(!registered && worldObj != null && !worldObj.isRemote)
|
||||
{
|
||||
Mekanism.manager.register(this);
|
||||
|
@ -135,7 +142,7 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
{
|
||||
if(FMLClientHandler.instance().getClient().sndManager.sndSystem != null)
|
||||
{
|
||||
audio = Mekanism.audioHandler.getSound(fullName.replace(" ", ""), soundURL, worldObj, xCoord, yCoord, zCoord);
|
||||
audio = Mekanism.audioHandler.getSound(soundURL, worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -229,6 +229,7 @@ public abstract class TileEntityElectricMachine extends TileEntityBasicMachine
|
|||
currentMaxElectricity = dataStream.readDouble();
|
||||
currentTicksRequired = dataStream.readInt();
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -46,9 +46,6 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
/** Output per tick this machine can transfer. */
|
||||
public int output;
|
||||
|
||||
/** BuildCraft power provider. */
|
||||
public IPowerProvider powerProvider;
|
||||
|
||||
/**
|
||||
* A block used to store and transfer electricity.
|
||||
*/
|
||||
|
@ -68,19 +65,16 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
ElectricityConnections.registerConnector(this, EnumSet.allOf(ForgeDirection.class));
|
||||
inventory = new ItemStack[2];
|
||||
output = i;
|
||||
if(PowerFramework.currentFramework != null)
|
||||
{
|
||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||
powerProvider.configure(0, 2, 2000, 1, (int)(tier.MAX_ELECTRICITY*Mekanism.TO_BC));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(powerProvider != null)
|
||||
{
|
||||
int received = (int)(powerProvider.useEnergy(25, 25, true)*10);
|
||||
int received = (int)(powerProvider.useEnergy(0, (float)((tier.MAX_ELECTRICITY-electricityStored)*Mekanism.TO_BC), true)*10);
|
||||
setJoules(electricityStored + received);
|
||||
}
|
||||
|
||||
|
@ -314,27 +308,6 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
{
|
||||
return tier.MAX_ELECTRICITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPowerProvider(IPowerProvider provider)
|
||||
{
|
||||
powerProvider = provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPowerProvider getPowerProvider()
|
||||
{
|
||||
return powerProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork() {}
|
||||
|
||||
@Override
|
||||
public int powerRequest()
|
||||
{
|
||||
return getPowerProvider().getMaxEnergyReceived();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
|
|
|
@ -14,6 +14,7 @@ import mekanism.api.IMachineUpgrade;
|
|||
import mekanism.api.InfusionInput;
|
||||
import mekanism.api.InfusionOutput;
|
||||
import mekanism.api.InfusionType;
|
||||
import mekanism.client.Sound;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -32,6 +33,10 @@ import universalelectricity.core.vector.Vector3;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
|
||||
|
@ -39,6 +44,10 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
{
|
||||
public static Map<InfusionInput, InfusionOutput> recipes = new HashMap<InfusionInput, InfusionOutput>();
|
||||
|
||||
/** The Sound instance for this machine. */
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Sound audio;
|
||||
|
||||
/** The type of infuse this machine stores. */
|
||||
public InfusionType type = InfusionType.NONE;
|
||||
|
||||
|
@ -86,6 +95,22 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
try {
|
||||
synchronized(Mekanism.audioHandler.sounds)
|
||||
{
|
||||
handleSound();
|
||||
}
|
||||
} catch(NoSuchMethodError e) {}
|
||||
}
|
||||
|
||||
if(powerProvider != null)
|
||||
{
|
||||
int received = (int)(powerProvider.useEnergy(0, (float)((currentMaxElectricity-electricityStored)*Mekanism.TO_BC), true)*10);
|
||||
setJoules(electricityStored + received);
|
||||
}
|
||||
|
||||
boolean testActive = operatingTicks > 0;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
|
@ -257,6 +282,33 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSound()
|
||||
{
|
||||
synchronized(Mekanism.audioHandler.sounds)
|
||||
{
|
||||
if(audio == null && worldObj != null && worldObj.isRemote)
|
||||
{
|
||||
if(FMLClientHandler.instance().getClient().sndManager.sndSystem != null)
|
||||
{
|
||||
audio = Mekanism.audioHandler.getSound("MetallurgicInfuser.ogg", worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if(worldObj != null && worldObj.isRemote && audio != null)
|
||||
{
|
||||
if(!audio.isPlaying && isActive == true)
|
||||
{
|
||||
audio.play();
|
||||
}
|
||||
else if(audio.isPlaying && isActive == false)
|
||||
{
|
||||
audio.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void operate()
|
||||
{
|
||||
if (!canOperate())
|
||||
|
@ -275,7 +327,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
|
||||
if (inventory[3] == null)
|
||||
{
|
||||
inventory[3] = output.resource;
|
||||
inventory[3] = output.resource.copy();
|
||||
}
|
||||
else {
|
||||
inventory[3].stackSize += output.resource.stackSize;
|
||||
|
@ -336,6 +388,17 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
return operatingTicks*i / currentTicksRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
|
||||
if(worldObj.isRemote && audio != null)
|
||||
{
|
||||
audio.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
|
@ -416,6 +479,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
infuseStored = dataStream.readInt();
|
||||
type = InfusionType.getFromName(dataStream.readUTF());
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -78,6 +78,12 @@ public class TileEntitySmeltingFactory extends TileEntityElectricBlock implement
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(powerProvider != null)
|
||||
{
|
||||
int received = (int)(powerProvider.useEnergy(0, (float)((currentMaxElectricity-electricityStored)*Mekanism.TO_BC), true)*10);
|
||||
setJoules(electricityStored + received);
|
||||
}
|
||||
|
||||
boolean testActive = false;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
|
@ -295,7 +301,7 @@ public class TileEntitySmeltingFactory extends TileEntityElectricBlock implement
|
|||
return false;
|
||||
}
|
||||
|
||||
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[inputSlot]).copy();
|
||||
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[inputSlot]);
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
|
@ -359,6 +365,7 @@ public class TileEntitySmeltingFactory extends TileEntityElectricBlock implement
|
|||
}
|
||||
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -32,10 +32,9 @@ public class TileEntityTheoreticalElementizer extends TileEntityAdvancedElectric
|
|||
public static Item getRandomMagicItem()
|
||||
{
|
||||
Random rand = new Random();
|
||||
int random = rand.nextInt(3);
|
||||
if(random == 0) return Mekanism.LightningRod;
|
||||
if(random == 1) return Mekanism.Stopwatch;
|
||||
if(random == 2) return Mekanism.WeatherOrb;
|
||||
int random = rand.nextInt(2);
|
||||
if(random == 0) return Mekanism.Stopwatch;
|
||||
if(random == 1) return Mekanism.WeatherOrb;
|
||||
return Mekanism.EnrichedAlloy;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.IActiveState;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.TileEntityBasicBlock;
|
||||
import mekanism.common.TileEntityElectricBlock;
|
||||
|
@ -113,6 +114,22 @@ public class BlockGenerator extends BlockContainer
|
|||
((IMultiBlock)tileEntity).onCreate(new Vector3(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if(tileEntity instanceof IActiveState && !(tileEntity instanceof TileEntitySolarGenerator))
|
||||
{
|
||||
if(((IActiveState)tileEntity).getActive())
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTextureFromSideAndMetadata(int side, int meta)
|
||||
|
|
|
@ -19,7 +19,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "5.0.4", dependencies = "required-after:Mekanism")
|
||||
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "5.0.7", dependencies = "required-after:Mekanism")
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
|
||||
public class MekanismGenerators
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@ package mekanism.generators.common;
|
|||
|
||||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.client.Sound;
|
||||
import mekanism.common.LiquidSlot;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismUtils;
|
||||
|
@ -21,10 +22,17 @@ import universalelectricity.core.implement.IItemElectric;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
|
||||
public class TileEntityBioGenerator extends TileEntityGenerator implements ITankContainer
|
||||
{
|
||||
/** The Sound instance for this machine. */
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Sound audio;
|
||||
|
||||
/** The LiquidSlot biofuel instance for this generator. */
|
||||
public LiquidSlot bioFuelSlot = new LiquidSlot(24000, Mekanism.hooks.ForestryBiofuelID);
|
||||
|
||||
|
@ -202,6 +210,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements ITank
|
|||
isActive = dataStream.readBoolean();
|
||||
bioFuelSlot.liquidStored = dataStream.readInt();
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -74,6 +74,12 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(powerProvider != null)
|
||||
{
|
||||
int received = (int)(powerProvider.useEnergy(0, (float)((MAX_ELECTRICITY-electricityStored)*Mekanism.TO_BC), true)*10);
|
||||
setJoules(electricityStored + received);
|
||||
}
|
||||
|
||||
if(hydrogenStored > MAX_GAS)
|
||||
{
|
||||
hydrogenStored = MAX_GAS;
|
||||
|
|
|
@ -158,7 +158,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
return output;
|
||||
return 120;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package mekanism.generators.common;
|
|||
|
||||
import ic2.api.ElectricItem;
|
||||
import ic2.api.IElectricItem;
|
||||
import mekanism.client.Sound;
|
||||
import mekanism.common.LiquidSlot;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismUtils;
|
||||
|
@ -22,6 +23,10 @@ import universalelectricity.core.implement.IItemElectric;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
|
||||
public class TileEntityHeatGenerator extends TileEntityGenerator implements ITankContainer
|
||||
|
@ -29,6 +34,10 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
/** The LiquidSlot fuel instance for this generator. */
|
||||
public LiquidSlot fuelSlot = new LiquidSlot(24000, Mekanism.hooks.BuildCraftFuelID);
|
||||
|
||||
/** The Sound instance for this machine. */
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Sound audio;
|
||||
|
||||
public TileEntityHeatGenerator()
|
||||
{
|
||||
super("Heat Generator", 160000, 480);
|
||||
|
@ -40,6 +49,16 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
{
|
||||
super.onUpdate();
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
try {
|
||||
synchronized(Mekanism.audioHandler.sounds)
|
||||
{
|
||||
handleSound();
|
||||
}
|
||||
} catch(NoSuchMethodError e) {}
|
||||
}
|
||||
|
||||
if(inventory[1] != null && electricityStored > 0)
|
||||
{
|
||||
if(inventory[1].getItem() instanceof IItemElectric)
|
||||
|
@ -130,6 +149,33 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSound()
|
||||
{
|
||||
synchronized(Mekanism.audioHandler.sounds)
|
||||
{
|
||||
if(audio == null && worldObj != null && worldObj.isRemote)
|
||||
{
|
||||
if(FMLClientHandler.instance().getClient().sndManager.sndSystem != null)
|
||||
{
|
||||
audio = Mekanism.audioHandler.getSound("HeatGenerator.ogg", worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
if(worldObj != null && worldObj.isRemote && audio != null)
|
||||
{
|
||||
if(!audio.isPlaying && isActive == true)
|
||||
{
|
||||
audio.play();
|
||||
}
|
||||
else if(audio.isPlaying && isActive == false)
|
||||
{
|
||||
audio.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOperate()
|
||||
{
|
||||
|
@ -178,6 +224,17 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
return TileEntityFurnace.getItemBurnTime(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
|
||||
if(worldObj.isRemote && audio != null)
|
||||
{
|
||||
audio.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
@ -214,6 +271,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
|
|||
isActive = dataStream.readBoolean();
|
||||
fuelSlot.liquidStored = dataStream.readInt();
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
|
|
@ -165,7 +165,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
@Override
|
||||
public boolean canOperate()
|
||||
{
|
||||
return electricityStored < MAX_ELECTRICITY && hydrogenStored-10 > 0;
|
||||
return electricityStored < MAX_ELECTRICITY && hydrogenStored-10 > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,6 +216,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
hydrogenStored = dataStream.readInt();
|
||||
isActive = dataStream.readBoolean();
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.updateAllLightTypes(xCoord, yCoord, zCoord);
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.out.println("[Mekanism] Error while handling tile entity packet.");
|
||||
|
@ -254,6 +255,12 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
}
|
||||
return boost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getVoltage()
|
||||
{
|
||||
return 240;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int transferGasToAcceptor(int amount, EnumGas type)
|
||||
|
|
|
@ -26,7 +26,7 @@ import cpw.mods.fml.common.network.NetworkMod;
|
|||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.0.4", dependencies = "required-after:Mekanism")
|
||||
@Mod(modid = "MekanismTools", name = "MekanismTools", version = "5.0.7", dependencies = "required-after:Mekanism")
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
|
||||
public class MekanismTools
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue