v5.5.5 Beta #8

*Gave Solar Generators their own sound.
*Volume multiplier for specific sounds.
*Sound adjustments.
*Better quality tank rendering.
*Fixed Dynamic Tank issues.
This commit is contained in:
Aidan Brady 2013-05-06 19:42:03 -04:00
parent 46033380f2
commit 012223e34c
16 changed files with 115 additions and 23 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

View file

@ -16,4 +16,10 @@ public interface IHasSound
* @return sound path
*/
public String getSoundPath();
/**
* Gets the multiplier to play this sound by.
* @return sound multiplier
*/
public float getVolumeMultiplier();
}

View file

@ -6,7 +6,9 @@ import mekanism.common.Mekanism;
import mekanism.common.BlockMachine.MachineType;
import mekanism.common.Tier.EnergyCubeTier;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
@ -50,6 +52,9 @@ public class ItemRenderingHandler implements IItemRenderer
}
else if(item.getItemDamage() == MachineType.ELECTRIC_CHEST.meta)
{
int performanceToFps = EntityRenderer.performanceToFps(Minecraft.getMinecraft().gameSettings.limitFramerate);
float partialTick = System.nanoTime() + (long)(1000000000 / performanceToFps);
IElectricChest chest = (IElectricChest)item.getItem();
ModelChest electricChest = new ModelChest();
@ -59,7 +64,7 @@ public class ItemRenderingHandler implements IItemRenderer
GL11.glScalef(1.0F, -1F, -1F);
GL11.glBindTexture(3553, FMLClientHandler.instance().getClient().renderEngine.getTexture("/mods/mekanism/render/ElectricChest.png"));
float lidangle = chest.getPrevLidAngle(item) + (chest.getLidAngle(item) - chest.getPrevLidAngle(item)) * 1F;//partialTick;
float lidangle = chest.getPrevLidAngle(item) + (chest.getLidAngle(item) - chest.getPrevLidAngle(item)) * 1F;
lidangle = 1.0F - lidangle;
lidangle = 1.0F - lidangle * lidangle * lidangle;
electricChest.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);

View file

@ -255,7 +255,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
private int getStages(int height)
{
return (height-2)*100;
return (height-2)*1600;
}
private double getX(int x)

View file

@ -137,10 +137,12 @@ public class Sound
{
if(entityplayer != null && tileEntity != null && entityplayer.worldObj == tileEntity.worldObj)
{
float multiplier = ((IHasSound)tileEntity).getVolumeMultiplier();
float volume = 0;
float masterVolume = Mekanism.audioHandler.masterVolume;
double distanceVolume = (entityplayer.getDistanceSq(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord)*0.008);
volume = (float)(Math.max(Mekanism.audioHandler.masterVolume-distanceVolume, 0))*0.05F;
double distance = entityplayer.getDistance(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
volume = (float)Math.min(Math.max(masterVolume-((distance*.08F)*masterVolume), 0)*multiplier, 1);
if(Mekanism.audioHandler.soundSystem != null)
{

View file

@ -1,5 +1,6 @@
package mekanism.common;
import java.util.ArrayList;
import java.util.List;
import mekanism.client.ClientProxy;
@ -177,6 +178,7 @@ public class BlockBasic extends Block
if(!manageInventory(entityplayer, tileEntity))
{
PacketHandler.sendTileEntityPacketToClients(tileEntity, 0, tileEntity.getNetworkedData(new ArrayList()));
entityplayer.openGui(Mekanism.instance, 18, world, x, y, z);
}
else {

View file

@ -377,4 +377,10 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
{
return soundURL;
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
}

View file

@ -2,9 +2,7 @@ package mekanism.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import mekanism.api.Object3D;
import mekanism.common.SynchronizedTankData.ValveData;
@ -12,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
@ -98,6 +97,16 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
if(!clientHasStructure || !isRendering)
{
for(ValveData data : valveViewing.keySet())
{
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)data.location.getTileEntity(worldObj);
if(tileEntity != null)
{
tileEntity.clientHasStructure = false;
}
}
valveViewing.clear();
}
}
@ -127,6 +136,12 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
update();
}
if(structure != null && isRendering && packetTick % 20 == 0)
{
sendStructure = true;
PacketHandler.sendTileEntityPacketToClients(this, 0, getNetworkedData(new ArrayList()));
}
if(prevStructure != (structure != null))
{
if(structure != null && !structure.hasRenderer)
@ -203,7 +218,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
structure.liquidStored = null;
}
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
PacketHandler.sendTileEntityPacketToClients(this, 0, getNetworkedData(new ArrayList()));
}
}
}
@ -262,7 +277,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
}
}
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
PacketHandler.sendTileEntityPacketToClients(this, 0, getNetworkedData(new ArrayList()));
}
}
}
@ -379,6 +394,13 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
}
valveViewing.put(data, viewingTicks);
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)data.location.getTileEntity(worldObj);
if(tileEntity != null)
{
tileEntity.clientHasStructure = true;
}
}
}
}
@ -393,7 +415,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
if(tileEntity != null && tileEntity.isRendering)
{
PacketHandler.sendTileEntityPacketToClients(tileEntity, 50, tileEntity.getNetworkedData(new ArrayList()));
PacketHandler.sendTileEntityPacketToClients(tileEntity, 0, tileEntity.getNetworkedData(new ArrayList()));
}
}
}

View file

@ -16,4 +16,10 @@ public class TileEntityEnrichmentChamber extends TileEntityElectricMachine
{
return Recipe.ENRICHMENT_CHAMBER.get();
}
@Override
public float getVolumeMultiplier()
{
return 0.3F;
}
}

View file

@ -777,4 +777,10 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
{
return RecipeType.values()[recipeType].getSound();
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
}

View file

@ -650,4 +650,10 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
{
return "MetallurgicInfuser.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
}

View file

@ -34,7 +34,7 @@ public class GuiWindTurbine extends GuiContainer
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
fontRenderer.drawString(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), 51, 26, 0x00CD00);
fontRenderer.drawString("Power: " + tileEntity.GENERATION_RATE*tileEntity.getMultiplier(), 51, 35, 0x00CD00);
fontRenderer.drawString("Power: " + tileEntity.GENERATION_RATE*tileEntity.getVolumeMultiplier(), 51, 35, 0x00CD00);
fontRenderer.drawString(tileEntity.getVoltage() + "v", 51, 44, 0x00CD00);
int size = 44;
@ -65,6 +65,6 @@ public class GuiWindTurbine extends GuiContainer
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
drawTexturedModalRect(guiWidth + 20, guiHeight + 37, 176, (tileEntity.getMultiplier() > 0 ? 52 : 64), 12, 12);
drawTexturedModalRect(guiWidth + 20, guiHeight + 37, 176, (tileEntity.getVolumeMultiplier() > 0 ? 52 : 64), 12, 12);
}
}

View file

@ -77,10 +77,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
if(worldObj.isRemote)
{
if(!(this instanceof TileEntitySolarGenerator))
{
Mekanism.proxy.registerSound(this);
}
Mekanism.proxy.registerSound(this);
}
if(!worldObj.isRemote)
@ -349,6 +346,12 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
@Override
public String getSoundPath()
{
return fullName.replace(" ", "").replace("-","") + ".ogg";
return fullName.replace(" ", "").replace("-","").replace("Advanced", "") + ".ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
}

View file

@ -4,9 +4,11 @@ import ic2.api.item.IElectricItem;
import java.util.ArrayList;
import mekanism.api.Object3D;
import mekanism.common.ChargeUtils;
import mekanism.generators.common.BlockGenerator.GeneratorType;
import micdoodle8.mods.galacticraft.API.ISolarLevel;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.item.IItemElectric;
@ -43,6 +45,12 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
return new int[] {0};
}
@Override
public float getVolumeMultiplier()
{
return 0.05F;
}
@Override
public int getSizeInventorySide(ForgeDirection side)
{
@ -72,15 +80,29 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
seesSun = false;
}
if(worldObj.getBlockId(xCoord, yCoord+1, zCoord) == MekanismGenerators.generatorID && worldObj.getBlockMetadata(xCoord, yCoord+1, zCoord) == GeneratorType.SOLAR_GENERATOR.meta)
for(int y = yCoord+1; y < 256; y++)
{
seesSun = false;
Object3D obj = new Object3D(xCoord, y, zCoord);
Block block = Block.blocksList[obj.getBlockId(worldObj)];
if(block != null)
{
if(block.isOpaqueCube() || block.blockID == MekanismGenerators.generatorID && obj.getMetadata(worldObj) == GeneratorType.SOLAR_GENERATOR.meta)
{
seesSun = false;
break;
}
}
}
if(canOperate())
{
setActive(true);
setEnergy(electricityStored + getEnvironmentBoost());
}
else {
setActive(false);
}
}
if(canOperate())
{
setEnergy(electricityStored + getEnvironmentBoost());
}
}

View file

@ -47,6 +47,12 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
{
return worldObj.canBlockSeeTheSky(xCoord, yCoord+4, zCoord) ? (((float)yCoord+4)/(float)256)*8 : 0;
}
@Override
public float getVolumeMultiplier()
{
return 1.5F;
}
@Override
public String[] getMethodNames()