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


  • Posts

  • Joined

  • Last visited

Everything posted by bl4ckscor3

  1. I am still supporting 1.7.10 in the mod I'm writing this for, along with 1.8 and 1.8.9. 1.9.4 and 1.10.2 will be supported, too.
  2. Hi, I have a GUI which opens upon rightclicking a custom item. Basically you can add and remove players to/from the item, and in order to save the players I'm using the ItemStack's NBTTagCompound via player.getCurrentEquippedItem().getTagCompound(). Whenever the NBT data gets changed and the GUI is closed and quickly reopened, I get a serverside crash: This is the method from the item's class where the GUI is opened from: public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if(!par2World.isRemote) { if(!par1ItemStack.hasTagCompound()) { par1ItemStack.stackTagCompound = new NBTTagCompound(); ClientUtils.syncItemNBT(par1ItemStack); } if(aBoolean) par3EntityPlayer.openGui(Main.instance, guiToOpen, par2World, (int) par3EntityPlayer.posX, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ); } return par1ItemStack; } This is ClientUtils.syncItemNBT(): @SideOnly(Side.CLIENT) public static void syncItemNBT(ItemStack item) { Main.network.sendToServer(new PacketSUpdateNBTTag(item)); } The Packet: public class PacketSUpdateNBTTag implements IMessage { private NBTTagCompound stack; private String itemName; public PacketSUpdateNBTTag(ItemStack par1ItemStack) { if(par1ItemStack != null && par1ItemStack.hasTagCompound()) { this.stack = par1ItemStack.stackTagCompound; this.itemName = par1ItemStack.getUnlocalizedName(); } } public void fromBytes(ByteBuf buf) { this.stack = ByteBufUtils.readTag(buf); this.itemName = ByteBufUtils.readUTF8String(buf); } public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, this.stack); ByteBufUtils.writeUTF8String(buf, this.itemName); } public static class Handler extends PacketHelper implements IMessageHandler<PacketSUpdateNBTTag, IMessage> { public IMessage onMessage(PacketSUpdateNBTTag message, MessageContext context) { if(context.getServerHandler().playerEntity.getCurrentEquippedItem() != null && context.getServerHandler().playerEntity.getCurrentEquippedItem().getItem().getUnlocalizedName().matches(message.itemName)) context.getServerHandler().playerEntity.getCurrentEquippedItem().stackTagCompound = message.stack; return null; } } } What causes this crash and how can I fix it? Thanks in advance for any help!
  3. Hello! I'm using the ClientChatReceivedEvent to check for specific words in the message, then giving a sound to the player. But I don't want the sound to play, if the current Player writes that specific word. So I need to get the name of the player who sent the message. I already tried the ClientChatReceivedEvent.message.func_150260_c(); method (which returns the message just as you see it in the chat) and then extracting the players name, but that does not work on servers with custom chat formats, since I search for "<" and ">". Is there any way to get the name without searching for specific symbols in the message and extracting them? Thanks in advance ~bl4ck
  4. Could you post the Handler as well please?
  5. Like I already told you in the Minecraft forums, it may have something todo with the file itself. That was the solution for me. And if your preInit is missing @EventManager and it still doesn't work, try the thing with GoldWaves again. And it is missing the FMLPreInitializationEvent event in the brackets.
  6. Thanks But what is the rarity of some vanilla Item, let's say a music disc? I need a number to navigate with.
  7. Hi guys! What I'd like to do is adding a custom item to a dungeon/mineshaft/stronghold chest. How would I do this?
  8. What do you mean by "you can read from them but not write"?
  9. But that is for a custom Block - I'd like it for the vanilla pumpkin. And without editing the base class...
  10. Thank you so far. But how can I add my Golems to the "Awake-List" without editing BlockPumpkin.java?
  11. Hello guys! I'd like to make a new mob and I want it so that you have to put some blocks down in a specific shape and the mob spawns when placing the Pumpkin (Yes, my mob has a pumpkin as a head ). I already looked at several source codes and I searched the vanilla one for solutions but I couldn't find anything. Can you please help me out?
  12. The sounds are loaded... I'm going to PM you my source code, maybe something is wrong in the depths of it.
  13. package MoreDimensions.music; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemRecord; import net.minecraft.item.ItemStack; import MoreDimensions.MoreDimensions; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class Explosive extends ItemRecord { public Explosive(int id, String recordName) { super(id, recordName); this.maxStackSize = 1; } @SideOnly(Side.CLIENT) public String getRecordTitle() { return "KsTBeats - Explosive"; } @SideOnly(Side.CLIENT) public EnumRarity getRarity(ItemStack par1ItemStack) { return EnumRarity.rare; } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister reg) { this.itemIcon = reg.registerIcon(MoreDimensions.modid + ":record_explosive"); } }
  14. I renamed SoundHandler to SoundLoader while I made this post so a couple things are messed up, but everything is called SoundLoader. I changed everything to soundPoolStraming and to explosive instead of KsTBeats - Explosvie as well as the file name, and it still doesn't work. This is my init part btw: explosiveDisc = new Explosive(explosiveDiscID, modid + ":explosive").setUnlocalizedName("explosiveDisc").setCreativeTab(moreDimensionsSound);
  15. Registering of the SoundLoader in PreInit: MinecraftForge.EVENT_BUS.register(new SoundHandler()); SoundHandler.java: package MoreDimensions.handler; import net.minecraft.client.audio.SoundManager; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import MoreDimensions.MoreDimensions; public class SoundLoader { @SideOnly(Side.CLIENT) @ForgeSubscribe public void onSoundsLoaded(SoundLoadEvent event) { SoundManager manager = event.manager; manager.soundPoolSounds.addSound(MoreDimensions.modid + ":KsTBeats - Explosive.ogg"); manager.soundPoolSounds.addSound(MoreDimensions.modid + ":KsTBeats - Frequenz.ogg"); manager.soundPoolSounds.addSound(MoreDimensions.modid + ":KsTBeats - Recent.ogg"); manager.soundPoolSounds.addSound(MoreDimensions.modid + ":KsTBeats - Rising Again.ogg"); manager.soundPoolSounds.addSound(MoreDimensions.modid + ":KsTBeats - Watching.ogg"); } } My modid is moredimensions and my folder structure is \assets\moredimensions\records\KsTBeats - Explosive.ogg and the other ones. EDIT: I tried mp3 and it didn't work either.
  16. Thank you! The name is fixed now. But what about the sound not playing? I put the file into the right directory
  17. The jukebox accepts the disc, but this text is showing up (Now Playing: C418 - blablabla) and the sound doesn't play. I put the soundfile into /assets/myModid/records/.
  18. Hi! I am trying to make a music disc and I have all set up. Configuration, the class file etc. But I've been searching a while now, for a way to add a song file to the music disc. How can I do this? Oh, and if you need some code, I will post it as soon as possible. Thanks in advance ~bl4ckscor3
  • Create New...

Important Information

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