Add glowfoo

This commit is contained in:
Matthias Schiffer 2014-09-14 15:06:43 +02:00
parent 5fffbad158
commit ea34f55a12
37 changed files with 86 additions and 0 deletions

View file

@ -5,9 +5,11 @@ import java.util.ArrayList;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemCloth;
import net.minecraft.item.ItemFood; import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemSeedFood; import net.minecraft.item.ItemSeedFood;
import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemSeeds;
@ -19,6 +21,7 @@ import net.minecraft.world.gen.feature.WorldGenBigTree;
import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.BiomeEvent.CreateDecorator; import net.minecraftforge.event.terraingen.BiomeEvent.CreateDecorator;
import net.universe_factory.minecraft.test.blocks.BlockGlowfoo;
import net.universe_factory.minecraft.test.generic.GenericCrops; import net.universe_factory.minecraft.test.generic.GenericCrops;
import net.universe_factory.minecraft.test.generic.GenericWood; import net.universe_factory.minecraft.test.generic.GenericWood;
import net.universe_factory.minecraft.test.generic.WorldGenGenericBigTree; import net.universe_factory.minecraft.test.generic.WorldGenGenericBigTree;
@ -176,6 +179,9 @@ public class Test {
public static final Item raddish = new ItemSeedFood(4, 0.4f, raddishField, Blocks.farmland).setTextureName(MODID + ":raddish").setUnlocalizedName( public static final Item raddish = new ItemSeedFood(4, 0.4f, raddishField, Blocks.farmland).setTextureName(MODID + ":raddish").setUnlocalizedName(
"raddish"); "raddish");
public static final Block glowfooBlock = new BlockGlowfoo();
public static final Item glowfoo = new ItemCloth(glowfooBlock);
public static final ExtensibleBiomeDecorator biomeDecorator = new ExtensibleBiomeDecorator(); public static final ExtensibleBiomeDecorator biomeDecorator = new ExtensibleBiomeDecorator();
@EventHandler @EventHandler
@ -198,6 +204,13 @@ public class Test {
GameRegistry.registerItem(raddish, "raddish"); GameRegistry.registerItem(raddish, "raddish");
GameRegistry.registerBlock(raddishField, null, "raddish"); GameRegistry.registerBlock(raddishField, null, "raddish");
GameRegistry.registerBlock(glowfooBlock, null, "glowfoo");
GameRegistry.registerItem(glowfoo, "glowfoo");
for (int i = 0; i < 16; i++)
GameRegistry.addRecipe(new ItemStack(glowfoo, 4, i), "###", "#X#", "###", '#', new ItemStack(Blocks.stained_glass_pane, 1, i), 'X',
Blocks.redstone_block);
biomeDecorator.registerTree(new ExtensibleBiomeDecorator.Tree() { biomeDecorator.registerTree(new ExtensibleBiomeDecorator.Tree() {
@Override @Override
public Entry<WorldGenAbstractTree, Float> replaceTree(World world, BiomeGenBase biome, Random random, int x, int y, int z, public Entry<WorldGenAbstractTree, Float> replaceTree(World world, BiomeGenBase biome, Random random, int x, int y, int z,

View file

@ -0,0 +1,56 @@
package net.universe_factory.minecraft.test.blocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.universe_factory.minecraft.test.Test;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockGlowfoo extends Block {
private static final IIcon[] textures = new IIcon[16];
public BlockGlowfoo() {
super(Material.glass);
setHardness(0.3F);
setStepSound(soundTypeGlass);
setLightLevel(1.0F);
setCreativeTab(CreativeTabs.tabDecorations);
setBlockName("glowfoo");
setBlockTextureName(Test.MODID + ":glowfoo");
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < textures.length; i++)
list.add(new ItemStack(item, 1, i));
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return textures[meta % textures.length];
}
@SideOnly(Side.CLIENT)
private static int negateMeta(int meta) {
return ~meta & 15;
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
for (int i = 0; i < textures.length; i++)
textures[i] = iconRegister.registerIcon(this.getTextureName() + "_" + ItemDye.field_150921_b[negateMeta(i)]);
}
public int damageDropped(int meta) {
return meta;
}
}

View file

@ -24,3 +24,20 @@ tile.cucumber.name=Cucumber
item.raddish.name=Raddish item.raddish.name=Raddish
tile.raddish.name=Raddish tile.raddish.name=Raddish
tile.glowfoo.black.name=Black Light
tile.glowfoo.red.name=Red Light
tile.glowfoo.green.name=Green Light
tile.glowfoo.brown.name=Brown Light
tile.glowfoo.blue.name=Blue Light
tile.glowfoo.purple.name=Purple Light
tile.glowfoo.cyan.name=Cyan Light
tile.glowfoo.silver.name=Light Gray Light
tile.glowfoo.gray.name=Gray Light
tile.glowfoo.pink.name=Pink Light
tile.glowfoo.lime.name=Lime Light
tile.glowfoo.yellow.name=Yellow Light
tile.glowfoo.lightBlue.name=Light Blue Light
tile.glowfoo.magenta.name=Magenta Light
tile.glowfoo.orange.name=Orange Light
tile.glowfoo.white.name=White Light

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B