Jump to content

perromercenary00

Members
  • Posts

    849
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by perromercenary00

  1. the trouble is the way your asking if the player has item bad english advertisment when you do par3EntityPlayer.inventory.hasItem(Items.wheat_seeds) you are asking if the player has wheatseeds no mather where the sloth is you must get the item from the slot doing something like ItemStack cosastack = par3EntityPlayer.inventory.getStackInSlot(i); Item cosa = cosastack.getItem(); and then compare it to what you want if (cosa.equals(Items.wheat_seeds)) { //do cosas or stuff }
  2. this is whath im triying to achive actualy this gun bullets hold in place the target entity for 100 ticks reseting its position every tick, then explodes inside the mob, but the mob can still do damage if the player gets close enougth, the squeletons can shoot arrows creepers xplode i wanna leave the target entity absolutly stun until the bullets xplodes //SI la bala esta dentro de una Entidad if (this.inEntity) { int entityTicks = this.getTicksInEntity(); this.setTicksInEntity(entityTicks + 1); if (entityTicks == 1){ EntityLivingBase mob =(EntityLivingBase) this.targetEntity; mob.hurtResistantTime=0; this.posX=targetPosX; this.posY=targetEntity.posY; this.posZ=targetPosZ; //mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 90)); //mob.addPotionEffect(new PotionEffect(Potion.blindness.id, 99)); //mob.addPotionEffect(new PotionEffect(Potion.confusion.id, 99)); } //this.targetEntity.setInWeb(); //this.targetEntity.setInWeb(); this.targetEntity.setPositionAndRotation(targetPosX, targetPosY , targetPosZ, this.targetRotY , 0.0F ); if ( this.getTicksInEntity() > 100 ) { //System.out.println(this.targetEntity.getName()+" X= "+targetPosX+" Z="+targetPosZ ); if (!this.targetEntity.isDead){ EntityLivingBase mob =(EntityLivingBase) this.targetEntity; //bullet position reset this.posX=targetPosX; this.posY=targetEntity.posY; this.posZ=targetPosZ; this.targetEntity.hurtResistantTime=0; int R = 1 + ((int) (Math.random() * 9)); //minimo 1 de daño //causar daño alos ender String mName=this.targetEntity.getName(); if (mName.toLowerCase().contains("ender")) { this.targetEntity.attackEntityFrom(DamageSource.outOfWorld, damageE + R ); } DamageSource damagesourceX = DamageSource.causeThrownDamage(this, this.shootingEntity); this.targetEntity.attackEntityFrom(damagesourceX, damageM + R ); this.worldObj.newExplosion((Entity)null, targetPosX, targetPosY + 0.5D, targetPosZ, 1.0F, false, false); float HM = mob.getMaxHealth(); float H = mob.getHealth(); //System.out.println(this.targetEntity.getName()+" Hp= "+H+" / "+HM ); } this.setDead(); } } some idea about how to stun a mob ??
  3. this is the log https://github.com/perromercenary00/perro-codigo-/blob/master/fml-client-latest.log is a clean minecraft install whith latest forge just the 3 parts of mi mod and the 64 x 64 resource pack to asure the issue
  4. long time ago there wass errors for textures in non canonical sizes but thats not a trouble anymore there is no error in output exept for those [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:culataHierro#inventory not found [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:bala9mm_obsidiana#inventory not found [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:culataMadera#inventory not found [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:bala5728mm_redstone#inventory not found [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:movingParts#inventory not found [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:fusilFAMASG2b#inventory not found [06:19:15] [Client thread/ERROR] [FML]: Model definition for location modmercenario:bala55645mm_Standar#inventory not found a dont like to just trow al the json in the model/items folder but have a folder arrangued for every tipe of item update some test if i take the this is the rejoined mod whithout grenade launcher textures, dont use along the other three modmercenario-1.8_0011.jar https://drive.google.com/file/d/0B8sU_NyZQBd7V0ZhVTcwOEotNTA/view?usp=sharing and set a high res texture like [1.7]_R3D.CRAFT_DR-64x_v0.1.5.rar then it becomes green an white
  5. this is the trouble https://youtu.be/ycDa2JrMRj0 first everyting has become white or green expt for entities tile entities and the gui's second i dont speak english to fluent so it makes harder to explain soo i gona try explain miself i been development a prety gun mod whith high res fireweapons are like 14 weapons goin from bows and arrows to 9mm guns to 5.7*28mm guns to 5.56*45Nato guns and grenade launchers i like to sort them for the munition type the trouble there is to many high res textures declared in the atlas and this break it somehow the last time i get stuck in green and white i wass using to many 512*512 textures, so i fix the mod downgrading the icons from 512 to 128*128 textures and any other less importan thing to 256*256 that allow to make room to add shotguns and rifles but now adding the grenade launcher hit the limit again, and dont wanna downgrade any else hypothesis one, i think i if i split the mod then i will have more space becoze there gona have two texture atlas an thaths the double of space so i split the mod not in 2 but in 3 mods the first modmercenario-1.8_0010.jar https://drive.google.com/file/d/0B8sU_NyZQBd7bUZvUVR3cEhJRzA/view?usp=sharing just contens the basic tools pickaxes swords shovels all 64*64 textures the second armasmercenarias-1.8_0010.jar https://drive.google.com/file/d/0B8sU_NyZQBd7bXQwSGxWeTlSekk/view?usp=sharing has the guis the bows and arrows and the guns whith low caliber like 9mm m92 and 5.7*28mm p90 the colt and the shootguns mix of textures in 128, 256 and 512 the third armasmercenarias2-1.8_0010.jar https://drive.google.com/file/d/0B8sU_NyZQBd7MmtQOHh3SUlza2c/view?usp=sharing has the heavy weapons m4a1 bayonete ak200 and the grenade launcher the grenade launcher 79M is the last weapon i been development and is the one that hit this theorical atlas limit so the code is not finish and has some purples blockes and shotguns sounds hypothesis one fail and that let mi whith contradictory output if i put only the first part modmercenario 18 0010 whith the second armasmercenarias 1.8 0010 then happen this https://youtu.be/Q_wYchU-Ml8 everytingh works if i put the first part modmercenario 18 0010 whith the third part armas mercenarias2 1.8 0010 then happen this https://youtu.be/_6QqFYbaG48 everytingh works if the two parts separatly works the the code is fine and the textures two if i put in the minecraft part two and three at same time whithout the first, the first dont care white and green like the first video if i rejoint the thre mods parts in one, but i remove the extra textures from the grenade launcher then it works fine even whith heavy mods from others like biomas o plenty and drzackmod creatures and the epicarno dimension at same time this is the rejoined mod whithout grenade launcher textures, dont use along the other three modmercenario-1.8_0011.jar https://drive.google.com/file/d/0B8sU_NyZQBd7V0ZhVTcwOEotNTA/view?usp=sharing #####################################33 i think im the only one that has this kind of trouble but what i see i dont understand this texture atlas to well and dont get if this is one for all or one for mod if the trouble is the bigger of the exture atlas for what other mods dont cause this to fail when run at the same time whith mi mod some one has an idea of whath i can do to fix this
  6. oooh is working the rcipe like is formet in the guide dont work but now whit this i mod it form GameRegistry.addRecipe(new ItemStack(MercenaryModItems.mangoAcero, 1,0), new Object[] {" ", "AAA", "A ", 'A', new ItemStack(MercenaryModItems.aceroMercenario,1,0)}); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(MercenaryModItems.mangoAcero, 1,0), new Object[] {" ", "AAA", "A ", 'A', "ingotSteel" })); now there is an steel handgungrip in the exit when i use redstone ingots, even mixing steel and redstone damnit looks posible but i must redo like 300 recipes just to make the test
  7. good days i have a little trouble for the amount of textures in 512*512 in mi mod but fix this takes to another trouble and this other trouble i think i can resolvit using ore dict butnot to fluent whith the ore dict ore the english languague for mi understand http://www.minecraftforge.net/wiki/How_to_use_the_ore_dictionary http://www.minecraftforge.net/wiki/Common_Oredict_names *the doub 00 in mi mod i have and steelIngot named AceroMercenario if i declare this ingot in the dictionary like OreDictionary.registerOre("ingotSteel", new ItemStack(MercenaryModItems.aceroMercenario)); this means that this ingot becomes equivalent to any other steel ingot for any other mod that was declare like "ingotSteel" in the ore dictionary and thus if in mi mod i make a handgun grip using five steel ingots this recipe would be compatible whith any other steelIngot from any mod ? to test this theory i register two items from mi mod to the same value, mi steel ingot and mi redstone ingot OreDictionary.registerOre("ingotSteel", new ItemStack(MercenaryModItems.aceroMercenario)); OreDictionary.registerOre("ingotSteel", new ItemStack(MercenaryModItems.redstoneMercenaria)); this means if i put five redstone ingots in the workbench gona have the same output from the steel ingot, an handgun steel grip for output, and the experiments fail coz there is no output whith the five redstone ingots, soo or - or i doit wrong, - or this is not the way any of this works heklp gracias.
  8. hey i get something EntityChicken entitychicken = new EntityChicken(worldIn); //entitychicken.setGrowingAge(-24000); entitychicken.setLocationAndAngles(dpos.getX(), dpos.getY() + 2, dpos.getZ(), 0.0F, 0.0F); worldIn.spawnEntityInWorld(entitychicken); this trow a chicken in the world where i want, and the villager s EntityVillager aldeano = new EntityVillager(worldIn, 1 ); // aldeano.setGrowingAge(-24000); aldeano.setLocationAndAngles(dpos.getX(), dpos.getY() + 2 , dpos.getZ(), 0.0F, 0.0F); worldIn.spawnEntityInWorld(aldeano); recipes custom trades is something a dont get yet http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2177307-villagers-summoning-villagers-with-custom-shop but this guide wont work for me soo i been doing this EntityVillager aldeano = new EntityVillager(worldIn, 1 ); // aldeano.setGrowingAge(-24000); aldeano.setLocationAndAngles(dpos.getX(), dpos.getY() + 2 , dpos.getZ(), 0.0F, 0.0F); MerchantRecipe merchantrecipe = new MerchantRecipe( new ItemStack(Items.gold_ingot ,1,0 ), new ItemStack(Items.apple,1,0), new ItemStack(ExtructurasMItems.hierbaRojaSemilla,1,0), 0, 10000); MerchantRecipeList merchantrecipeList = new MerchantRecipeList(); merchantrecipeList.clear(); merchantrecipeList.add(merchantrecipe); aldeano.setRecipes(merchantrecipeList); worldIn.spawnEntityInWorld(aldeano); i think this must create an villager whith just a recipe a gold Ingot whith an apple for one of mi RedHerbSeed's but no the villager spawn in the world whith the custome set of recipe trades ////// Help how i set a custome trade recipe
  9. uisshh the minecraft is loking for the texture in the minecrafts textures folder not in your mod textures folder coz you declare the texture begining whith minecraft: "minecraft:kriegnesmod_schwarzerbow_pulling_1" and must be "yourmod:kriegnesmod_schwarzerbow_pulling_1"
  10. goo days i been doing some structures and i wanna this extructures to have villagers and animals, well i du not now hot to spawn and looks diferent from spawn a bullet or a item soo long i been triying this video: Double ex = dpos.getX() + 0.0D; Double ey = dpos.getY() + 1.0D; Double ez = dpos.getZ() + 0.0D; Entity aldeano = new EntityVillager( worldIn, 0); worldIn.spawnEntityInWorld(aldeano ); aldeano.setPosition(ex, ey, ez); this must spawn a town and a villager in the center of the town in front of the church it shows not erros but the villager is nowhere . *thaths one, the other is how to spawn an villager golem ? i donut know even how they are called inside the code i suppouse the process is the same for every entity cown or sheep * and last i wanna this villager to have custom trades the other day a read aguide about, but was for the command line i wanna has thath in the code of the town.class
  11. good days at is sounds im working in a fireguns mod and i want to leave some bullets in the bonus chest and in the villages chest houses i tink it has something whith the worldGen but not very sure.
  12. good days i have acustom gun and now i want this custom gun to leave marks in the walls where the bullets hit so i begin to play whith the render of the arrow i set the texture to a simple purple square and now i can see all the arrow model this model is not whatn i want i need to change it but, well i search for it in the minecrat files and dont find a json model for the arrow soo or its hiden or it has be done for other ways, i begin to play whith mi custom bullet render class there is some gl11 code but it seems to not affect the arrow model, im not verse in ways of gl11 soo where is define the model for the arrow ?? the other thing is normaly you dont see the bullets fliying in the air soo i need to modified the time of the model rendering to apears like half second before shoot i read somewhere someting about this arrow shake value but dont have it to clear it seams that its always set to zero and there is this partialTicks thing package mercenarymod.items.armasdefuego.balas; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import mercenarymod.items.armasdefuego.balas.bala5728mm_entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class bala5728mm_render extends Render { private static final ResourceLocation arrowTextures = new ResourceLocation("modmercenario:textures/entity/5728.png"); private static final String __OBFID = "CL_00000978"; public bala5728mm_render(RenderManager p_i46193_1_) { super(p_i46193_1_); } public void doRender(bala5728mm_entity p_180551_1_, double p_180551_2_, double p_180551_4_, double p_180551_6_, float p_180551_8_, float p_180551_9_) { this.bindEntityTexture(p_180551_1_); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.translate((float)p_180551_2_, (float)p_180551_4_, (float)p_180551_6_); GlStateManager.rotate(p_180551_1_.prevRotationYaw + (p_180551_1_.rotationYaw - p_180551_1_.prevRotationYaw) * p_180551_9_ - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(p_180551_1_.prevRotationPitch + (p_180551_1_.rotationPitch - p_180551_1_.prevRotationPitch) * p_180551_9_, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float)(0 + b0 * 10) / 32.0F; float f5 = (float)(5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float)(5 + b0 * 10) / 32.0F; float f9 = (float)(10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GlStateManager.enableRescaleNormal(); float f11 = (float)p_180551_1_.arrowShake - p_180551_9_; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GlStateManager.rotate(f12, 0.0F, 0.0F, 1.0F); } GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(f10, f10, f10); GlStateManager.translate(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); worldrenderer.startDrawingQuads(); worldrenderer.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); worldrenderer.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); worldrenderer.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); worldrenderer.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); worldrenderer.startDrawingQuads(); worldrenderer.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); worldrenderer.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); worldrenderer.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); worldrenderer.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); worldrenderer.startDrawingQuads(); worldrenderer.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); worldrenderer.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); worldrenderer.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); worldrenderer.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); tessellator.draw(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(p_180551_1_, p_180551_2_, p_180551_4_, p_180551_6_, p_180551_8_, p_180551_9_); } protected ResourceLocation getEntityTexture(bala5728mm_entity p_180550_1_) { return arrowTextures; } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity entity) { return this.getEntityTexture((bala5728mm_entity)entity); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks) { this.doRender((bala5728mm_entity)entity, x, y, z, p_76986_8_, partialTicks); } }
  13. it is curios coz the mine works @Override public boolean onItemUse(ItemStack sierra, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { chat.chatda(playerIn, "onItemUse pos="+pos); System.out.println("onItemUse pos="+pos); setInttag(sierra, "bx0", pos.getX() ); setInttag(sierra, "by0", pos.getY() ); setInttag(sierra, "bz0", pos.getZ() ); setInttag(sierra, "bf0", side.getIndex()); return false; } and im returning false and i dont see anyting wrong whith your code
  14. little stuck here take the nbttags from this block "blk" and put it in the ItemsTack "subfusil" and then put that in the the players hand look posible but take the nbttas from the ItemStack "subfusil" put it in a block and then put that block in the world dont seem so feasible the main trouble i find to use this is the lack in 1.8 of the methods worldIn.getBlockTileEntity(par2, par3, par4); //(pos) worldIn.setBlockTileEntity(mitileEntity, pos); //(pos) this shit is surely atached now to IBlockStates but i dont find it in eclipse take the bnts from the block and put it on the gun and put that gun in steves/alex hand whent they rigthclick whith empty hand on the block if there is not nbt in the block initialize gun whith default values ,(full amo, semiAutoMode) this block alredy has tileEntity public class subfusilAresFMG_blocke extends Block implements ITileEntityProvider //###########################################################3 public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { int hand = playerIn.inventory.currentItem; /* * ItemStack block = new ItemStack(blockYouWantNbtIn); * block.stackTagCompound = new NBTTagCompound(); * block.stackTagCompound.setString("whatYouWantToStore", "theValue"); */ IBlockState blkst = worldIn.getBlockState(pos); Block blk = blkst.getBlock(); ItemStack block = new ItemStack(blk); ItemStack subfusil = new ItemStack(MercenaryModItems.subfusilAresFMG, 1, 6); intialize(subfusil, playerIn); NBTTagCompound tags = block.getTagCompound(); if (tags != null) { subfusil.setTagCompound(etiquetas); } ItemStack objeto=playerIn.inventory.getStackInSlot(hand); if ( (objeto == null) & (!playerIn.isSneaking()) ) { playerIn.inventory.setInventorySlotContents(hand, subfusil); worldIn.setBlockToAir(pos); } return false;} // #########################################################################3 when sneaking and rigth click the upper part of a block take the values of this gun "subfusil Ares" put it in a block and then put that block in the world // ######################################################################################3 @Override public boolean onItemUse(ItemStack subfusil, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { //chat.chatga(playerIn, "onItemUse()"); if ( (side == EnumFacing.UP) & ( playerIn.isSneaking() ) & (worldIn.isAirBlock(pos.up())) ) { //chat.chatga(playerIn, "lado de arriba"); int hand = playerIn.inventory.currentItem; NBTTagCompound etiquetas = subfusil.getTagCompound(); Block blk = MercenaryModItems.subfusilAresFMG_blocke; ItemStack block = new ItemStack(blk); block.setTagCompound(etiquetas); //heres where i tink the nbtags get losse Item iblock = block.getItem(); blk = Block.getBlockFromItem(iblock); IBlockState state = blk.getDefaultState(); PropertyDirection FACING = PropertyDirection.create("facing"); worldIn.setBlockState(pos.up(), state.withProperty(FACING, getFacingFromEntity(worldIn, pos, playerIn )), 2); playerIn.inventory.setInventorySlotContents(hand, null ); } } return false; } // ######################################################################################3 thanks
  15. good nigths i been working on this it must be very similar to this one this is mi version of the ares FMG concept from early 1980 this gun has to modes, the first as a weapon when in the players hand, and the second is folded as a block, the idea is to spawn this one in block mode inside a dungeon hiden on pictures or something to later the player could find and use the gun is ready as you could see the trouble is that i dont know how to store the values of the nbttags states and munition when in block mode soo when i folded and put it as a block in the world it reset all the values, the munition came back as full and the shoot mode goes to semiautomatic i been reading about tile entities but the guides i found are mostly to 1.7 and the more complete guide i found for 1.8 was this http://www.orangetutorial.com/tile-entity/ someone can point to a more complete guide or tell me how i store nbttags in a block in 1.8 minecraft ??
  16. goods i need help whith mi custome crop, this crop grow only on flower pots. everything is working well except for the amount of seeds its drop when breaken when full grow, it can spawn from 1 to 8 seeds this is to much i wana this to only spawn one plant whith one seed and whith a 20% chance to spawn a second seed. i been doing some changes to the code but nop it still droping 1 to 8 seeds this is the code package extructurasmercenarias.blocks.plantas; import java.util.Random; import extructurasmercenarias.ExtructurasM; import extructurasmercenarias.items.ExtructurasMItems; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; import net.minecraft.block.BlockCrops; import net.minecraft.block.IGrowable; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; //#################################################################################################3 public class hierbaAzul_blocke extends BlockCrops implements IGrowable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); //private static final String __OBFID = "CL_00000222"; //#################################################################################################3 public hierbaAzul_blocke() { setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); setTickRandomly(true); float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); String name = "hierbaAzul_blocke"; setUnlocalizedName(ExtructurasM.MODID + "_" + name); GameRegistry.registerBlock(this, name); //setCreativeTab(ExtructurasM.blockes); setHardness(0.0F); setStepSound(soundTypeGrass); disableStats(); } //#################################################################################################3 /** * is the block grass, dirt or farmland */ protected boolean canPlaceBlockOn(Block ground) { return true;//ground == Blocks.farmland; //place wherever i want } //#################################################################################################3 public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if (worldIn.getLightFromNeighbors(pos.up()) >= 2) { int i = ((Integer)state.getValue(AGE)).intValue(); if (i < 7) { float f = getGrowthChance(this, worldIn, pos); if (rand.nextInt((int)(25.0F / f) + 1) == 0) { worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2); } } } } //#################################################################################################3 public void grow(World worldIn, BlockPos pos, IBlockState state) { int i = ((Integer)state.getValue(AGE)).intValue() + MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); if (i > 7) { i = 7; } worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2); } //#################################################################################################3 protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) { float f = 1.0F; BlockPos blockpos1 = pos.down(); for (int i = -1; i <= 1; ++i) { for (int j = -1; j <= 1; ++j) { float f1 = 0.0F; IBlockState iblockstate = worldIn.getBlockState(blockpos1.add(i, 0, j)); f1 = 1.5F; // betwing drifth and humidified if (i != 0 || j != 0) { f1 /= 4.0F; } f += f1; } } return f; } //#################################################################################################3 public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { //yes return true;//(worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); } //#################################################################################################3 protected Item getSeed() { return ExtructurasMItems.hierbaAzulSemilla; } //#################################################################################################3 protected Item getCrop() { return ExtructurasMItems.hierbaAzulPlanta; } //#################################################################################################3 /** * Spawns this Block's drops into the World as EntityItems. * * @param chance The chance that each Item is actually spawned (1.0 = always, 0.0 = never) * @param fortune The player's fortune level */ public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); } //#################################################################################################3 /** * Get the Item that this Block should drop when harvested. * * @param fortune the level of the Fortune enchantment on the player's tool */ public Item getItemDropped(IBlockState state, Random rand, int fortune) { return ((Integer)state.getValue(AGE)).intValue() == 7 ? this.getCrop() : this.getSeed(); } //#################################################################################################3 @Override public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) { IBlockState materast = Blocks.flower_pot.getDefaultState(); worldIn.setBlockState(pos, materast); } //#################################################################################################3 /** * Returns the quantity of items to drop on block destruction. */ @Override public int quantityDropped(Random random) { return 1; } //#################################################################################################3 /** * Whether this IGrowable can grow */ public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { return ((Integer)state.getValue(AGE)).intValue() < 7; } //#################################################################################################3 public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { return true; } //#################################################################################################3 @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return this.getSeed(); } //#################################################################################################3 public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { this.grow(worldIn, pos, state); } //#################################################################################################3 /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); } //#################################################################################################3 /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(AGE)).intValue(); } //#################################################################################################3 protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {AGE}); } //#################################################################################################3 @Override public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune); int age = ((Integer)state.getValue(AGE)).intValue(); Random rand = world instanceof World ? ((World)world).rand : new Random(); int R = ((int) (Math.random() * 10)) ; if ( age >= 7 & R > 8 ) { ret.add(new ItemStack(this.getSeed(), 1, 0)); } return ret; } //#################################################################################################3 }//fin de la class all this code is based on the block crops from the wheat and wheat dont spawn so many seeds what you think could be wrong ??
  17. goods this is an easy one i wanna make a recipe whith akward potion but i dont find it in the items class, i think is a meta item from Items.potion but whath it is ? GameRegistry.addRecipe(new ItemStack(MercenaryModItems.cartucho12G_antiEnder, 16,0), new Object[] {"BSB", "PPP", "H H", 'A', new ItemStack(MercenaryModItems.aceroMercenario,1,0), 'B' ,new ItemStack(MercenaryModItems.obsidianaMercenaria,1,0), 'S' ,new ItemStack(Items.potionitem ,1,0),//this must be akwar potion 'H' ,new ItemStack(Items.iron_ingot ,1,0), 'P' ,new ItemStack(Items.gunpowder ,1,0), }); thanks
  18. Mercenary m = new Mercenary(); m.getClass().getResource("/assets/modmercenario/extructuras/stufftoload.json") System.out.println( m.getClass().getResource("/assets/modmercenario/extructuras/stufftoload.json") + " " ); returns null and it creates file named null in side eclipse folder whith the json info inside
  19. hellow again mi code works but sometimes it breaks the doors at spawn i asume some doors dont have the metod to get metadata from state later i gonna fix that now i have a little doub and its how you set the route to the json folders in the code from Tschallacka there is this Modmain.getClass().getResource("/assets/modid/structures/stufftoload.json"); hi has something in their main class to do this for now i been storing json outside of mi mod folders in "/home/tenchi/test.json" but it must go in "/home/tenchi/Modding/forge-1.8-11.14.1.1350-src/src/main/resources/assets/modmercenario/extructuras/" yes i use linux if i just let this code this way it wont gona work in any computer diferent than the mine
  20. hay i find this when i was maken a custom crop public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(VARIANT, BlockDirt.DirtType.byMetadata(meta)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((BlockDirt.DirtType)state.getValue(VARIANT)).getMetadata(); } and do little experiment MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver; BlockPos pos = mov.getBlockPos(); IBlockState blkst = worldIn.getBlockState(pos); Block blk=blkst.getBlock(); int meta = blk.getMetaFromState(blkst); chat.chatm(playerIn, "blkst"+blkst); chat.chatm(playerIn, "meta="+meta); IBlockState blkst0 = blk.getStateFromMeta(meta); pos = pos.east(2); worldIn.setBlockState(pos, blkst0); when you rigth click a block whith this item its copy the block 2m to the east conserving the block state if i rigth click a block whitout this ttwo methods, well unti now it has no crash whith any of mi custom blocks looks safe if you click a block whitout the methods to get the metadata it just create the block whith the default blockstate i gonna use this
  21. hele tanks the word Gson gives tons of tutorials and i alredy have done mi class to write and read json files and actualy works but well this works this way, i create a custom class just to store the values named "blockes" whith mi class "gsonle.java" i convert this class "blockes" whith all their values to string then it writes to the json using the FileWriter method an there is all the data in the json file i wanna store the values of IBlockState but this one crash when try to save to the json file i find is becoze the block state has "[]=" and this breaks the json structure, per example: this is the IBlockState of the yellow flower block minecraft:yellow_flower[type=dandelion] if i let it this way it breaks minecraft when try to write the json so i have to do this little changes storing the blockstates in a ArrayList<IBlockState> public void setListOfStates(ArrayList<IBlockState> listOfStates) { int longlistOfStates=listOfStates.size(); String str0=""; stalist.clear(); for (int lst = 0 ; lst < longlistOfStates ; lst++) { str0=listOfStates.get(lst)+""; str0=str0.replace("[type=", ":type:"); str0=str0.replace("[", ""); str0=str0.replace("]", ""); stalist.add(str0); } } this code takes away the "[]=" and store the data like a String and let the dandelion code like this in the json stalist=[minecraft:yellow_flower:type:dandelion , minecraft:gold_ore, minecraft:gold_ore, minecraft:gold_ore, modmercenario:listarBlockes, minecraft:tallgrass:type:tall_grass , minecraft:tallgrass:type:tall_grass, minecraft:tallgrass:type:tall_grass, minecraft:tallgrass:type:tall_grass, minecraft:red_flower:type:poppy] and this way is not breaking the minecraft when save and the json is fine i could get again the code for the yelow flower just doing strinreplace but how i do recreate the IBlockState object from the string "minecraft:yellow_flower[type=dandelion]" IBlockState block00 = "minecraft:yellow_flower[type=dandelion]"; this not gona works //###### i wana store the IBlockState as well to recreat the structure kepping the blocks facings how do you make this ??
  22. du not know coz im doing not just one icon but four and a text that must be aligned whit the first icon, ¿is there a guiDownLeft ¿how do you put it on code thi is how mi gui must look all the time for now just work when the screen size is set to normal
  23. good days im beginig whith structures later a read that i could create a json defining the blocks and their positions fro what i been reading about json its looks not hard to do but, well i know minecrafts came whith a bundle of utilities, from this itulities what is the name of the best tool to write and read jsons ?? whith that i shall begin to make mi code //###########################################################3 public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); int tx = 16; int ty = 16; int tz = 16; int xmin = x - tx ,xmax = x + tx; int ymin = y - ty ,ymax = y + ty; int zmin = z - tz ,zmax = z + tz; for (int dx = xmin ; dx < xmax ; dx++ ){ for (int dy = ymin ; dy < ymax ; dy++ ){ for (int dz = zmin ; dz < zmax ; dz++ ){ BlockPos dpos = new BlockPos(dx,dy,dz); IBlockState blkst = worldIn.getBlockState(dpos); Block blk = blkst.getBlock(); int blkid = Block.getIdFromBlock(blk); if (!worldIn.isAirBlock(dpos)) { System.out.println(blkid+"=blkid x="+dx+" dy="+dy+" dz="+dz ); String str=blkid+" "+dx+" "+dy+" "+dz; String[] command = {"echo ",str," >> /home/tenchi/salida.txt"}; try { final Process process = Runtime.getRuntime().exec(command); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }}} return false;} //###########################################################3
  24. hay i solved it on other way BlockPos posM = world.getTopSolidOrLiquidBlock(pos); world.setBlockState(posM, MercenaryModBlocks.hierbaVerde.getDefaultState() ); minable.generate(world, random, posM ); the trou ble is that im using minable WorldGenMinable and its spawn to many in the surface the others dont semm to fit how im triying to do i think i have to spend mi time doing mi own WorldGenMercenary or something like
  25. ñaa same trouble but in 1.8 , the diferense is i wanna keep mi icons in boton left i could get the sr.getScaledWidth(); to work properly int backX = sr.getScaledWidth(); int backY = sr.getScaledHeight(); later i try to fix them calculating the position the hard way, neither i could make it work and end geting tired of it an let it for later this code works well only when = 2 , normal size in the menu Minecraft mc; displayWidth=mc.displayWidth; displayHeight=mc.displayHeight; guiscale=mc.gameSettings.guiScale; switch(guiscale) { case 0: ;break; case 3: { posX=16; //controls the Icons size posY=((displayHeight/2)-25); x=40; //gui size } ;break; case 2: { posX=30; //controls the Icons size posY=((displayHeight/2)-60); x=40; //gui size } ;break; case 1: { posX=16; //controls the Icons size posY=((displayHeight)-100); x=10; //gui size } ;break; } //Prepare rendering GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); if (municion<0) { municion=0; } //drawModalRectWithCustomSizedtext0ure(int x, int y,float u,float v,int width,int height,float text0ureWidth,float text0ureHeight); this.mc.renderEngine.bindTexture(new ResourceLocation(icono0)); this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY), 0.0F, 0.0F, x, x, xf, xf); //imagen al 60% //this.drawModalRectWithCustomSizedtext0ure(posX + 8, posY + 8, 0.0F, 0.0F, 200, 200 , 200.0F, 200.0F); this.mc.renderEngine.bindTexture(new ResourceLocation(icono1)); this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY ), 0.0F, 0.0F, (int) (x * 1.5), (x / 3), (xf * 1.5F), (xf / 3) ); //imagen al 60% this.mc.renderEngine.bindTexture(new ResourceLocation(icono2)); this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY + (x / 3) ), 0.0F, 0.0F, (int) (((x * 1.0) / balas ) * municion), (x / 3), (xf * 1.0F), (xf / 3) ); this.mc.renderEngine.bindTexture(new ResourceLocation(icono3)); this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY + ((x / 3) * 2) ), 0.0F, 0.0F, (int) (x * 1.5), (x / 3), (xf * 1.5F), (xf / 3) ); this.mc.fontRendererObj.drawStringWithShadow(text0, posX, ((posY ) + x) , 0xffcccccc);
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.