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

Ewe Loon

Members
  • Posts

    158
  • Joined

  • Last visited

Everything posted by Ewe Loon

  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();
  15. Overriden WorldProvider (thanks Ernio) however i got an error when the trying to get the biomes to generate (this only happens when the player spawn where chunks have not been generated and only sometimes) here is the stacktrace at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:201) ~[ChunkProviderServer.class:?] at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) ~[ChunkProviderServer.class:?] at net.minecraft.server.management.PlayerManager$PlayerInstance.<init>(PlayerManager.java:411) ~[PlayerManager$PlayerInstance.class:?] at net.minecraft.server.management.PlayerManager.getOrCreateChunkWatcher(PlayerManager.java:114) ~[PlayerManager.class:?] at net.minecraft.server.management.PlayerManager.addPlayer(PlayerManager.java:158) ~[PlayerManager.class:?] at net.minecraft.server.management.ServerConfigurationManager.func_72375_a(ServerConfigurationManager.java:256) ~[serverConfigurationManager.class:?] at net.minecraft.server.management.ServerConfigurationManager.playerLoggedIn(ServerConfigurationManager.java:314) ~[serverConfigurationManager.class:?] at net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer(ServerConfigurationManager.java:174) ~[serverConfigurationManager.class:?] at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:173) ~[NetworkDispatcher.class:?] at cpw.mods.fml.common.network.handshake.NetworkDispatcher.completeHandshake(NetworkDispatcher.java:446) ~[NetworkDispatcher.class:?] at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:17) ~[HandshakeCompletionHandler.class:?] at cpw.mods.fml.common.network.internal.HandshakeCompletionHandler.channelRead0(HandshakeCompletionHandler.java:11) ~[HandshakeCompletionHandler.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) ~[simpleChannelInboundHandler.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?] at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?] Caused by: java.lang.NullPointerException at net.minecraft.world.biome.WorldChunkManager.getRainfall(WorldChunkManager.java:88) ~[WorldChunkManager.class:?] at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:109) ~[biomeCache$Block.class:?] at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:39) ~[biomeCache.class:?] at net.minecraft.world.biome.BiomeCache.getCachedBiomes(BiomeCache.java:88) ~[biomeCache.class:?] at net.minecraft.world.biome.WorldChunkManager.getBiomeGenAt(WorldChunkManager.java:183) ~[WorldChunkManager.class:?] at net.minecraft.world.biome.WorldChunkManager.loadBlockGeneratorData(WorldChunkManager.java:165) ~[WorldChunkManager.class:?] at me.el.LoonTerra.BaseChunkProvider.provideChunk(BaseChunkProvider.java:54) ~[baseChunkProvider.class:?] at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:192) ~[ChunkProviderServer.class:?] It appears that it is failing while trying to get rainfall levels This is how im reading the biome data protected BiomeGenBase[] getBiomeData(int cx, int cz) { return this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, cx * 16, cz * 16, 16, 16); }
  16. The WorldProvider's class is WorldProviderSurface and I cant find any way to Override it
  17. the only classes i'm overiding are WorldType and IChunkProvider WorldType is use by the internal world generator to generate DEFAULT ,FLAT ,AMPLIFIED ,LARGE_BIOMES and DEFAULT_1_1 Types by overriding this I can set the main world type to My own generated world Currently i have 2 Islands and SkyBlock, selectable at world creation time in single player Note. these are Dimension 0, not additional Dimentions
  18. thankyou, makes sense but unfortunatly WorldProvider isnt being overriden , but ill look and see if i can override it
  19. I tend not to use Iterator myself (but thats because i didnt grow up with them being there) to me it looks like you are searching the this of item you put into the furnace , and as far as i know Items.baked_potato comes out, not goes in secondly these 2 things are your friends when dealing with unknowns System.out.println(unknown); unknown.getClass().getSimpleName(); and togeather System.out.println(unknown.getClass().getSimpleName());
  20. I just copied this from the client proxy of one of my mods PreInit method GameTable.gameTableRenderID = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(GameTable.gameTableRenderID, new GameTableRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityGameTable.class, new TileEntityGameTableRenderer()); this registers a renderer to the block and one to the tileentity hope this is of some help
  21. I have a WorldType and ChunkGenerator to generate a new world type the problem is I cant find a way to set the spawn location to where it needs to be this is what i have found WorldInfo.setSpawnPosition() is call by WorldServer.createSpawnPosition() during initialization I havn't been able to find anywhere in code I can set it myself after this point and before the player is spawned in single player mode I tried teleporting the player when first logging in but this sometimes causes fetal errors this is the trace from where i trapped during WorldServer.createSpawnPosition() at me.el.LoonTerra.BaseChunkProvider.provideChunk(BaseChunkProvider.java:56) at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:192) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:223) at net.minecraft.world.World.getChunkFromChunkCoords(World.java:485) at net.minecraft.world.World.getBlock(World.java:390) at net.minecraft.world.World.isAirBlock(World.java:413) at net.minecraft.world.World.getTopBlock(World.java:374) at net.minecraft.world.WorldProvider.canCoordinateBeSpawn(WorldProvider.java:97) at net.minecraft.world.WorldServer.createSpawnPosition(WorldServer.java:807) at net.minecraft.world.WorldServer.initialize(WorldServer.java:771) at net.minecraft.world.World.<init>(World.java:299) at net.minecraft.world.WorldServer.<init>(WorldServer.java:104) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:63) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) any ideas would be appreciated
  22. when you want to rename a class in eclipse do the following right click the class in the package explorer from the dropdown select refactor then rename items are remembered in a list by their name, if you change this the map will no longer know what the old items/ blocks where as they are no longer registered these old items will be removed from the map to prevent this, leave the old items in the mod, but remove them from the creative tabs and recipes create the new items as new items I also noticed you are registering the item by the first 5 letters of its unlocalized name, this isnt a good idea as you may end up with 2 items being registered with the same name
  23. if you only want to know if a key has been pressed you can use @Override protected void keyTyped(char p_73869_1_, int p_73869_2_) { // TODO Auto-generated method stub super.keyTyped(p_73869_1_, p_73869_2_); } and you can also use @Override public void handleKeyboardInput() { // TODO Auto-generated method stub super.handleKeyboardInput(); } but as far as i can see there are no function that test to see if a key is actually held down KeyBinding can be used to allow the client to set the keys to be used KeyBinding.getIsKeyPressed() and KeyBinding.isPressed() however these may not work while a gui is open ,
  24. I want to add an options menu into some of my mods I dont want them bound to keys does anyone know if there is a way to add int the existing options menu
×
×
  • Create New...

Important Information

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