Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Ewe Loon

Members
  • Posts

    158
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Ewe Loon's Achievements

Creeper Killer

Creeper Killer (4/8)

17

Reputation

  1. I created an axe to do that its not perfect, had major problems with hugemushroom blocks , here is the code for it package me.el.LoonTools; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.block.BlockCocoa; import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockDoublePlant; import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockHugeMushroom; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockMushroom; import net.minecraft.block.BlockSand; import net.minecraft.block.BlockSnow; import net.minecraft.block.BlockSnowBlock; import net.minecraft.block.BlockTallGrass; import net.minecraft.block.BlockVine; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemLumberAxe extends ItemAxe{ public String mat; public ItemLumberAxe(ToolMaterial material, String materialName) { super(material); mat=materialName; setCreativeTab(CreativeTabs.tabTools); setUnlocalizedName("lumberaxe"+mat); setTextureName(LoonTools.modid+":lumberaxe_"+mat); } // EXPLODE TREE byte[] tre= new byte[32000]; byte unchecked=0; byte needcheck=1; byte ignore =2; byte harvest =3; private boolean setcheck(int x, int y, int z) { if(x<0 || x>19 || z<0 || z>19 || y<0 || y>79) return false; int o=x+z*20+y*400; if (tre[o]==unchecked) tre[o]=needcheck; return true; } public boolean canIgnore(Block bit){ if (bit instanceof BlockAir)return true; if (bit instanceof BlockGrass)return true; if (bit instanceof BlockSand)return true; if (bit instanceof BlockDirt)return true; if (bit instanceof BlockCocoa)return true; if (bit instanceof BlockVine)return true; if (bit instanceof BlockMushroom)return true; if (bit instanceof BlockSnow)return true; if (bit instanceof BlockSnowBlock)return true; if (bit instanceof BlockFlower)return true; if (bit instanceof BlockTallGrass)return true; if (bit instanceof BlockDoublePlant)return true; //LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName()); return false; } private int check(World par1World, int x, int y, int z, int xo, int yo,int zo) { int f=0; int o=x+z*20+y*400; if (tre[o]==needcheck){ tre[o]=ignore; Block bit = par1World.getBlock(x+xo, y+yo, z+zo); if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase)||(bit instanceof BlockHugeMushroom)||(bit instanceof HugeMushroomBlock)){ f=1; tre[o]=harvest; //if (bit instanceof BlockLog){ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); //} for(int xb=-1;xb<2;xb++) for(int yb=-1;yb<2;yb++) for(int zb=-1;zb<2;zb++) if (!setcheck(x+xb,y+yb,z+zb))return 3; }else{ if (!canIgnore(bit)) return 2; } } return f; } public int checkTree(World par1World,int xo,int yo,int zo){ boolean f; for (f=true;f==true;){ f=false; for (int y=0;y<80;y++) for(int z=0;z<20;z++) for(int x=0;x<20;x++){ int r=check(par1World,x,y,z,xo,yo,zo); if (r==3) return 3; if (r==2) return 2; if (r==1) f=true; } for (int y=79;y>=0;y--) for(int z=19;z>=0;z--) for(int x=19;x>=0;x--){ int r=check(par1World,x,y,z,xo,yo,zo); if (r==2) return 3; if (r==2) return 2; if (r==1) f=true; } } return 1; } private int check2(World par1World, int x, int y, int z, int xo, int yo,int zo) { int f=0; int o=x+z*20+y*400; if (tre[o]==needcheck){ tre[o]=ignore; Block bit = par1World.getBlock(x+xo, y+yo, z+zo); if (bit instanceof BlockLog){ f=1; tre[o]=harvest; //if (bit instanceof BlockLog){ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); //} for(int xb=-1;xb<2;xb++) for(int yb=-1;yb<2;yb++) for(int zb=-1;zb<2;zb++) if (!setcheck(x+xb,y+yb,z+zb))return 3; }else if (bit instanceof BlockLeavesBase){ }else{ if (!canIgnore(bit)) return 2; } } return f; } public int checkTree2(World par1World,int xo,int yo,int zo){ boolean f; for (f=true;f==true;){ f=false; for (int y=0;y<80;y++) for(int z=0;z<20;z++) for(int x=0;x<20;x++){ int r=check2(par1World,x,y,z,xo,yo,zo); if (r==3) return 3; if (r==2) return 2; if (r==1) f=true; } for (int y=79;y>=0;y--) for(int z=19;z>=0;z--) for(int x=19;x>=0;x--){ int r=check2(par1World,x,y,z,xo,yo,zo); if (r==2) return 3; if (r==2) return 2; if (r==1) f=true; } } return 1; } public void exploadTree(World par1World,int xo,int yo,int zo, EntityPlayer plr){ for (int y=0;y<80;y++) for(int z=0;z<20;z++) for(int x=0;x<20;x++){ int o=x+z*20+y*400; if (tre[o]==harvest){ Block bit = par1World.getBlock(x+xo, y+yo, z+zo); int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase)){ bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met); par1World.setBlockToAir(x+xo, y+yo, z+zo); } } } } private void breakMushroom(World wld, Block bit, EntityPlayer plr, boolean silk, int x, int y, int z, int met) { if (silk){ ItemStack stk; if (bit==Blocks.brown_mushroom_block) stk = new ItemStack(LoonToolItems.brown_mushroom_block,1,met); else if (bit==Blocks.red_mushroom_block) stk = new ItemStack(LoonToolItems.red_mushroom_block,1,met); else stk = new ItemStack(bit,1,met); EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk); entityitem.delayBeforeCanPickup = 10; wld.spawnEntityInWorld(entityitem); }else{ bit.harvestBlock(wld, plr, x, y, z, met); } wld.setBlockToAir(x, y, z); } public void exploadMushroom(World par1World,int xo,int yo,int zo, EntityPlayer plr, boolean silk){ for (int y=0;y<80;y++) for(int z=0;z<20;z++) for(int x=0;x<20;x++){ int o=x+z*20+y*400; if (tre[o]==harvest){ Block bit = par1World.getBlock(x+xo, y+yo, z+zo); int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); if (bit instanceof BlockHugeMushroom){ breakMushroom(par1World, bit, plr, silk, x+xo, y+yo, z+zo,met); }else{ bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met); par1World.setBlockToAir(x+xo, y+yo, z+zo); } } } } @Override public boolean onBlockDestroyed(ItemStack itm, World wld,Block blk, int x, int y,int z, EntityLivingBase plr) { if (!wld.isRemote){ Block bit = wld.getBlock(x, y, z); boolean silk=EnchantmentHelper.getSilkTouchModifier(plr); if ((bit instanceof BlockHugeMushroom) || (bit instanceof HugeMushroomBlock)){ for (int n=0;n<32000;n++) tre[n]=unchecked; int met = wld.getBlockMetadata(x, y, z); breakMushroom(wld, bit, (EntityPlayer) plr, silk, x, y, z,met); wld.setBlockToAir(x,y,z); tre[2210]=needcheck; if (checkTree(wld,x-10,y-4,z-10)==1){ exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk); } } if (bit instanceof BlockLog){ //LoonTools.log("cutting tree @ "+x+" "+y+" "+z+" "); for (int n=0;n<32000;n++) tre[n]=unchecked; int met = wld.getBlockMetadata(x, y, z); bit.harvestBlock(wld, (EntityPlayer) plr, x, y, z,met); wld.setBlockToAir(x,y,z); tre[2210]=needcheck; if (checkTree(wld,x-10,y-4,z-10)==1){ exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); }else{ for (int n=0;n<32000;n++) tre[n]=unchecked; tre[2210]=needcheck; if (checkTree2(wld,x-10,y-4,z-10)==1){ exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); } } } } return super.onBlockDestroyed(itm, wld, blk, x, y, z, plr); } }
  2. I have created flying mounts (Pegasus] and I want to stop players from dismounting (pressing sneak key) while flying , its kind of fatal at heights but i cant find a way to stop it.
  3. inn 1.7.10 i think you might want to look at rotationPitch and rotationYaw
  4. Does anyone know if there is a way to prevent a player from dismounting ?
  5. How do I make ExtendedProperties survive Death I am using ExtendedProperties to store keys for players , but they disappear when the player dies, how do i get them to survive death
  6. have you actually tried it ? I assume you are referring to movement not animation , by this i mean going to block 2,64,90 , then to block 5,55,96 etc if this is the case all you have to do is set a new destination as soon as (or just before) they reach the the connecting point (it worked for me)
  7. in the case of your code change to @Override protected boolean interact(EntityPlayer player) { ItemStack cei=player.getCurrentEquippedItem(); if(cei !=null && cei.getItem() == ModItems.staff){ System.out.println("interact called"); if (cei.stackTagCompound == null){ cei.setTagCompound(new NBTTagCompound()); } cei.stackTagCompound.setInteger("target", this.getEntityId()); // the problem line } return super.interact(player); } though as diesieben07 said this.getEntityId() will change when the entity unloads
  8. @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; } should be returning the Gui to open and use player.openGui(mod.instance, GUI_ID, world, x, y, z); to open the gui
  9. i recomend adding a debug line to excavate method System.out.println("x="+x+" y="+y+" z="+z); also change world.setBlockToAir(x, y, z); to set it to something else , to verify that x,y,z arnt pointing to a block that is already air might help find the problem
  10. where is the center point of your arrow ? set it to the tip of the arrow,
  11. can you post the block code too, if its using custom renderers post them as well
  12. this is the post he made public static void removeFurnaceRecipe(ItemStack stack) { Map recipes = FurnaceRecipes.smelting().getSmeltingList(); Iterator entries = recipes.entrySet().iterator(); while (entries.hasNext()) { Entry thisEntry = (Entry) entries.next(); if (stack.getItem() != null && stack.getItem() == Items.baked_potato) { entries.remove(); } } } problem 1 if (stack.getItem() != null && stack.getItem() == Items.baked_potato) { this is testing to see what the item passes to the method is not the item from the recipe, in the very first post he actually had this bit correct problem 2 entries.remove(); is removing it from the Iterator not the Recipe HashMap it should be recipes.remove(thisEntry.getKey()); just as a note, removing the items from a hashmap can cause errors while reading through the Map I would recommend instead of removing immediately create a list of items to remove then remove them after scanning the list like this public static void removeFurnaceRecipe(ItemStack stack) { Map<ItemStack, ItemStack> recipes = FurnaceRecipes.smelting().getSmeltingList(); LinkedList<ItemStack> remlist=new LinkedList<ItemStack>(); Iterator<Entry<ItemStack, ItemStack>> entries = recipes.entrySet().iterator(); while (entries.hasNext()) { Entry<ItemStack, ItemStack> thisEntry = (Entry<ItemStack, ItemStack>) entries.next(); if (ItemStack.areItemStacksEqual(thisEntry.getValue(), stack)) { remlist.add(thisEntry.getKey()); } } for(ItemStack rm:remlist) recipes.remove(rm); }
  13. My Skyblock mod uses a custom chunk generator , but it keeps the original boime map
  14. Yes, Failender your right, he isnt testing the recipe at all is he, in or out There are actually 2 major errors both these 2 lines contain the errors if (stack.getItem() != null && stack.getItem() == Items.baked_potato) { entries.remove();
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.