Jump to content

BlackCrafer666

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by BlackCrafer666

  1. you just need to create sounds.json UTF-8 file like this: { "fire": {"category": "master","sounds": [{"name": "chinesegun/fire","stream": false}]}, "reload": {"category": "master","sounds": [{"name": "chinesegun/reload","stream": false}]}, "empty": {"category": "master","sounds": [{"name": "chinesegun/empty","stream": false}]} } then simply place it to "minecraft\modding\forge-1.7\src\main\resources\assets\<your mod name>\" folder. then simply use world.playSoundAtEntity(player, ModId + ":fire", 1.0f, 1.0f); you don't need to register your sounds, just play it.
  2. ItemStack.damageItem() does not work in creative mode. You can damage items only in survival mode.
  3. Hi I want make new paintings [spoiler=ItemLianaLiberato1] package newpaintings; import net.minecraft.entity.EntityHanging; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemHangingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; import net.minecraft.world.World; public class ItemLianaLiberato1 extends ItemHangingEntity { @SuppressWarnings("rawtypes") public ItemLianaLiberato1(Class p_i45342_1_) { super(p_i45342_1_); this.setCreativeTab(myTab); } /** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ @Override public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if (p_77648_7_ == 0) { return false; } else if (p_77648_7_ == 1) { return false; } else { int i1 = Direction.facingToDirection[p_77648_7_]; EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1); if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)) { return false; } else { if (entityhanging != null && entityhanging.onValidSurface()) { if (!p_77648_3_.isRemote) { p_77648_3_.spawnEntityInWorld(entityhanging); } --p_77648_1_.stackSize; } return true; } } } /** * Create the hanging entity associated to this item. */ private EntityHanging createHangingEntity(World p_82810_1_, int p_82810_2_, int p_82810_3_, int p_82810_4_, int p_82810_5_) { return (EntityHanging) new EntityLianaLiberato1(p_82810_1_, p_82810_2_, p_82810_3_, p_82810_4_, p_82810_5_); } } [spoiler=EntityLianaLiberato1] package newpaintings; import net.minecraft.entity.item.EntityPainting; import net.minecraft.world.World; public class EntityLianaLiberato1 extends EntityPainting { public EntityLianaLiberato1(World world) { super(world); } public EntityLianaLiberato1(World p_i1600_1_, int p_i1600_2_, int p_i1600_3_, int p_i1600_4_, int p_i1600_5_) { super(p_i1600_1_, p_i1600_2_, p_i1600_3_, p_i1600_4_, p_i1600_5_); } } [spoiler=RenderPaintingLianaLiberato1] package newpaintings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderPainting; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityPainting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; public class RenderPaintingLianaLiberato1 extends RenderPainting { @Override protected ResourceLocation getEntityTexture(Entity painting) { return new ResourceLocation(ModInfo.MODID + ":textures/painting/some_png.png"); } /** * 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 doesn't do that. */ public void doRender(EntityPainting p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { System.out.println("uuuuuu"); //don't prints - why??? GL11.glPushMatrix(); GL11.glTranslated(p_76986_2_, p_76986_4_, p_76986_6_); GL11.glRotatef(p_76986_8_, 0.0F, 1.0F, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); this.bindEntityTexture(p_76986_1_); EntityPainting.EnumArt enumart = p_76986_1_.art; float f2 = 0.0625F; GL11.glScalef(f2, f2, f2); this.func_77010_a(p_76986_1_, 16, 16, 0, 0); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } private void func_77010_a(EntityPainting p_77010_1_, int sizeX, int sizeY, int p_77010_4_, int p_77010_5_) { float f = (float)(-sizeX) / 2.0F; float f1 = (float)(-sizeY) / 2.0F; float f2 = 0.5F; float f3 = 0.75F; float f4 = 0.8125F; float f5 = 0.0F; float f6 = 0.0625F; float f7 = 0.75F; float f8 = 0.8125F; float f9 = 0.001953125F; float f10 = 0.001953125F; float f11 = 0.7519531F; float f12 = 0.7519531F; float f13 = 0.0F; float f14 = 0.0625F; for (int i1 = 0; i1 < sizeX / 16; ++i1) { for (int j1 = 0; j1 < sizeY / 16; ++j1) { float f15 = f + (float)((i1 + 1) * 16); float f16 = f + (float)(i1 * 16); float f17 = f1 + (float)((j1 + 1) * 16); float f18 = f1 + (float)(j1 * 16); this.lighting(p_77010_1_, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); float f19 = (float)(p_77010_4_ + sizeX - i1 * 16) / 256.0F; float f20 = (float)(p_77010_4_ + sizeX - (i1 + 1) * 16) / 256.0F; float f21 = (float)(p_77010_5_ + sizeY - j1 * 16) / 256.0F; float f22 = (float)(p_77010_5_ + sizeY - (j1 + 1) * 16) / 256.0F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22); tessellator.setNormal(0.0F, 0.0F, 1.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10); tessellator.setNormal(-1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13); tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14); tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13); tessellator.setNormal(1.0F, 0.0F, 0.0F); tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13); tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14); tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13); tessellator.draw(); } } } private void lighting(EntityPainting p_77008_1_, float p_77008_2_, float p_77008_3_) { int i = MathHelper.floor_double(p_77008_1_.posX); int j = MathHelper.floor_double(p_77008_1_.posY + (double)(p_77008_3_ / 16.0F)); int k = MathHelper.floor_double(p_77008_1_.posZ); if (p_77008_1_.hangingDirection == 2) { i = MathHelper.floor_double(p_77008_1_.posX + (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 1) { k = MathHelper.floor_double(p_77008_1_.posZ - (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 0) { i = MathHelper.floor_double(p_77008_1_.posX - (double)(p_77008_2_ / 16.0F)); } if (p_77008_1_.hangingDirection == 3) { k = MathHelper.floor_double(p_77008_1_.posZ + (double)(p_77008_2_ / 16.0F)); } int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); GL11.glColor3f(1.0F, 1.0F, 1.0F); } /** * 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 doesn't do that. public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityLianaLiberato1)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } } [spoiler=ModMain] @Mod.EventHandler public void init(FMLInitializationEvent event) { itemPaintingLianaLiberato1 = new ItemLianaLiberato1(EntityLianaLiberato1.class).setUnlocalizedName("liana12").setCreativeTab(tabPaintings); GameRegistry.registerItem(itemPaintingLianaLiberato1, "Liana123"); EntityRegistry.registerGlobalEntityID(EntityLianaLiberato1.class, "myEntityPainting", EntityRegistry.findGlobalUniqueEntityId()); proxy.registerRenderers(); } [spoiler=ClientProxy] @Override public void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityLianaLiberato1.class, new RenderPaintingLianaLiberato1()); } My item spawn default paintings.
  4. In 1.7.x IDs is managed automatically. You not need IDs anymore.
  5. I copypaste this code, but my item spawn paintings with random default textures. Whats wrong?
  6. Hi I have downloaded latest forge build forge-1.7.10-10.13.0.1208-src.zip i type in windows 7 console: gradlew setupDecompWorkspace gradlew eclipse No errors are arise. Next, i run MC client from eclipse kepler and get this: [14:05:46] [main/INFO] [GradleStart]: No arguments specified, assuming client. [14:05:46] [main/INFO] [GradleStart]: Extra: [] [14:05:46] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/RAIN/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --username, ForgeDevName] [14:05:46] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [14:05:46] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [14:05:46] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [14:05:46] [main/INFO] [FML]: Forge Mod Loader version 7.10.25.1208 for Minecraft 1.7.10 loading [14:05:46] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_20, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jre1.8.0_20 [14:05:46] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [14:05:46] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [14:05:46] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [14:05:46] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [14:05:46] [main/ERROR] [LaunchWrapper]: Unable to launch java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:1.8.0_20] at java.util.ArrayList$Itr.remove(Unknown Source) ~[?:1.8.0_20] at net.minecraft.launchwrapper.Launch.launch(Launch.java:117) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_20] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_20] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_20] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_20] at GradleStart.bounce(GradleStart.java:107) [start/:?] at GradleStart.startClient(GradleStart.java:100) [start/:?] at GradleStart.main(GradleStart.java:55) [start/:?] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at GradleStart.main(GradleStart.java:59) Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release What is wrong?
  7. thank you! I did it. MultiMote OMG! Ты тоже русский! До чего же world.isRemote тесен
  8. few days ago similar code was working fine with static shot variable! It's confusing me so hard!!!
  9. HELLo public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ System.out.println(world.isRemote); // true / false ++shot; if (shot>5){ System.out.println(world.isRemote); // always true player.inventory.consumeInventoryItem(mod.item2.itemID); shot = 0; } System.out.println("shot="+shot); return stack; } Why world.isRemote is always true?
  10. stop, stop. How it how it helps, if GUI closes while typing 'e' letter?
  11. It's posible to make text box able to type numbers only, not letters? exit from where?
  12. type "gradlew build", press enter. Wait for build process have done. Go to build\libs folder and get your *.jar mod file.
  13. THANK YOU! It's working! But how to get localized names of sub-blocks?
  14. I'm trying to build blocks list in my custom GUI to select block which i need to use in next operation. It's no crashes and no errors. sorry, i make tag mistake in my previous post. Answer is located in the and of previous post. But i repeat it:
  15. i want to build array of all the Block objects with sub-blocks if block has it. if i build this array without sub-blocks, all my things are working fine. my code: int elementsCount = 0; public static void getBlockList(){ Iterator it = Block.blockRegistry.iterator(); for (boolean b=true; b==true; b=it.hasNext()){ Block block = (Block)it.next(); List list = new ArrayList(); block.getSubBlocks(Item.getItemFromBlock(block), null, list); System.out.println(list.size()); if (list.size()>1){ for (int i=0; i<list.size(); i++){ ItemStack stack = (ItemStack)list.get(i); blocks[elementsCount] = Block.getBlockFromItem(stack.getItem()); System.out.println(stack.getItem().getUnlocalizedName()); System.out.println(Block.getIdFromBlock(blocks[elementsCount])+" : "+blocks[elementsCount].getLocalizedName()); ++elementsCount; } } } } It's working, but blocks array is filling with the same blocks (not sub-blocks). E.G. wool block has 16 sub-blocks (aka sub-types) with different colors. But all 16 elements of my array is filling with only first type of wool (white wool). Same situation with wood, planks, saplings e.t.c. Is it fixable? and i also need to get localized names of each sub-block.
  16. I can't understand, how to correctly get the Block object from list. All my tries makes crash
  17. Hi! How to? 1) Check block has sub-blocks or not? (like wood block) 2) If block has sub-blocks, how to iterate and get their?
  18. this.setTextureName(ModInfo.MODID+":itemLime"); I am not sure it works, but i think you have try to change MODID to other mod id.
  19. float zoom = 3.0f; // 3x more than normal ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, zoom, "cameraZoom");
  20. Thank you very much, dude! Iterator is cool stuff! It's mistery right now It's experimental testing feature, but in future, i hope it will be cool mod p.s. Sorry for my english is very very bad
  21. Hi I need to get an array of all exists blocks/items to get their unlocalized names. How to get/build this array?
  22. ok, i will try it later. i need to remove my #1121
×
×
  • Create New...

Important Information

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