Jump to content

FireController1847

Members
  • Posts

    290
  • Joined

  • Last visited

Posts posted by FireController1847

  1. 1. I'm not sure how to tell the difference between EntityPlayer and EntityPlayerSP. The only way I can get EntityPlayer is event.getEntityPlayer();

     

    2. The code below is not working:

     

    PlayerSleepInBedEvent

    package com.fire.testmodclient.Events;
    
    import com.fire.testmodclient.Reference;
    import com.fire.testmodclient.SoundHandler;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.EntityPlayer.SleepResult;
    import net.minecraft.util.SoundCategory;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.World;
    import net.minecraft.world.biome.Biome;
    import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import net.minecraftforge.fml.common.gameevent.TickEvent;
    
    public class PlayerSleep {
    
    @SubscribeEvent
    public void onPlayerSleep(PlayerSleepInBedEvent event){
    	final EntityPlayer player = event.getEntityPlayer();
    	final World world = player.worldObj;
    
    	// world.playSound(player, player.getPosition(), SoundHandler.testSound, SoundCategory.MUSIC, 0.5F, 1F);
    	// player.playSound(SoundHandler.testSound, 1, 1);
    
    	if (event.getResultStatus() == SleepResult.OK) {
    		player.playSound(SoundHandler.testSound, 1.0F, 1.0F);
    	}
    
    }
    
    }
    
    

     

    SoundHandler

    package com.fire.testmodclient;
    
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.util.SoundEvent;
    
    public class SoundHandler {
    
    public static SoundEvent testSound;
    public static SoundEvent testSound2;
    
    private static int size = 0;
    
    public static void init() {
    	size = SoundEvent.REGISTRY.getKeys().size();
    
    	testSound = register(null, "testSound");
    }
    
    public static SoundEvent register(String folder, String name) {
    	ResourceLocation location = new ResourceLocation(Reference.MOD_ID + ":" + name);
    	SoundEvent event = new SoundEvent(location);
    
    	SoundEvent.REGISTRY.register(size, location, event);
    	size++;
    	return event;
    }
    
    }
    

     

    Sounds Json

    {
    "testSound": { 
            "category": "music", 
            "sounds": ["testmodclient:testSound"], 
            "subtitle": "testmodclient.subtitle.testSound" ,
            "stream": true
        }
    }
    

  2. So, I've done everything and it's all there and working, but......

     

    It only plays the sound when I run the command. (It does take a little for the sound to load, but that's because it's a big audio file)

     

    I am using a playersleepevent for example:

    package com.fire.testmodclient.Events;
    
    import com.fire.testmodclient.SoundHandler;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.util.SoundCategory;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.World;
    import net.minecraft.world.biome.Biome;
    import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import net.minecraftforge.fml.common.gameevent.TickEvent;
    
    public class PlayerSleep {
    
    @SubscribeEvent
    public void onPlayerSleep(PlayerSleepInBedEvent event){
    	final Minecraft minecraft = Minecraft.getMinecraft();
    	final EntityPlayer player = event.getEntityPlayer();
    	final World world = player.worldObj;
    
    	world.playSound(player, player.getPosition(), SoundHandler.testSound, SoundCategory.MUSIC, 1, 1);
    
    	System.out.println("Player Sleeping");
    
    	event.setResult(EntityPlayer.SleepResult.OTHER_PROBLEM);
    }
    
    }
    

     

    The command I used that worked:

    /playsound testmodclient:testSound music FireControl1847
    

     

    Edit: Also, how do I get the sound to follow the player, and only the player can hear?

     

    Edit 2: Also also, is there an event for when a sound ends?

  3. Hello! I am currently trying to make a client side mod (my signature), and I am trying to use "onClientTick", but I am not really sure how it works. Could somebody explain to me what it does?

     

    This is my current code:

     

    @SideOnly(Side.CLIENT)
    @SubscribeEvent
    public void onClientTick(ClientTickEvent event) {
    final Minecraft minecraft = FMLClientHandler.instance().getClient();
    final WorldClient world = minecraft.theWorld;
    final EntityPlayerSP player = minecraft.thePlayer;
    
    System.out.println("Client Event");
    }
    

     

    "Client Event" is not being printed out into console at all, so is it even doing anything?

     

    Edit: I am reading an outdated wiki, and it says something like registering the event.. How do I do that? O.o

  4. ...what and where should I get started?

     

    I am a beginner mod maker, and I want to know what I would need to learn to make something like matmos (I know how to make blocks, items, and custom OBJ/JSON models. I also know most of java and will understand the difference between classes and methods) I do want to make this for 1.7.10, and then as well make it for 1.8+. The reasoning for this, is because my only modpack is version 1.7.10. Now before you go start saying "1.7.10 isn't supported!!!!!!!!NDJ:Owhoijgwreshfgsf", I KNOW THAT. I am going to make it for 1.10.2 first, and first of ALL. Then, I will start to learn and understand how to downgrade it instead of upgrade it.

     

    The features I want to implement into the mod:

    • Wind sounds when high above the ground
    • Biome specific sounds like birds chirping
    • Block specific sounds when you're next to water or lava
    • Rain sounds for when its raining (Ex. Walking in puddles, walking on grass)
    • Improved sounds for walking and things like that
    • Sounds for when you're falling for flying

    I understand this is a big project, but please tell me what I need to learn so I can get the basic guidelines down to doing this. I don't need you to teach me, just tell me what they are. If it's even possible, please tell me. What I am hoping you'll be able to give me is information about what I need to do (ex. make events), what most of the event names are or linking me to a event list, and the big one is how to implement sounds.

     

     

    Please and thank you!  ;D

  5. thanks alot for the fast response but can someone please give a dumber working example that i would understand? me' brain iz stuck on that IForgeRegistryEntry or whatever...

     

    It is not recommended by me, but you can if you'd like go to my wiki here. It's kind of confusing and unstable, but it should get you to understand how all this new nonsense works.

     

    And I am sorry all you forge modders who didn't want me to do this... To be honest soon I will be improving that wiki so it's not to a point of utter horribleness. And don't tell me to update the official one; personally I hate the layout of it and it doesn't match the way I like to do things.

  6. The new way of registering blocks is mainly you have to register the item and then the block. So first off, you have to register an item. Make a function where you get an item from the block, and then make a function that renders the blockitem like you would an item.

     

    Ex. function1 : RegisterBlockItem()

     

    Ex. function2 : RegisterItem(Item item)

     

    And then, from wherever (suggested to put in the block file), you have to give it a registry name, and use ModelLoader.SetCustomResourceModelLocation() to register the item. You can get an item from a block by doing item.getItemFromBlock(Block)

     

    And then you register the block and item like you would normally register something.

     

    This is how I would set up my InitBlocks file:

     

    width=800 height=451http://vignette1.wikia.nocookie.net/minecraft-forge-tutorials/images/2/26/Code1-1.png/revision/latest?cb=20160606015651[/img]

    This is an image from this wiki.

  7. One of your mods is sending an invalid packet.

    Stop using 1.7.10.

     

    Diesie, most of the best mods are still only for 1.7.10, and 1.7.10 will most likely be the next 1.2.5 in modding. It's the main one that most people use, and it's still probably going to be used years from now. Yes, if you're developing new mods of course I'd say go use the latest version, but if you're putting together a modpack I'd suggest 1.7.10, as most of the mods are updated to that.

     

    As well as that, many mod creators gave up when they saw 1.8 come out, which was really saddening, but it happened. As well as what happened on 1.2.5, where a lot of mod creators gave up, people are pushing through. 1.7.10 may not be the best, but it's certainly there.

     

    Finally, I personally find Optifine, Fastcraft, and many of the alike run best with 1.7.10 compared to 1.10.2, as the game is less laggy, most mods are in a stable build, and it's super easy to do many things.

     

    Overall, 1.7.10 was a great version for mods and modpacks like, and yes I do agree that we need to update, but for adventure modpacks (not tech.), magical, and wizardry I would suggest 1.7.10.

×
×
  • Create New...

Important Information

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