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

xwerswoodx

Forge Modder
  • Content Count

    80
  • Joined

  • Last visited

Posts posted by xwerswoodx

  1. 15 minutes ago, Draco18s said:

    Bad modder, no cookie. Do not use hard coded IDs.

    I know MobEffects initialization. But he asked about 

    "I've seen around the internet that they go Potion.getPotionByID(), or was it PotionEffect.getPotionByID()? Either way, it doesn't seem to be supported here."

     

    So I answered him same way. Sorry bro but knowing "MobEffects" init doesn't make you good or bad modder. Anyway here is the code with "MobEffects" for "GOOD" mooders...

     

    player.addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 0));

     

    • Like 2
  2. player.addPotionEffect(new PotionEffect(Potion.getPotionById(19), 100, 0));

    Here is the example. 19 is id of potion which is equals to Poison, 100 is duration of potion 20ticks per second, so 100 is equals to 5 seconds. and 0 is a level of potion. (zero-based) so if you type 2 for level, it equals level 3 potion effect. You can get ids from net.minecraft.potion.Potion.java.
     

  3. Here is my basic ConfigHandler class, maybe help you.
     

    package net.xwerswoodx.vrenchant;
    
    import java.io.File;
    
    import net.minecraftforge.common.config.ConfigCategory;
    import net.minecraftforge.common.config.Configuration;
    
    public class ConfigHandler {
    	public static Configuration config;
    	private static String file = "config/modID.cfg";
    	
    	public static void init() {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	/*
    	 * Removes specific category from configuration file.
    	 */
    	public static void removeConfig(String category) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.hasCategory(category))
    				config.removeCategory(new ConfigCategory(category));
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	/*
    	 * Removes specific key in specific category from configuration file.
    	 */
    	public static void removeConfig(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key))
    				config.getCategory(category).remove(key);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static int getInt(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return config.get(category, key, 0).getInt();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return 0;
    	}
    	
    	public static double getDouble(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return config.get(category, key, 0D).getDouble();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return 0D;
    	}
    	
    	public static float getFloat(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return (float)config.get(category, key, 0D).getDouble();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return 0f;
    	}
    	
    	public static String getString(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return config.get(category, key, "").getString();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return "";
    	}
    	
    	public static long getLong(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return config.get(category, key, 0L).getLong();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return 0L;
    	}
    	
    	public static short getShort(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return (short)config.get(category, key, (short)0).getInt();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return (short)0;
    	}
    	
    	public static byte getByte(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key)) {
    				return (byte)config.get(category, key, (byte)0).getInt();
    			}
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return (byte)0;
    	}
    	
    	public static boolean getBoolean(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (config.getCategory(category).containsKey(key))
    				return config.get(category, key, false).getBoolean();
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return false;
    	}
    	
    	public static void writeConfig(String category, String key, String value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			String set = config.get(category, key, value).getString();
    			config.getCategory(category).get(key).set(value);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static void writeConfig(String category, String key, int value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			int set = config.get(category, key, value).getInt();
    			config.getCategory(category).get(key).set(value);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static void writeConfig(String category, String key, boolean value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			boolean set = config.get(category, key, value).getBoolean();
    			config.getCategory(category).get(key).set(value);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static void writeConfig(String category, String key, long value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			long set = config.get(category, key, value).getLong();
    			config.getCategory(category).get(key).set(value);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static void writeConfig(String category, String key, double value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			double set = config.get(category, key, value).getDouble();
    			config.getCategory(category).get(key).set(value);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static void writeConfig(String category, String key, short value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			int set = config.get(category, key, value).getInt();
    			config.getCategory(category).get(key).set(Integer.valueOf(value));
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    
    	public static void writeConfig(String category, String key, byte value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			int set = config.get(category, key, value).getInt();
    			config.getCategory(category).get(key).set(Integer.valueOf(value));
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    
    	public static void writeConfig(String category, String key, float value) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			double set = config.get(category, key, value).getDouble();
    			config.getCategory(category).get(key).set(Double.valueOf(value));
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    	}
    	
    	public static boolean hasCategory(String category) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			return config.hasCategory(category);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return false;
    	}
    	
    	public static boolean hasKey(String category, String key) {
    		config = new Configuration(new File(file));
    		try {
    			config.load();
    			if (!config.hasCategory(category))
    				return false;
    			return config.getCategory(category).containsKey(key);
    		} catch (Exception e) {
    			System.out.println("Cannot load configuration file!");
    		} finally {
    			config.save();
    		}
    		return false;
    	}
    	
    	public static void setFile(String filename) {
    		file = "config/" + filename;
    	}
    	
    	public static String getFile() {
    		return file;
    	}
    }

     

    Just put this code to ConfigHandler.java (Or you can give another name) and you can write, remove or get values like;

     

    writeConfig(category[String], key[String], value[String, int, long, short, byte, boolean, double, float]);

    ConfigHandler.writeConfig("My Category", "Name", "Hamit"); //Write string ("Hamit") to config.

    ConfigHandler.writeConfig("My Category", "isPlayer", true); //Write boolean ("true") to config.

     

    setFile(fileName[String]);

    ConfigHandler.setFile("Hamit.cfg"); //Changes default file (which is set at the beginning of ConfigHandler class)

     

    getString(category[String], key[String]); //You can use getInt, getLong, getShort etc.

    ConfigHandler.getString("My Category", "Name"); //Get string value of "Name" from the category - named "My Category".

    out.println("isPlayer " + ConfigHandler.getString("My Category", "isPlayer").toString() + " boolean value has written in file: " + ConfigHandler.getFile());

     

     

        @EventHandler
        public void onInitialization(FMLInitializationEvent event) {
    
            ConfigHandler.writeConfig("My Category", "Name", "Hamit");
            System.out.println("Name " + ConfigHandler.getString("My Category", "Name") + " string value has written in file: " + ConfigHandler.getFile());
    
    
            ConfigHandler.setFile("Mehmet.cfg");
            ConfigHandler.writeConfig("My Category", "Age", 22);
            System.out.println("Name " + String.valueOf(ConfigHandler.getInt("My Category", "Age")) + " integer value has written in file: " + ConfigHandler.getFile());
    
    
    
            ConfigHandler.setFile("Batuhan.cfg");
            ConfigHandler.writeConfig("My Category", "isPlayer", false);
            System.out.println("isPlayer " + ConfigHandler.getBoolean("My Category", "isPlayer").toString() + " boolean value has written in file: " + ConfigHandler.getFile());
    
        }
    • Thanks 1
  4. I don't know if it's possible to get from UUID from offline player (I haven't tried it before) but you can save player uuid to configuration file when he logged in server first time, and you can check his nickname from configuration file. If I remember correct, playerLoginEvent or LoggedIn event could be suitable for this.

  5. public class EmeraldArmor extends ItemArmor {
    public addarmor(String name, int index, int type) {
    	super(yourmainclass.ArmorMaterial_EMERALD, index, type);
    
    	this.setCreativeTab(CreativeTabs.tabCombat);
    	this.setUnlocalizedName(name);
    	GameRegistry.registerItem(this, name);
    }
    
    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
    	if (slot == 2) {
    		return yourmodid + ":textures/models/armor/emerald_layer_2.png";
    	} else {
    		return yourmodid + ":textures/models/armor/emerald_layer_1.png";
    	}
    }
    }

     

     

    To the main code:

    	public static ArmorMaterial ArmorMaterial_EMERALD = EnumHelper.addArmorMaterial("EMERALD", "emerald", 44, new int[] {4, 10, 8, 4}, 15);
    

     

     

    [/size]When you register;

     

    	emeraldHelmet = new EmeraldArmor("emeraldhelmet", 4, 0);
    
    	emeraldChestplate = new EmeraldArmor("emeraldchestplate",  4, 1);
    
    	emeraldLeggings = new EmeraldArmor("emeraldleggings", 4, 2);
    
    	emeraldBoots = new EmeraldArmor("emeraldboots", 4, 3);

     

     

    Put your emerald models to;

    \src\main\resources\assets\your modid\textures\models\armor

     

     

     

    You need to register item textures with modelregistry.

  6. This is helpful for me thanks for this, I remove sideonly, but it still not working.

     

    //I solved it, I can delete topic but maybe someone will make same mistake so I can explain, I used EntityPlayer for onUpdate but have to use Entity. So I change my code;

     

    public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
    	if (entity instanceof EntityPlayer) {
    		  EntityPlayer player = (EntityPlayer) entity;
    		  if (player.inventory.hasItem(stack.getItem())) {
    			  Minecraft mc = FMLClientHandler.instance().getClient();
    			  update(mc);
    		  }
    	}
    }

  7. I am trying to tick item. But onUpdate never works, how is it work? I try this;

     

    	@SideOnly(Side.CLIENT)
    public void onUpdate(ItemStack stack, World world, EntityPlayer player, int par4, boolean par5) {
    	if (player.inventory.hasItem(stack.getItem())) {
    		outStream = new BufferedWriter(new FileWriter(new File("hamit.txt"), true));
    		outStream.write("onUpdate!");
    		outStream.newLine();
    		outStream.close();
    	}
    }
    

     

    But it never write onUpdate! in hamit.txt, I try to walk, run, right click, left click... How can I fix it?

     

    I can use onPlayerTick but it affect all items with same id, I just want to tick items from inventory.

  8. Ok I did what did you say

     

    Change my code to:

    		ModelResourceLocation location = new ModelResourceLocation(ref.uid, "inventory");
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemref.ironX, 0, location);

     

    texture isn't work.

     

    I changed it

     

    		ModelResourceLocation location = new ModelResourceLocation(ref.uid + ":ironx", "inventory");
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemref.ironX, 0, location);

     

    Texture works.

     

    I changed it to;

    		ModelResourceLocation location = new ModelResourceLocation(ref.uid + ":irony", "inventory");
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemref.ironX, 0, location);

     

    Texture doesn't work. (I have ironx.json and irony.json files and both is tested and work)

     

    Where did I do mistake? I can't caught it, I remove unlocalizedname.substring(5) and it isn't work. When I type my json file name for "inventory" section, it isn't work. Maybe I don't understand what do you mean, if you can explain it to me with a code I can understand clearly.

  9. You don't use quotation marks before @mod and after it. If it is work older versions, it can be because forge isn't support java 8 versions yet, but it doesn't cause @Mod error, it just not compile codes and crash game, if you use " before @Mod and at the end of the line, it can be error.

     

    @Mod(modid = "LetsMod", name = "Lets Mod", version = "1.0-1.7.10")
    

     

    If you don't have quotation marks I don't know why it gives error, maybe someone help you.

  10. String name = ref.uid + ":" + (item.getUnlocalizedName().substring(5));

     

    Ah this line is means ref.uid is my modid and (item.getUnlocalizedName().substring(5)) is json file name, for 1.8.0 setTextureName isn't exists anymore, before I can do it with IIcon but now I can't register more than 1 textures for item.

     

    For 1.7.10 I can use like this;

    private IIcon[] iconIndexes = new IIcon[5];
    
    @SideOnly(Side.CLIENT)
    @Override
    public void registerIcons(IIconRegister reg) {
    	for (int x=0; x < 5; x++) {
    		iconIndexes[x] = reg.registerIcon(ref.uid + ":" + (this.getUnlocalizedName().substring(5)) + "_" + x);
    	}
    	this.itemIcon = iconIndexes[0];
    }
    

     

    And use like this;

    @SideOnly(Side.CLIENT)
    public void update(Minecraft mc) {
    
    	if (new Date().getTime() <= lastUpdate.longValue() + millisPerUpdate.longValue()) {
    		return ;
    	}
    	lastUpdate = Long.valueOf(new Date().getTime());
    
    	found.clear();
    	distanceShortest = -1;
    
    	EntityPlayer player = mc.thePlayer;
    	World world = mc.theWorld;
    
    	if ((player == null) || (world == null)) {
    		return;
    	}
    
    	double cur_x = player.posX;
    	double cur_y = player.posY;
    	double cur_z = player.posZ;
    
    	int min_x = (int)cur_x - distanceMax - 1;
    	int min_y = (int)cur_y - distanceMax;
    	int min_z = (int)cur_z - distanceMax;
    
    	int max_x = (int)cur_x + distanceMax;
    	int max_y = (int)cur_y + distanceMax;
    	int max_z = (int)cur_z + distanceMax + 1;
    
    	for (int z1 = min_z; z1 < max_z; z1++) {
    		for (int x1 = min_x; x1 < max_x; x1++) {
    			for (int y1 = min_y; y1 < max_y; y1++) {
    				if (world.getBlock(x1, y1, z1) == this.search) {
    					found.add(new int[] { x1, y1, z1 });
    				}
    			}
    		}
    	}
    
    	for (int i = 0; i < found.size(); i++) {
    		int[] block = (int[])found.get(i);
    
    		double distanceX = block[0] - cur_x;
    		double distanceY = block[1] - cur_y + 1.0D;
    		double distanceZ = block[2] - cur_z;
    
    		distanceX += (distanceX > 0.0D ? 1.0D : 0.0D);
    		distanceZ += (distanceZ > 0.0D ? 1.0D : 0.0D);
    
    		double distance2D = Math.sqrt(Math.pow(distanceX, 2.0D) + Math.pow(distanceZ, 2.0D));
    		double distance3D = Math.sqrt(Math.pow(distance2D, 2.0D) + Math.pow(distanceY, 2.0D));
    
    		if ((int)distance3D > distanceMax) {
    			found.remove(i);
    			i--;
    		} else if ((distanceShortest > distance3D) || (distanceShortest == -1)) {
    			distanceShortest = (int)distance3D;
    			vectorShortest = new int[] { block[0], block[1], block[2] };
    		}
    	}
    
        distancePerLevel = distanceMax / 4;
        if (distancePerLevel < 1) {
          distancePerLevel = 1;
        }
        
    	if (distanceShortest > -1) {
    		int level = (distanceMax - distanceShortest + 1) / distancePerLevel;
    		if (distanceMax < 4) {
    			level +=4 - distanceMax;
    		}
    		this.itemIcon = iconIndexes[level];
    	} else {
    		this.itemIcon = iconIndexes[0];
    	}
    }
    

     

    So I can't do with modelresourcelocation, because I cant register models without create new item.

  11. Ok I try to explain;

     

    When I try to register blockChecker icon, I use that way;

    		String name = ref.uid + ":" + (item.getUnlocalizedName().substring(5));
    	ModelResourceLocation location = new ModelResourceLocation(name, "inventory");
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, location);

     

    blockChecker unlocalized name is blockchecker_0 and when I create blockchecker_0.json, texture works in game, but when I try it to blockchecker_1.json, (I also have blockchecker_1.json) texture doesn't work in game.

     

    	public void setRender(Item item, int level) {
    	if (level < 0) { level = 0; }
    	String name = ref.uid + ":" + item.getUnlocalizedName().substring(5).split("_")[0] + "_" + level;
    	ModelResourceLocation location = new ModelResourceLocation(name, "inventory");
    	String loc = name;
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, location);
    }

     

    This is my setRender void in Item Class, and onPlayerTick event I used that way to setting render;

     

    	 public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    	EntityPlayer player = event.player;
    	InventoryPlayer inventory = player.inventory;
    
    	if (inventory.hasItem(itemref.blockChecker)) {
    		 ((addmeter)itemref.blockChecker).initProps();
        }
            }

     

    initProps calculate distance between player and block, and settingRender with distance, for example, if he far away blockchecker_0, if he far 8 squire blockchecker_1 if he is in 1 radius return blockchecker_4.

     

    @SideOnly(Side.CLIENT)
    public void update(Minecraft mc) {
    
    	if (new Date().getTime() <= lastUpdate.longValue() + millisPerUpdate.longValue()) {
    		return ;
    	}
    	lastUpdate = Long.valueOf(new Date().getTime());
    
    	found.clear();
    	distanceShortest = -1;
    
    	EntityPlayer player = mc.thePlayer;
    	World world = mc.theWorld;
    
    	if ((player == null) || (world == null)) {
    		return;
    	}
    
    	double cur_x = player.posX;
    	double cur_y = player.posY;
    	double cur_z = player.posZ;
    
    	int min_x = (int)cur_x - distanceMax - 1;
    	int min_y = (int)cur_y - distanceMax;
    	int min_z = (int)cur_z - distanceMax;
    
    	int max_x = (int)cur_x + distanceMax;
    	int max_y = (int)cur_y + distanceMax;
    	int max_z = (int)cur_z + distanceMax + 1;
    
    	for (int z1 = min_z; z1 < max_z; z1++) {
    		for (int x1 = min_x; x1 < max_x; x1++) {
    			for (int y1 = min_y; y1 < max_y; y1++) {
    				BlockPos pos1 = new BlockPos(x1, y1, z1);
    				if (world.getBlockState(pos1).getBlock() == this.search) {
    					found.add(new int[] { x1, y1, z1 });
    				}
    			}
    		}
    	}
    
    	for (int i = 0; i < found.size(); i++) {
    		int[] block = (int[])found.get(i);
    
    		double distanceX = block[0] - cur_x;
    		double distanceY = block[1] - cur_y + 1.0D;
    		double distanceZ = block[2] - cur_z;
    
    		distanceX += (distanceX > 0.0D ? 1.0D : 0.0D);
    		distanceZ += (distanceZ > 0.0D ? 1.0D : 0.0D);
    
    		double distance2D = Math.sqrt(Math.pow(distanceX, 2.0D) + Math.pow(distanceZ, 2.0D));
    		double distance3D = Math.sqrt(Math.pow(distance2D, 2.0D) + Math.pow(distanceY, 2.0D));
    
    		if ((int)distance3D > distanceMax) {
    			found.remove(i);
    			i--;
    		} else if ((distanceShortest > distance3D) || (distanceShortest == -1)) {
    			distanceShortest = (int)distance3D;
    			vectorShortest = new int[] { block[0], block[1], block[2] };
    		}
    	}
    
        distancePerLevel = distanceMax / 4;
        if (distancePerLevel < 1) {
          distancePerLevel = 1;
        }
        
    	if (distanceShortest > -1) {
    		int level = (distanceMax - distanceShortest + 1) / distancePerLevel;
    		if (distanceMax < 4) {
    			level +=4 - distanceMax;
    		}
    		this.setRender(this, level);;
    	} else {
    		this.setRender(this, 0);
    	}
    }
    

     

    But I have an item named blockchecker_0 and texture work when I far away, but when I get closer, and model resource change to blockchecker_1 it doesn't work, on the other hand, when I add for items without creativetabs, as an unlocalizedname blockchecker_1, blockchecker_2, blockchecker_3 and blockchecker_4, all the textures works well. But I have to create a new item for every texture. Or maybe I am doing something wrong somewhere.

     

    Also I have a trouble with ticking a specific item. When player get closer to block, this code update all of the blockChecker items in server, I just want to update items which is in player inventory.

     

     

  12. Your sound loader should be like this;

     

    public class SoundLoadHandler {
    @SideOnly(Side.CLIENT)
    public void onSoundsLoaded(SoundLoadEvent event) {
    	SoundManager src = event.manager;
    	src.soundPoolStreaming.addSound("glistremod:wolf_howl.ogg");
    }
    
    @SideOnly(Side.CLIENT)
    public void onPlayStreaming(PlayStreamingEvent event) {
    	boolean isCont;
    	isCont = event.name.contains("glistremod");
    	if (!isCont) {
    		FMLClientHandler.instance().getClient().SoundManager.playStreaming("glistremod:" + event.name, event.x + 0.5F, event.y + 0.5F, event.z + 0.5F);
    	}
    }
    }
    

     

    And your ogg files should be inside the following folder;

    Your forge File\mcp\src\minecraft\assets\glistremod\records\

  13. I don't understand what the problem is but if you use TeamViewer I can come to your pc and help you to create tab and maybe I can see the problem. If you send your crash report from file, it can give us more information about problem. Also If you use skype I can help you with sharing desktop :) My skype is same with my nickname

  14. Have you ever check second page? Because first page is totally full and new tabs created with new page.

     

    Ok I create new tab on my pc and check it;

    I have create in my main class a Creative tab;

     

    public static CreativeTabs CreativeTabs_New;
    

     

    After that, in my main class inside of Init event;

        CreativeTabs_New = new CreativeTabs("New") {			
    		@Override
    		public Item getTabIconItem() {
    			return itemref.blackDiamond;
    		}
    	};
    

     

    And the result;

     

     

    gk7q9b.png

     

     

     

    I don't have blackdiamond texture yet don't thing code is wrong :P

     

    And a question;

    Did you register your creative tab class under the Initialization event?

  15. This is my adddisc function for custom records. But I am using 1.8.0 so I am not sure whether it is work on 1.7.10 or not.

     

    package net.extend.mod.functions;
    
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    import com.google.common.collect.Maps;
    
    import net.extend.mod.ref;
    import net.minecraft.block.BlockJukebox;
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.resources.model.ModelResourceLocation;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.EnumRarity;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemRecord;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.BlockPos;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.util.StatCollector;
    import net.minecraft.world.World;
    import net.minecraftforge.fml.common.registry.GameRegistry;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class adddisc extends ItemRecord {
    
    public String music;
    private static final Map RECORDS = new HashMap();
    public adddisc(String name, String music) {
    	super(music);
    
    	this.setMaxStackSize(1);
            this.setCreativeTab(CreativeTabs.tabMisc);
            this.setUnlocalizedName(name);
            this.music = music;
            RECORDS.put("records." + music, this);
            GameRegistry.registerItem(this, name);
    }
    
    @Override
        public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
            IBlockState iblockstate = worldIn.getBlockState(pos);
    
            if (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue()) {
                if (worldIn.isRemote) { return true; }
                else {
                	((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this));
                    --stack.stackSize;
                    return true;
                }
            } else { return false; }
        }
    
    @Override
        @SideOnly(Side.CLIENT)
        public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {
            tooltip.add(this.getRecordNameLocal());
        }
    
    @Override
        @SideOnly(Side.CLIENT)
        public String getRecordNameLocal() {
            return StatCollector.translateToLocal(this.getUnlocalizedName() + ".desc");
        }
    
    @Override
    public ResourceLocation getRecordResource(String record) {
    	ResourceLocation location = super.getRecordResource(ref.uid + ":" + this.music);
    	return location;
    }
    
     @Override
     public EnumRarity getRarity(ItemStack itemStack) {
    	 return EnumRarity.RARE;
     }
    
     @SideOnly(Side.CLIENT)
     public static adddisc getRecord(String name) {
    	 return (adddisc)RECORDS.get(name);
         }
    }
    

     

    public static Item discWish;
    public static Item discJingle;
    public static Item discCarol;
    public static Item discBirGorusKabininde;
    public static Item discAhSensiz;
    public static Item discKoNewYear;
    public static Item discNumb;
    public static Item discBeautifulMind;
    public static Item discSomebodyToldMe;
    public static Item discKids;
    public static Item discGhostsNStuff;
    public static Item discVivaLaVida;
    public static Item discApplause;
    public static Item discDiamonds;
    public static Item discMovesLikeJagger;
    public static Item discRapGod;
    public static Item discSetFireToRain;
    public static Item discSurvival;
    public static Item discMusadenizleCocuklar;
    public static Item discWeAreTheChampions;
    public static Item discTheFinalCountdown;
    public static Item discStill;
    

     

    	discWish = new adddisc("discwish", "wish");
    	discJingle = new adddisc("discjingle", "jingle");
    	discCarol = new adddisc("disccarol", "carol");
    	discBirGorusKabininde = new adddisc("discbirgoruskabininde", "birgoruskabininde");
    	discAhSensiz = new adddisc("discahsensiz", "ahsensiz");
    	discKoNewYear = new adddisc("disckonewyear", "konewyear");
    	discNumb = new adddisc("discnumb", "numb");
    	discBeautifulMind = new adddisc("discbeautifulmind", "beautifulmind");
    	discSomebodyToldMe = new adddisc("discsomebodytoldme", "somebodytoldme");
    	discKids = new adddisc("disckids", "kids");
    	discGhostsNStuff = new adddisc("discghostsnstuff", "ghostsnstuff");
    	discVivaLaVida = new adddisc("discvivalavida", "vivalavida");
    	discApplause = new adddisc("discapplause", "applause");
    	discDiamonds = new adddisc("discdiamonds", "diamonds");
    	discMovesLikeJagger = new adddisc("discmoveslikejagger", "moveslikejagger");
    	discRapGod = new adddisc("discrapgod", "rapgod");
    	discSetFireToRain = new adddisc("discsetfiretorain", "setfiretorain");
    	discSurvival = new adddisc("discsurvival", "survival");
    	discMusadenizleCocuklar = new adddisc("discmusadenizlecocuklar", "musadenizlecocuklar");
    	discWeAreTheChampions = new adddisc("discwearethechampions", "wearethechampions");
    	discTheFinalCountdown = new adddisc("discthefinalcountdown", "thefinalcountdown");
    	discStill = new adddisc("discstill", "still");
    

     

    Json:

    {
        "wish": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/wish",
                "stream": true
                }
            ]
        },
        
        "jingle": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/jingle",
                "stream": true
                }
            ]
        },
    
        "carol": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/carol",
                "stream": true
                }
            ]
        },
    
        "birgoruskabininde": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/birgoruskabininde",
                "stream": true
                }
            ]
        },
        
        "ahsensiz": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/ahsensiz",
                "stream": true
                }
            ]
        },
        
        "konewyear": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/konewyear",
                "stream": true
                }
            ]
        },
        
        "numb": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/numb",
                "stream": true
                }
            ]
        },
    
        "beautifulmind": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/beautifulmind",
                "stream": true
                }
            ]
        },
    
        "somebodytoldme": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/somebodytoldme",
                "stream": true
                }
            ]
        },
    
        "kids": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/kids",
                "stream": true
                }
            ]
        },
    
        "ghostsnstuff": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/ghostsnstuff",
                "stream": true
                }
            ]
        },
    
        "vivalavida": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/vivalavida",
                "stream": true
                }
            ]
        },
    
        "applause": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/applause",
                "stream": true
                }
            ]
        },   
    
        "diamonds": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/diamonds",
                "stream": true
                }
            ]
        },
    
        "moveslikejagger": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/moveslikejagger",
                "stream": true
                }
            ]
        },
    
        "rapgod": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/rapgod",
                "stream": true
                }
            ]
        },
    
        "setfiretorain": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/setfiretorain",
                "stream": true
                }
            ]
        },
    
        "survival": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/survival",
                "stream": true
                }
            ]
        },
        
        "musadenizlecocuklar": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/musadenizlecocuklar",
                "stream": true
                }
            ]
        },
        
        "wearethechampions": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/wearethechampions",
                "stream": true
                }
            ]
        },
        
        "thefinalcountdown": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/thefinalcountdown",
                "stream": true
                }
            ]
        },
        
        "still": {
            "category": "record",
            "sounds": [
                {
                "name": "extend:records/still",
                "stream": true
                }
            ]
        }
    }
    

     

    And my ogg files in

    C:\Users\Hamit\Desktop\Minecraft\1.8.0\src\main\resources\assets\extend\sounds\records

     

    I am not sure, but maybe help you.

×
×
  • Create New...

Important Information

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