Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.HashMap;
- import net.minecraft.client.Minecraft;
- /***
- *
- * @author Ki113d & vxstorm
- *
- */
- public class mod_DefenceCraft extends BaseMod {
- public mod_DefenceCraft() {
- ModLoader.SetInGameHook(this, true, false);
- registerBlocks();
- addRecipes();
- }
- public void registerBlocks() {
- ModLoader.RegisterBlock(flareBlockLit);
- ModLoader.RegisterBlock(flareBlockUnlit);
- }
- public void addRecipes() {
- ModLoader.AddRecipe(new ItemStack(flareBlockLit, 1), new Object[]{
- " ", "# ", "# ", Character.valueOf('#'), Block.dirt});
- ModLoader.AddRecipe(new ItemStack(flareBlockLit, 1), new Object[]{
- " ", " ", " ##", Character.valueOf('#'), Block.dirt});
- }
- public static void addNewFlare(World world, int i, int j, int k, boolean lit) {
- if (lit) {
- world.setBlockWithNotify(i, j, k, flareBlockLit.blockID);
- } else {
- world.setBlockWithNotify(i, j, k, flareBlockUnlit.blockID);
- }
- }
- public String Version() {
- return "Fucking Alpha bro!";
- }
- public static void addFlareToList(BlockFlare bf) {
- flareList.put(bf.ID, bf);
- }
- @Override
- public boolean OnTickInGame(Minecraft minecraft) {
- if (flareList.isEmpty()) {
- return true;
- }
- Collection<BlockFlare> collec = flareList.values();
- Object[] flareArray = collec.toArray();
- checkForBurnOut(flareArray);
- return true;
- }
- public void checkForBurnOut(Object[] obj) {
- for (int i = 0; i < obj.length; i++) {
- System.out.println("i = " + i);
- BlockFlare temp = (BlockFlare) obj[i];
- System.out.println(temp.time + "\n" + temp.ID);
- if (temp.time-- == 0) {
- temp.burnOut();
- flareList.remove(temp.ID);
- }
- }
- }
- public void removeFlareFromList(BlockFlare bf) {
- }
- public static final Block flareBlockLit;
- public static final Block flareBlockUnlit;
- public static HashMap<Long, BlockFlare> flareList;
- static {
- flareList = new HashMap<Long, BlockFlare>();
- flareBlockLit = (new BlockFlare(253, ModLoader.addOverride(
- "/terrain.png", "/com/DefenceCraft/flareLit.png"), true,
- System.currentTimeMillis() / 200)).setHardness(
- 0.0F).setLightValue(1.0F).setStepSound(Block.soundWoodFootstep)
- .setBlockName("Flare Lit").disableNeighborNotifyOnMetadataChange();
- flareBlockUnlit = (new BlockFlare(254, ModLoader.addOverride(
- "/terrain.png", "/com/DefenceCraft/flareUnlit.png"), false,
- 0)).setHardness(0.0F).setLightValue(0.0F).setStepSound(
- Block.soundWoodFootstep).setBlockName(
- "Flare Unlit").disableNeighborNotifyOnMetadataChange();
- }
- }
Add Comment
Please, Sign In to add comment