v5.5.5 Release

*Added Easter Egg in Dynamic Tank.
*Refactored liquid/energy rendering management.
*Animation for when Dynamic Tank is created.
*Enhanced Dynamic Tank calculation.
This commit is contained in:
Aidan Brady 2013-05-14 11:34:26 -04:00
parent b7c1a7afc6
commit 9cb7a893c9
22 changed files with 263 additions and 50 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
package mekanism.api;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
/**
* The gasses currently available in Mekanism.
@ -14,7 +14,7 @@ public enum EnumGas
HYDROGEN("Hydrogen", null, null);
public String name;
public Item gasItem;
public Icon gasIcon;
public String texturePath;
public static EnumGas getFromName(String gasName)
@ -33,13 +33,13 @@ public enum EnumGas
public boolean hasTexture()
{
return gasItem != null && texturePath != null;
return gasIcon != null && texturePath != null;
}
private EnumGas(String s, Item item, String path)
private EnumGas(String s, Icon icon, String path)
{
name = s;
gasItem = item;
gasIcon = icon;
texturePath = path;
}
}

View file

@ -3,6 +3,7 @@ package mekanism.client;
import java.util.HashMap;
import mekanism.api.EnumGas;
import mekanism.common.CommonProxy;
import mekanism.common.EntityObsidianTNT;
import mekanism.common.IElectricChest;
@ -178,6 +179,18 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerBlockHandler(new TransmitterRenderer());
RenderingRegistry.registerBlockHandler(new BasicRenderingHandler());
if(!EnumGas.HYDROGEN.hasTexture())
{
EnumGas.HYDROGEN.gasIcon = FMLClientHandler.instance().getClient().renderEngine.textureMapItems.registerIcon("mekanism:LiquidHydrogen");
EnumGas.HYDROGEN.texturePath = "/mods/mekanism/textures/items/LiquidHydrogen.png";
}
if(!EnumGas.OXYGEN.hasTexture())
{
EnumGas.OXYGEN.gasIcon = FMLClientHandler.instance().getClient().renderEngine.textureMapItems.registerIcon("mekanism:LiquidOxygen");
EnumGas.OXYGEN.texturePath = "/mods/mekanism/textures/items/LiquidOxygen.png";
}
System.out.println("[Mekanism] Render registrations complete.");
}
@ -238,6 +251,12 @@ public class ClientProxy extends CommonProxy
return null;
}
@Override
public void doTankAnimation(TileEntityDynamicTank tileEntity)
{
new ThreadTankSparkle(tileEntity).start();
}
@Override
public void loadUtilities()
{
@ -245,6 +264,7 @@ public class ClientProxy extends CommonProxy
TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(new ClientPlayerTickHandler(), Side.CLIENT);
TickRegistry.registerTickHandler(new RenderTickHandler(), Side.CLIENT);
NetworkRegistry.instance().registerConnectionHandler(new ClientConnectionHandler());
}

View file

@ -39,7 +39,7 @@ public class ItemRenderingHandler implements IItemRenderer
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
if(type == ItemRenderType.EQUIPPED)
if(type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
@ -62,7 +62,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;
float lidangle = chest.getPrevLidAngle(item) + (chest.getLidAngle(item) - chest.getPrevLidAngle(item)) * Minecraft.getMinecraft().timer.renderPartialTicks;
lidangle = 1.0F - lidangle;
lidangle = 1.0F - lidangle * lidangle * lidangle;
electricChest.chestLid.rotateAngleX = -((lidangle * 3.141593F) / 2.0F);

View file

@ -105,7 +105,7 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
Model3D toReturn = new Model3D();
toReturn.baseBlock = Block.waterStill;
toReturn.texture = type.gasItem.getIconFromDamage(0);
toReturn.texture = type.gasIcon;
int[] displays = new int[stages];

View file

@ -0,0 +1,76 @@
package mekanism.client;
import java.util.EnumSet;
import mekanism.api.Object3D;
import mekanism.common.MekanismUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public class RenderTickHandler implements ITickHandler
{
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData)
{
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
Minecraft mc = FMLClientHandler.instance().getClient();
if(mc.currentScreen == null && mc.thePlayer != null && mc.theWorld != null && !MekanismUtils.isObfuscated())
{
EntityPlayer player = mc.thePlayer;
World world = mc.theWorld;
FontRenderer font = mc.fontRenderer;
MovingObjectPosition pos = player.rayTrace(40.0D, 1.0F);
if(pos != null)
{
int x = MathHelper.floor_double(pos.blockX);
int y = MathHelper.floor_double(pos.blockY);
int z = MathHelper.floor_double(pos.blockZ);
Object3D obj = new Object3D(x, y, z);
String tileDisplay = "no";
if(obj.getTileEntity(world) != null)
{
if(obj.getTileEntity(world).getClass() != null)
{
tileDisplay = obj.getTileEntity(world).getClass().getSimpleName();
}
}
font.drawStringWithShadow("Block ID: " + obj.getBlockId(world), 1, 1, 0x404040);
font.drawStringWithShadow("Metadata: " + obj.getMetadata(world), 1, 10, 0x404040);
font.drawStringWithShadow("TileEntity: " + tileDisplay, 1, 19, 0x404040);
}
}
}
@Override
public EnumSet<TickType> ticks()
{
return EnumSet.of(TickType.RENDER);
}
@Override
public String getLabel()
{
return "MekanismRender";
}
}

View file

@ -11,13 +11,13 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -28,6 +28,8 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
private HashMap<ForgeDirection, int[]> cachedLiquids = new HashMap<ForgeDirection, int[]>();
private Icon renderIcon = FMLClientHandler.instance().getClient().renderEngine.textureMapItems.registerIcon("mekanism:LiquidEnergy");
private static final int stages = 40;
private static final double offset = 0.015;
@ -126,7 +128,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
Model3D toReturn = new Model3D();
toReturn.baseBlock = Block.waterStill;
toReturn.texture = Mekanism.LiquidEnergy.getIconFromDamage(0);
toReturn.texture = renderIcon;
int[] displays = new int[stages];

View file

@ -47,6 +47,7 @@ public class Sound
tileEntity = tileentity;
URL url = getClass().getClassLoader().getResource("mods/mekanism/sound/" + sound);
if(url == null)
{
System.out.println("[Mekanism] Invalid sound file: " + sound);
@ -80,6 +81,7 @@ public class Sound
updateVolume(FMLClientHandler.instance().getClient().thePlayer);
Mekanism.audioHandler.soundSystem.play(identifier);
}
isPlaying = true;
}
}
@ -101,6 +103,7 @@ public class Sound
updateVolume(FMLClientHandler.instance().getClient().thePlayer);
Mekanism.audioHandler.soundSystem.stop(identifier);
}
isPlaying = false;
}
}

View file

@ -1,11 +1,13 @@
package mekanism.client;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import mekanism.api.Object3D;
import mekanism.common.IActiveState;
import mekanism.common.Mekanism;
import net.minecraft.tileentity.TileEntity;
@ -190,6 +192,25 @@ public class SoundHandler
}
}
/**
* Plays a sound in a specific location.
* @param soundPath - sound path to play
* @param world - world to play in
* @param object - location to play
*/
public void quickPlay(String soundPath, World world, Object3D object)
{
URL url = getClass().getClassLoader().getResource("mods/mekanism/sound/" + soundPath);
if(url == null)
{
System.out.println("[Mekanism] Invalid sound file: " + soundPath);
}
String s = soundSystem.quickPlay(false, url, soundPath, false, object.xCoord, object.yCoord, object.zCoord, 0, 16F);
soundSystem.setVolume(s, masterVolume);
}
@ForgeSubscribe
public void onChunkUnload(ChunkEvent.Unload event)
{

View file

@ -0,0 +1,87 @@
package mekanism.client;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import mekanism.api.Object3D;
import mekanism.common.Mekanism;
import mekanism.common.TileEntityDynamicTank;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
public class ThreadTankSparkle extends Thread
{
public TileEntityDynamicTank pointer;
public Random random = new Random();
public Set<TileEntity> iteratedNodes = new HashSet<TileEntity>();
public ThreadTankSparkle(TileEntityDynamicTank tileEntity)
{
pointer = tileEntity;
}
@Override
public void run()
{
if(Mekanism.dynamicTankEasterEgg)
{
Mekanism.audioHandler.quickPlay("cj/CJ_" + (random.nextInt(3)+1) + ".ogg", pointer.worldObj, Object3D.get(pointer));
}
loop(pointer);
}
public void loop(TileEntityDynamicTank tileEntity)
{
World world = pointer.worldObj;
for(int i = 0; i < 6; i++)
{
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord-1, tileEntity.zCoord) == 0)
{
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + -.01, tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
}
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord+1, tileEntity.zCoord) == 0)
{
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + 1.01, tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
}
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord-1) == 0)
{
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + -.01, 0, 0, 0);
}
if(world.getBlockId(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord+1) == 0)
{
world.spawnParticle("reddust", tileEntity.xCoord + random.nextDouble(), tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + 1.01, 0, 0, 0);
}
if(world.getBlockId(tileEntity.xCoord-1, tileEntity.yCoord, tileEntity.zCoord) == 0)
{
world.spawnParticle("reddust", tileEntity.xCoord + -.01, tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
}
if(world.getBlockId(tileEntity.xCoord+1, tileEntity.yCoord, tileEntity.zCoord) == 0)
{
world.spawnParticle("reddust", tileEntity.xCoord + 1.01, tileEntity.yCoord + random.nextDouble(), tileEntity.zCoord + random.nextDouble(), 0, 0, 0);
}
}
iteratedNodes.add(tileEntity);
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tile = Object3D.get(tileEntity).getFromSide(side).getTileEntity(pointer.worldObj);
if(tile instanceof TileEntityDynamicTank && !iteratedNodes.contains(tile))
{
loop((TileEntityDynamicTank)tile);
}
}
}
}

View file

@ -91,7 +91,8 @@ public class CommonProxy
Mekanism.disableBCBronzeCrafting = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DisableBCBronzeCrafting", false).getBoolean(true);
Mekanism.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(true);
Mekanism.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(true);
Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(false);
Mekanism.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(true);
Mekanism.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean(true);
Mekanism.obsidianTNTDelay = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTDelay", 100).getInt();
Mekanism.obsidianTNTBlastRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ObsidianTNTBlastRadius", 12).getInt();
Mekanism.FROM_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToEU", 10).getDouble(10);
@ -128,6 +129,11 @@ public class CommonProxy
return false;
}
/**
* Does the Dynamic Tank creation animation, starting from the rendering block.
*/
public void doTankAnimation(TileEntityDynamicTank tileEntity) {}
/**
* Get the actual interface for a GUI. Client-only.
* @param ID - gui ID

View file

@ -139,9 +139,6 @@ public class Mekanism
public static Item PortableTeleporter;
public static Item TeleportationCore;
public static Item Configurator;
public static Item LiquidEnergy;
public static Item LiquidHydrogen;
public static Item LiquidOxygen;
//Blocks
public static Block BasicBlock;
@ -168,6 +165,7 @@ public class Mekanism
public static boolean enableSounds = true;
public static boolean controlCircuitOreDict = true;
public static boolean logPackets = false;
public static boolean dynamicTankEasterEgg = false;
public static int obsidianTNTBlastRadius = 12;
public static int obsidianTNTDelay = 100;
public static double TO_IC2;
@ -453,9 +451,6 @@ public class Mekanism
LanguageRegistry.addName(PortableTeleporter, "Portable Teleporter");
LanguageRegistry.addName(TeleportationCore, "Teleportation Core");
LanguageRegistry.addName(Configurator, "Configurator");
LanguageRegistry.addName(LiquidEnergy, "Liquid Energy");
LanguageRegistry.addName(LiquidHydrogen, "Liquid Hydrogen");
LanguageRegistry.addName(LiquidOxygen, "Liquid Oxygen");
//Localization for BasicBlock
LanguageRegistry.instance().addStringLocalization("tile.BasicBlock.OsmiumBlock.name", "Osmium Block");
@ -560,7 +555,7 @@ public class Mekanism
EnergyTablet = (ItemEnergized) new ItemEnergized(configuration.getItem("EnergyTablet", 11206).getInt(), 1000000, 120).setUnlocalizedName("EnergyTablet");
SpeedUpgrade = new ItemMachineUpgrade(configuration.getItem("SpeedUpgrade", 11207).getInt(), 0, 150).setUnlocalizedName("SpeedUpgrade");
EnergyUpgrade = new ItemMachineUpgrade(configuration.getItem("EnergyUpgrade", 11208).getInt(), 1000, 0).setUnlocalizedName("EnergyUpgrade");
LiquidEnergy = new ItemMekanism(configuration.getItem("LiquidEnergy", 11209).getInt()).setUnlocalizedName("LiquidEnergy").setCreativeTab(null);
//Free ID...again :(
AtomicDisassembler = (ItemAtomicDisassembler) new ItemAtomicDisassembler(configuration.getItem("AtomicDisassembler", 11210).getInt()).setUnlocalizedName("AtomicDisassembler");
AtomicCore = new ItemMekanism(configuration.getItem("AtomicCore", 11211).getInt()).setUnlocalizedName("AtomicCore");
EnrichedAlloy = new ItemMekanism(configuration.getItem("EnrichedAlloy", 11212).getInt()).setUnlocalizedName("EnrichedAlloy");
@ -573,8 +568,6 @@ public class Mekanism
Clump = new ItemClump(configuration.getItem("Clump", 11219).getInt()-256);
DirtyDust = new ItemDirtyDust(configuration.getItem("DirtyDust", 11220).getInt()-256);
Configurator = new ItemConfigurator(configuration.getItem("Configurator", 11221).getInt()).setUnlocalizedName("Configurator");
LiquidHydrogen = new ItemMekanism(configuration.getItem("LiquidHydrogen", 11222).getInt()).setUnlocalizedName("LiquidHydrogen").setCreativeTab(null);
LiquidOxygen = new ItemMekanism(configuration.getItem("LiquidOxygen", 11223).getInt()).setUnlocalizedName("LiquidOxygen").setCreativeTab(null);
configuration.save();
//Registrations
@ -591,7 +584,6 @@ public class Mekanism
GameRegistry.registerItem(EnergyTablet, "EnergyTablet");
GameRegistry.registerItem(SpeedUpgrade, "SpeedUpgrade");
GameRegistry.registerItem(EnergyUpgrade, "EnergyUpgrade");
GameRegistry.registerItem(LiquidEnergy, "LiquidEnergy");
GameRegistry.registerItem(AtomicDisassembler, "AtomicDisassembler");
GameRegistry.registerItem(AtomicCore, "AtomicCore");
GameRegistry.registerItem(EnrichedAlloy, "EnrichedAlloy");
@ -604,8 +596,6 @@ public class Mekanism
GameRegistry.registerItem(Clump, "Clump");
GameRegistry.registerItem(DirtyDust, "DirtyDust");
GameRegistry.registerItem(Configurator, "Configurator");
GameRegistry.registerItem(LiquidHydrogen, "LiquidHydrogen");
GameRegistry.registerItem(LiquidOxygen, "LiquidOxygen");
}
/**
@ -1036,18 +1026,6 @@ public class Mekanism
addIntegratedItems();
if(!EnumGas.HYDROGEN.hasTexture())
{
EnumGas.HYDROGEN.gasItem = LiquidHydrogen;
EnumGas.HYDROGEN.texturePath = "/mods/mekanism/textures/items/LiquidHydrogen.png";
}
if(!EnumGas.OXYGEN.hasTexture())
{
EnumGas.OXYGEN.gasItem = LiquidOxygen;
EnumGas.OXYGEN.texturePath = "/mods/mekanism/textures/items/LiquidOxygen.png";
}
System.out.println("[Mekanism] Hooking complete.");
proxy.loadSoundHandler();

View file

@ -783,6 +783,15 @@ public final class MekanismUtils
}
}
/**
* Whether or not this mod is in an obfuscated environment.
* @return if the mod is in an obfuscated environment
*/
public static boolean isObfuscated()
{
return !World.class.getSimpleName().equals("World");
}
/**
* Grabs a unique inventory ID for a dynamic tank.
* @return unique inventory ID

View file

@ -317,6 +317,7 @@ public class PacketHandler implements IPacketHandler
int id = dataStream.readInt();
int windowId = dataStream.readInt();
boolean isBlock = dataStream.readBoolean();
int x = 0;
int y = 0;
int z = 0;

View file

@ -25,9 +25,6 @@ public class TankUpdateProtocol
/** The original block the calculation is getting run from. */
public TileEntity pointer;
/** If the pointer is not a part of any actual dynamic tank. */
public boolean pointerNotPartOf;
public TankUpdateProtocol(TileEntity tileEntity)
{
pointer = tileEntity;
@ -204,9 +201,6 @@ public class TankUpdateProtocol
structureFound = structure;
return;
}
else {
pointerNotPartOf = true;
}
}
}
@ -368,6 +362,19 @@ public class TankUpdateProtocol
if(structureFound != null)
{
for(TileEntityDynamicTank tileEntity : iteratedNodes)
{
if(!structureFound.locations.contains(Object3D.get(tileEntity)))
{
for(TileEntity tile : iteratedNodes)
{
((TileEntityDynamicTank)tileEntity).structure = null;
}
return;
}
}
int idFound = -1;
for(Object3D obj : structureFound.locations)
@ -407,8 +414,7 @@ public class TankUpdateProtocol
tileEntity.inventory = cache.inventory;
}
}
else if(!pointerNotPartOf)
{
else {
for(TileEntity tileEntity : iteratedNodes)
{
((TileEntityDynamicTank)tileEntity).structure = null;

View file

@ -93,8 +93,15 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
valveViewing.put(data, valveViewing.get(data)-1);
}
}
if(!prevStructure)
{
Mekanism.proxy.doTankAnimation(this);
}
}
prevStructure = clientHasStructure;
if(!clientHasStructure || !isRendering)
{
for(ValveData data : valveViewing.keySet())

View file

@ -114,7 +114,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
@Override
public int getRenderId()
{
return GeneratorsClientProxy.RENDER_ID;
return GeneratorsClientProxy.GENERATOR_RENDER_ID;
}
/**

View file

@ -20,7 +20,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GeneratorsClientProxy extends GeneratorsCommonProxy
{
public static int RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
public static int GENERATOR_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void registerSpecialTileEntities()

View file

@ -475,7 +475,7 @@ public class BlockGenerator extends BlockContainer
@SideOnly(Side.CLIENT)
public int getRenderType()
{
return GeneratorsClientProxy.RENDER_ID;
return GeneratorsClientProxy.GENERATOR_RENDER_ID;
}
/*This method is not used, metadata manipulation is required to create a Tile Entity.*/

View file

@ -38,9 +38,6 @@ public class NEIMekanismConfig implements IConfigureNEI
API.setGuiOffset(GuiMetallurgicInfuser.class, 5, 15);
API.hideItem(Mekanism.boundingBlockID);
API.hideItem(Mekanism.LiquidEnergy.itemID);
API.hideItem(Mekanism.LiquidHydrogen.itemID);
API.hideItem(Mekanism.LiquidOxygen.itemID);
}
@Override