JitseB / NPCLib

(Minecraft) NPCLib – Basic non-player character library.
MIT License
195 stars 49 forks source link

Support v1_7_R4 (1.7.10) #10

Closed nadecancode closed 5 years ago

JitseB commented 5 years ago

Could you provide a reason as to why you’d like support for 1.7.10 to be added? It seems rather unnecessary to add support for a version which’s base version is 5 years old.

nadecancode commented 5 years ago

I would like to use it on my practice server or some pvp servers. Nobody would use 1.13 as pvp server right lol.

JitseB commented 5 years ago

I've looked into this in the past. 1.7 doesn't support holograms the way I implemented them (as ArmorStands were introduced in 1.8). I'll see what I can do for you.

JitseB commented 5 years ago

Note: Looks like the Minecraft development team remapped its utilities from net.minecraft.util.* to the more appropriate packages (com.mojang.* and io.netty.*).

nadecancode commented 5 years ago

well just use interfaces or reflections

nadecancode commented 5 years ago

You can do similar things as Holographic Displays Use horses to show up

JitseB commented 5 years ago

NPCs do spawn in 1.7.10 now. I still need to re-implement interaction support. I might have to redo a whole bunch of the library to make TinyProtocol work for the separate versions.

As for now, I'm thinking of making the NPC title support single-line only (up to 32 chars). Using horses to make holograms just seems like a lot of redundant work. Perhaps I'll implement it in the future.

If anyone is thinking of making a PR for this, hit me up.

A preview of the 1.7.10 NPCs:

npc v1_7_r4 preview
nadecancode commented 5 years ago

https://github.com/DeprecatedLuke/anticheat-base/blob/master/compatibility/CompatSpigot1_7_R4/src/main/java/com/comphenix/tinyprotocol/v1_7_R4/TinyProtocol.java

1.7.10 TinyProtocol

JitseB commented 5 years ago

The issue is not making TinyProtocol compatible with 1.7.10, the issue lies within NPCLib as it automatically assumes the utilities are in com.mojang.* and io.netty.*, instead of net.minecraft.util.*.

nadecancode commented 5 years ago

So just use this tinyprotocol in your 1.7.10 module. I believe there are some ways to do it.

nadecancode commented 5 years ago

Also I guess you can do that with reflection. I doubt that there would be some big differences between certain methods across netty versions. Basically the game profiles are exactly same, and as well in NGXDEV's Protocol Wrapper (which was provided above named AntiCheat-Base), he implemented the WrappedGameProfile class to make sure the game profile works for multiple versions.

JitseB commented 5 years ago

Finally found some time to make this update. I still need to do some refactoring in order to clean up some of the code.

1.7.10 NPCs also don't allow for multi-line text (yet). Perhaps I'll implement that in the future also.

JitseB commented 5 years ago

Need to find a way to make Travis CI work with the 1.7.10 jar, it keeps giving false fails.

JitseB commented 5 years ago

Support for 1.7.10 has been added.

You can see the release notes (and download files) here: https://github.com/JitseB/NPCLib/releases/tag/v1.4

Level3301 commented 3 years ago

I cant create npcs on 1.7.10 with your examples.

Level3301 commented 3 years ago

My code: `import net.jitse.npclib.NPCLib; import net.jitse.npclib.api.NPC; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {

private NPCLib npclib;

@Override
public void onEnable() {
    this.npclib = new NPCLib(this);
    getServer().getPluginManager().registerEvents(this, this);
}

@EventHandler
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
    if (event.isSneaking()) {
        return;
    }

    NPC npc = npclib.createNPC();
    npc.create(event.getPlayer().getLocation());
    npc.show(event.getPlayer());
}

} `

I have only Main class.

Level3301 commented 3 years ago

sorry, i fixed it

r1verthebest commented 9 months ago

Hello, so, I wanted to report a problem in 1.7, I can create the NPC, however, when I enter 1.7, the name of the npc is not as I left it, it is like [NPC]