Member
Level 1
New Miner
0

Forum Posts

1 - 4 of 4

    Windspar
    11/18/2016 10:30 pm
    Level 1 : New Miner
    Yes you can teach yourself. I say learn java if that what you want to use. Learning another then come to this make double the work in learning the syntax.

    I taught myself. I started with commodore64 basic 2.0, then move to qbasic, then went c, c++ , D, and python. Just started learning java, rust.

    http://www.learnjavaonline.org/en/Hello%2C_World%21
    This is teaching the basic of programming.
    Experience programmer won't need this.

    Programming is just pushing number and characters with commands.

    Simply programming has
    Variables ,
    Loops,
    Logic,
    Objects (Containers)

    Then you choose use Terminal (built in) or GUI (Graphic User Interface)
    Each program languages has there own entry point.

    To learn programming you need to ask question and show work.
    You also need to type it out. Not copy and paste.

    Have Fun.
    1
    Windspar
    11/10/2016 9:21 am
    Level 1 : New Miner
    Nevermine I figure it out.

    My BlockLanternMeta
    [code]package wolff.lanterns;

    import java.util.Random;
    import java.util.List;

    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.block.material.Material;
    import net.minecraft.block.Block;
    import net.minecraft.world.World;
    import net.minecraft.item.Item;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.IIcon;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;

    class BlockLanternMeta extends Block {
    public static final CreativeTabs tabLantern = new CreativeTabs("Lanterns") {
    @Override public Item getTabIconItem() {
    return Items.redstone;
    }
    };

    private IIcon[] textures;
    private final String[] lanternsNames;

    public BlockLanternMeta(String[] names, String blockname) {
    super(Material.redstoneLight);
    this.setStepSound(Block.soundTypeStone);
    this.setHardness(5);
    this.setResistance(15);
    this.setLightLevel(0.9375F);
    this.setHarvestLevel("pickaxe", 0);
    this.setLightOpacity(0);
    this.setCreativeTab(tabLantern);
    this.setBlockName(blockname + "Lantern");

    this.lanternsNames = names;
    }

    @Override
    public boolean renderAsNormalBlock() {
    return false;
    }

    @Override
    public boolean isBlockNormalCube() {
    return false;
    }

    @Override
    public boolean isOpaqueCube() {
    return false;
    }

    @Override
    public int getRenderType() {
    return ClientProxy.renderLanternID;
    }

    @Override
    public void randomDisplayTick(World world, int x, int y, int z, Random par5) {
    double xx = x + 0.5f;
    double yy = y + 0.50f;
    double zz = z + 0.5f;

    // world.spawnParticle("smoke", xx, yy, zz, 0.0d, 0.0d, 0.0d);
    world.spawnParticle("flame", xx, yy, zz, 0.0d, 0.0d, 0.0d);
    }

    @Override
    public void registerBlockIcons(IIconRegister iconRegister) {
    textures = new IIcon[lanternsNames.length];

    for (int i = 0; i < lanternsNames.length; ++i) {
    textures[i] = iconRegister.registerIcon("UndergroundBiomes:" + lanternsNames[i]);
    }
    }

    @Override
    public IIcon getIcon(int side, int meta) {
    if (meta < 0 || meta >= textures.length) {
    meta = 0;
    }

    return textures[meta];
    }

    @Override
    @SideOnly(Side.CLIENT)
    public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list) {
    for (int i = 0; i < lanternsNames.length; ++i) {
    list.add(new ItemStack(block, 1, i));
    }
    }

    @Override
    public int damageDropped(int meta) {
    return meta & (lanternsNames.length - 1);
    }
    }
    [/code]
    my ItemBlockLantern
    [code]package wolff.lanterns;

    import net.minecraft.block.Block;
    import net.minecraft.item.ItemBlockWithMetadata;
    import net.minecraft.item.ItemStack;

    public class ItemBlockLantern extends ItemBlockWithMetadata {
    public ItemBlockLantern(Block block) {
    super(block, block);
    }

    @Override
    public String getUnlocalizedName(ItemStack stack) {
    return this.getUnlocalizedName() + "_" + stack.getItemDamage();
    }
    }
    [/code]
    my LanternProxy
    [code]package wolff.lanterns;

    import net.minecraft.block.Block;
    import cpw.mods.fml.common.registry.GameRegistry;

    public final class LanternProxy {
    public static Block igneousCobbleLantern;
    public static Block igneousStoneLantern;
    public static Block igneousBrickLantern;
    public static Block metamorphCobbleLantern;
    public static Block metamorphStoneLantern;
    public static Block metamorphBrickLantern;
    public static Block sedimentLantern;

    private static final String[] igneousStone = new String[] {
    "redGranite", "blackGranite", "rhyolite", "andesite", "gabbro", "basalt", "komatiite", "dacite"
    };

    private static final String[] metamorphicStone = new String[] {
    "gneiss", "eclogite", "marble", "quartzite", "blueschist", "greenschist", "soapstone", "migmatite"
    };

    private static final String[] sedimentaryStone = new String[] {
    "limestone", "chalk", "shale", "siltstone", "dolomite", "greywacke", "chert"
    };

    private static final String[] igneousCobble = combineString(igneousStone, "Cobble");
    private static final String[] igneousBrick = combineString(igneousStone, "Brick");
    private static final String[] metamorphicCobble = combineString(metamorphicStone, "Cobble");
    private static final String[] metamorphicBrick = combineString(metamorphicStone, "Brick");

    private static String[] combineString(String[] array, String string) {
    String[] stringlist = new String[array.length];
    for (int i = 0; i < array.length; ++i) {
    stringlist[i] = array[i] + string;
    }
    return stringlist;
    }

    public static final void init(boolean isUnderground, boolean isRailcraft) {
    if(isUnderground) {
    GameRegistry.registerBlock(igneousStoneLantern = new BlockLanternMeta(igneousStone, "igneous"), ItemBlockLantern.class, "igneous");
    GameRegistry.registerBlock(igneousCobbleLantern = new BlockLanternMeta(igneousCobble, "igneousCobble"), ItemBlockLantern.class, "igneousCobble");
    GameRegistry.registerBlock(igneousBrickLantern = new BlockLanternMeta(igneousBrick, "igneousBrick"), ItemBlockLantern.class, "igneousBrick");
    GameRegistry.registerBlock(metamorphStoneLantern = new BlockLanternMeta(metamorphicStone, "metamorphic"), ItemBlockLantern.class, "metamorphic");
    GameRegistry.registerBlock(metamorphCobbleLantern = new BlockLanternMeta(metamorphicCobble, "metamorphicCobble"), ItemBlockLantern.class, "metamorphicCobble");
    GameRegistry.registerBlock(metamorphBrickLantern = new BlockLanternMeta(metamorphicBrick, "metamorphicBrick"), ItemBlockLantern.class, "metamorphicBrick");
    GameRegistry.registerBlock(sedimentLantern = new BlockLanternMeta(sedimentaryStone, "sedimentary"), ItemBlockLantern.class, "sedimentary");
    }
    }

    }
    [/code]
    1
    Windspar
    11/09/2016 10:01 am
    Level 1 : New Miner
    Now trying to figure out. How to set metadata. Using texture from UndergroundBioimesConstruct.
    package wolff.lanterns;

    import java.util.Random;

    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.world.World;

    class BlockLantern extends Block {

    public BlockLantern() {
    super(Material.redstoneLight);
    this.setStepSound(Block.soundTypeStone);
    this.setHardness(5);
    this.setResistance(15);
    this.setLightLevel(0.9375F);
    this.setHarvestLevel("pickaxe", 0);
    this.setLightOpacity(0);
    }

    @Override
    public boolean renderAsNormalBlock() {
    return false;
    }

    @Override
    public boolean isBlockNormalCube() {
    return false;
    }

    @Override
    public boolean isOpaqueCube() {
    return false;
    }

    @Override
    public int getRenderType() {
    return ClientProxy.renderLanternID;
    }

    @Override
    public void randomDisplayTick(World world, int x, int y, int z, Random par5) {
    double xx = x + 0.5f;
    double yy = y + 0.50f;
    double zz = z + 0.5f;

    // world.spawnParticle("smoke", xx, yy, zz, 0.0d, 0.0d, 0.0d);
    world.spawnParticle("flame", xx, yy, zz, 0.0d, 0.0d, 0.0d);
    }
    }


    package wolff.lanterns;

    import net.minecraft.block.Block;
    import cpw.mods.fml.common.registry.GameRegistry;
    import net.minecraft.creativetab.CreativeTabs;

    class RedGraniteCobble extends BlockLantern {

    public RedGraniteCobble() {
    super();
    this.setBlockTextureName("UndergroundBiomes:redGraniteCobble");
    this.setBlockName("RedGraniteCobbleLantern");
    this.setCreativeTab(CreativeTabs.tabBlock);
    }
    }
    1
    Windspar
    11/09/2016 9:57 am
    Level 1 : New Miner
    Figure out how to renderInventoryBlock. Read so much code. That my eyes hurt.
    package wolff.lanterns;

    // import net.minecraftforge.client.IItemRenderer.ItemRenderType;
    import net.minecraft.block.Block;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.RenderBlocks;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.init.Blocks;
    import net.minecraft.util.IIcon;
    // import net.minecraft.item.ItemStack;

    import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
    import org.lwjgl.opengl.GL11;

    class RenderLantern implements ISimpleBlockRenderingHandler {

    @Override
    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderblocks) {

    // bottom base, top base, cap
    renderFlat(block, renderblocks, x, y, z, 0.35f, 0.15f, 0.35f, 0.65f, 0.25f, 0.65f);
    renderFlat(block, renderblocks, x, y, z, 0.25f, 0.25f, 0.25f, 0.75f, 0.31f, 0.75f);
    renderFlat(block, renderblocks, x, y, z, 0.18f, 0.75f, 0.18f, 0.82f, 0.88f, 0.82f);
    renderFlat(block, renderblocks, x, y, z, 0.31f, 0.88f, 0.31f, 0.69f, 0.94f, 0.69f);

    float low = 0.25f;
    float high = 0.625f;

    renderCorner(block, renderblocks, x, y, z, low, low);
    renderCorner(block, renderblocks, x, y, z, low, high);
    renderCorner(block, renderblocks, x, y, z, high, low);
    renderCorner(block, renderblocks, x, y, z, high, high);

    block.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
    return true;
    }

    private void renderFlat(Block block, RenderBlocks renderblocks, int x, int y, int z,
    float minX, float minY, float minZ, float maxX, float maxY, float maxZ) {
    block.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
    renderblocks.setRenderBoundsFromBlock(block);
    renderblocks.renderStandardBlock(block, x, y, z);
    }

    private void renderCorner(Block block, RenderBlocks renderblocks, int x, int y, int z, float xbase, float zbase) {
    block.setBlockBounds(xbase, 0.31f , zbase, xbase + 0.125f, 0.87f, zbase + 0.125f);
    renderblocks.setRenderBoundsFromBlock(block);
    renderblocks.renderStandardBlock(block, x, y, z);
    }

    @Override
    public int getRenderId() {
    return 0;
    }

    @Override
    public boolean shouldRender3DInInventory(int modelID) {
    return true;
    }

    private void renderCornerDraw(Block block, RenderBlocks renderblocks, Tessellator tessellator, float xbase, float zbase) {
    renderblocks.setRenderBounds(xbase, 0.31f , zbase, xbase + 0.125f, 0.87f, zbase + 0.125f);
    this.renderDraw(block, renderblocks, tessellator);
    }

    private void renderDraw(Block block, RenderBlocks renderblocks, Tessellator tessellator) {
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(0));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(2));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(3));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(4));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSide(5));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    }

    @Override
    public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderblocks) {
    Tessellator tessellator = Tessellator.instance;

    //renderblocks.setRenderBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);
    renderblocks.setRenderBounds(0.35f, 0.15f, 0.35f, 0.65f, 0.25f, 0.65f);
    this.renderDraw(block, renderblocks, tessellator);
    renderblocks.setRenderBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.31f, 0.75f);
    this.renderDraw(block, renderblocks, tessellator);
    renderblocks.setRenderBounds(0.18f, 0.75f, 0.18f, 0.82f, 0.88f, 0.82f);
    this.renderDraw(block, renderblocks, tessellator);
    renderblocks.setRenderBounds(0.31f, 0.88f, 0.31f, 0.69f, 0.94f, 0.69f);
    this.renderDraw(block, renderblocks, tessellator);

    float low = 0.25f;
    float high = 0.625f;

    renderCornerDraw(block, renderblocks, tessellator, low, low);
    renderCornerDraw(block, renderblocks, tessellator, low, high);
    renderCornerDraw(block, renderblocks, tessellator, high, low);
    renderCornerDraw(block, renderblocks, tessellator, high, high);
    }
    }
    1

1 - 4 of 4

Welcome