Started working on Tesla
This commit is contained in:
parent
6048c94d6d
commit
dfe0830968
8 changed files with 126 additions and 27 deletions
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import resonantinduction.base.BlockBase;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class BlockTesla extends BlockBase
|
||||
{
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param id
|
||||
* @param material
|
||||
*/
|
||||
public BlockTesla(String name, int id, Material material)
|
||||
{
|
||||
super(name, id, material);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,9 @@ package resonantinduction;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.render.RenderTesla;
|
||||
import resonantinduction.tesla.TileEntityTesla;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
|
@ -12,6 +15,12 @@ import net.minecraft.world.World;
|
|||
*/
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@Override
|
||||
public void registerRenderers()
|
||||
{
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTesla.class, new RenderTesla());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,10 @@ import cpw.mods.fml.common.network.IGuiHandler;
|
|||
*/
|
||||
public class CommonProxy implements IGuiHandler
|
||||
{
|
||||
public void registerRenderers()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
|
|
|
@ -6,6 +6,8 @@ import java.util.logging.Logger;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.tesla.BlockTesla;
|
||||
import resonantinduction.tesla.TileEntityTesla;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
@ -17,6 +19,7 @@ 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.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
/**
|
||||
|
@ -102,6 +105,11 @@ public class ResonantInduction
|
|||
CONFIGURATION.load();
|
||||
blockTesla = new BlockTesla(getNextBlockID());
|
||||
CONFIGURATION.save();
|
||||
|
||||
GameRegistry.registerBlock(blockTesla, blockTesla.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityTesla.class, blockTesla.getUnlocalizedName());
|
||||
this.proxy.registerRenderers();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
32
src/resonantinduction/base/TileEntityBase.java
Normal file
32
src/resonantinduction/base/TileEntityBase.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction.base;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class TileEntityBase extends TileEntity
|
||||
{
|
||||
protected long ticks = 0;
|
||||
|
||||
public void initiate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (this.ticks++ == 0)
|
||||
{
|
||||
this.initiate();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
30
src/resonantinduction/render/RenderTesla.java
Normal file
30
src/resonantinduction/render/RenderTesla.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction.render;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class RenderTesla extends TileEntitySpecialRenderer
|
||||
{
|
||||
public static final ModelBase MODEL;
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
MODEL.render(0.0625f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
28
src/resonantinduction/tesla/BlockTesla.java
Normal file
28
src/resonantinduction/tesla/BlockTesla.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction.tesla;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.base.BlockBase;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class BlockTesla extends BlockBase implements ITileEntityProvider
|
||||
{
|
||||
public BlockTesla(int id)
|
||||
{
|
||||
super("tesla", id, Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileEntityTesla();
|
||||
}
|
||||
}
|
15
src/resonantinduction/tesla/TileEntityTesla.java
Normal file
15
src/resonantinduction/tesla/TileEntityTesla.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package resonantinduction.tesla;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class TileEntityTesla extends TileEntity
|
||||
{
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue