Solved Packet Help (If You Would Be So Kind!)

Discussion in 'Plugin Development' started by Jakesully123456, May 28, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Jakesully123456

    Hello,
    Can someone give me some help using packets. I'd like to create a range of effects using particle effects such as 'blood' effect, fire particle effect, etc. I was wondering if someone could perhaps explain how the packet system works, perhaps giving an example. If someone could use the 'blood' effect as an example, that would be very helpful.
    Thanks,
    jakesully
     
  2. Offline

    Agentleader1

    This requires some epic (possibly advanced) trigonometry just to make it look cool.

    But to start off, for 1.7:
    Code:
    PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(String particleType, float xPos, float yPos, float zPos, float xOffset, float yOffset, float zOffset, float something I think amplifier or range, float iForgot);
    For example:
    Code:
    Location loc = player.getLocation();
    PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles("happyVillager",
                                                ((float) (loc.getX())),
                                                ((float) (loc.getY())),
                                                ((float) (loc.getZ())),
                                            0,0,0, 1, 0);
    You can get a full list of particles and their names here: http://minecraft.gamepedia.com/Particles
     
  3. Offline

    Jakesully123456

    @Agentleader1
    What is the PacketPlayOutWorldParticle class? Where can I import it from?
     
  4. Offline

    Agentleader1

    @Jakesully123456
    It's NMS (net minecraft server), and it's import is
    import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
     
  5. Offline

    Jakesully123456

    @Agentleader1 what would be the import on 1.8.3 spigot? (1.8 Ro.1-SNAPSHOT)
     
  6. Offline

    Agentleader1

    @Jakesully123456 v1_8_R1

    But in that case:
    Code:
    new PacketPlayOutWorldParticles(EnumParticle paramEnumParticle, boolean paramBoolean, float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, float paramFloat7, int paramInt, int[] paramArrayOfInt);

    When the templates in eclipse (auto completes) show up, use it, and leave the extra variables that aren't required in the 1.7 particles the way they were given by eclipse.
     
  7. Offline

    Jakesully123456

    @Agentleader1
    I'm using this line to import:
    Code:
    import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles;
    But getting net.minecraft cannot be resolved?
    Do I need to add it as a dependency/repository? If so, how?
     
  8. Offline

    Agentleader1

    @Jakesully123456 If you mean adding the spigot-1.8-snapshot into the external archives, the answer is "OF COURSE!"
     
  9. Offline

    Jakesully123456

    @Agentleader1 No, I have done that of course!
    This line is in my imports, I have the spigot snapshot imported, of course.
    Code:
    import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles;
    But this line is errored under "The import net.minecraft cannot be resolved"
     
  10. Offline

    Agentleader1

  11. Offline

    Jakesully123456

    @Agentleader1 If by build you meant pom file, here. If not, could you elaborate?
    Code:
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>net.noDomainYet</groupId>
        <artifactId>HIDDEN</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <repositories>
            <repository>
                <id>bukkit-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
            </repository>
            <repository>
                <id>vault-repo</id>
                <url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
            </repository>
        </repositories>
        <dependencies>
            <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.8-R0.1-SNAPSHOT</version>
                <type>jar</type>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>net.milkbowl.vault</groupId>
                <artifactId>VaultAPI</artifactId>
                <version>1.5</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>
     
  12. Offline

    Agentleader1

  13. Offline

    Jakesully123456

    @Agentleader1 I see, not comfortable with sharing my code, I'm awfully paranoid. Its also very big. Is there any obvious reason why I might not have access to the net.minecraft package? I'm using Maven, what repositories and dependencies should I have in order to access the net.minecraft package, I am running on spigot 1.8 if that makes a difference.

    I don't mean to be distrustful, and I am very grateful for any help available.
     
  14. Offline

    Agentleader1

  15. Offline

    Jakesully123456

  16. Offline

    Agentleader1

    @Jakesully123456 How do I need to elaborate? I'm just asking for you to send me the full spigot jar file build.


    //Edit:
    Easier solution: world.playEffect(location, Effect.TYPE_OF_EFFECT_HERE, int offset);
     
  17. Offline

    Jakesully123456

    @Agentleader1 I'm sorry, I'm not sure if you want my server jar, or what?
     
  18. Offline

    Agentleader1

    @Jakesully123456 EXACTLY, I want to server jar, of course I'm assuming it is the spigot 1.8 snapshot build you mentioned.
     
  19. Offline

    Jakesully123456

  20. Offline

    Agentleader1

    I imported
    Import Node (open)

    import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles;

    just fine with no errors. ;-;
     
  21. Offline

    Jakesully123456

    @Agentleader1 is there nothing else I need to do? No additional repositories?
    What repositories are in ur pom?
     
  22. Offline

    Agentleader1

    @Jakesully123456 I honestly don't know, take a screenshot of your implemented external archives (including it's order).
     
  23. Offline

    Jakesully123456

  24. Offline

    Agentleader1

    @Jakesully123456 It says you have bukkit implemented. If it's not the spigot build, replace it with the spigot build, and MAKE SURE to have the external archive as FIRST in the order.
     
  25. Offline

    Jakesully123456

    @Agentleader1 how do I ensure its spigot? And how do I make sure its first in the order?
     
  26. Offline

    Agentleader1

    @Jakesully123456 Locate spigot build and see if that is what is said in your list of implemented apis. According to your foto, it looks like it already is.
     
  27. Offline

    Jakesully123456

    OK, and its definitely the first on the list I sent you, so what else could be the issue?
    @Agentleader1
     
  28. Offline

    Agentleader1

  29. Offline

    Jakesully123456

Thread Status:
Not open for further replies.

Share This Page