Skip to content

Instantly share code, notes, and snippets.

@mDiyo
mDiyo / gist:4968946
Created February 16, 2013 22:10
Skyla Model
package tinker.tconstruct.client.entityrender;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import tinker.tconstruct.client.tmt.ModelRendererTurbo;
public class SkylaModel extends ModelBase
{
ModelRenderer Head;
@mDiyo
mDiyo / gist:4969609
Last active December 13, 2015 20:28
Gui Handler
/* Base Block */
public abstract class InventoryBlock extends BlockContainer
{
protected InventoryBlock(int id, Material material)
{
super(id, material);
}
/* Logic backend */
public TileEntity createNewTileEntity (World var1) { return null; }
@mDiyo
mDiyo / gist:4974919
Created February 18, 2013 03:14
Armor Model Interface
package net.minecraftforge.common;
import net.minecraft.client.model.ModelBiped;
/**
* This interface has to be implemented by an instance of ItemArmor.
* It allows for the application of a custom model file to the player skin
* when the armor is worn.
*/
public interface IArmorModelProvider
{
@mDiyo
mDiyo / gist:4976001
Created February 18, 2013 08:51
Inventory Block Render
private void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
@mDiyo
mDiyo / gist:4981240
Created February 18, 2013 22:11
Liquid Tank Example
public class LavaTankLogic extends TileEntity
implements ILiquidTank
{
public LiquidTank tank;
public int max;
public int pressure;
public LiquidStack liquid;
public LavaTankLogic()
{
@mDiyo
mDiyo / gist:4991168
Created February 19, 2013 23:18
Gui Button to Packet
//Button
protected void actionPerformed (GuiButton button)
{
if (button.id == 0)
{
patternIndex++;
if (patternIndex > TContent.patternOutputs.length - 1)
patternIndex = 0;
}
else if (button.id == 1)
@mDiyo
mDiyo / gist:4993441
Last active December 13, 2015 23:39
Description Packet
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
readCustomNBT(tags);
}
public void readNetworkNBT(NBTTagCompound tags)
{
//Anything that needs synced in here
}
@mDiyo
mDiyo / gist:5125931
Created March 9, 2013 21:59
Colored tooltip
/* Tags and information about the tool */
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (!stack.hasTagCompound())
return;
NBTTagCompound tags = stack.getTagCompound();
if (tags.hasKey("charge"))
@mDiyo
mDiyo / gist:5126313
Last active December 14, 2015 17:59
Icon base code
public Icon[] icons;
public abstract String[] getTextureNames();
public void updateIcons(IconRegister iconRegister)
{
String[] textureNames = getTextureNames();
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
@mDiyo
mDiyo / gist:5178634
Created March 16, 2013 22:39
Basic Item for Icons and Names
public class CraftingItem extends Item
{
public String[] textureNames;
public String[] unlocalizedNames;
public String folder;
public Icon[] icons;
public CraftingItem(int id, String[] names, String[] tex, String f)
{
super(id);
this.setCreativeTab(TConstruct.materialTab);