Releases: CryptoMorin/XSeries
v11.2.1
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>11.2.1</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:11.2.1")
}
Important
Don't forget to shade the library.
- Added v1.21 support.
- Added Object and CharSequence as predefined classes for ReflectionParser.
- ReflectionParser class declarations now support simple generics.
- XSkull will now more lenient with proxy reflection errors.
- Fixed particle deserialization from conkfig when no particle size is specified for dust particles.
- XReflection parameter and return types are now lazy.
v11.2.0.1
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>11.2.0.1</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:11.2.0.1")
}
Important
Don't forget to shade the library.
- XItemStack#parseColor now accepts hex colors
- XSkull Profileables are now nullable for certain types.
- Fixed XSkull proxy reflection issues on v1.18.1-1.19.4
- Removed all usage of the old XReflection within XSeries code.
- Fixed a few issues with NMSExtras.
- Due to people reporting "NMS_VERSION" from getVersionInformation() returning null, it was changed to "Unknown NMS" instead.
- Fixed an issue where trying to reflect a class handle with no names provided didn't provide a proper error.
- Added more Javadocs.
v11.2.0
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>11.2.0</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:11.2.0")
}
Important
Don't forget to shade the library.
- Fixed a lot of issues with
XSkull
- Added more documentations to
XReflection
with a few renames and bug fixes. - Added enum support for
XReflection
. - Changed the default material for
XItemStack
.
v11.1.0
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>11.1.0</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:11.1.0") { isTransitive = false }
}
Important
Don't forget to shade the library.
v1.21 Support
XSkull
- Moved to another package. Classes have been split.
- Made non-API methods private inside XSkull.
- Fixed UUID detection as string values.
- Fixed a few issues with offline/online UUID profiles and their cachex.
- Added a lenient() and fallback() method to XSkull.
- Allows HTTPS requests for texture links.
XReflection
- Added more predefined classes to ReflectionParser.
- Added inner class support to XReflection
Others
- The of(String) method of
XParticle
&XEntityType
now return Optional.
v11.0.0
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>11.0.0</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:11.0.0") { isTransitive = false }
}
Important
Don't forget to shade the library.
Quick Code Update
I'm very sorry for the class renames. It had to be done at some point.
You could simply do a RegEx replace in this order (unfortunately IntelliJ's Migrate feature doesn't work for nonexisting
classes properly):
- ReflectionUtils
- Replace
import (static )?com.cryptomorin.xseries.ReflectionUtils
withimport $1com.cryptomorin.xseries.reflection.XReflection
- Replace
ReflectionUtils
withXReflection
- Replace
(XReflection.)?sendPacket(Sync)?\(
withMinecraftConnection.sendPacket(
- For people who want to use the new ClassHandle API:
(?:XReflection\.)?getNMSClass\(([\w."] ), ([\w"] )\)
->XReflection.ofMinecraft().inPackage(MinecraftPackage.NMS, $1).named($2).unreflect()
(?:XReflection\.)?getCraftClass\("(?:([\w\.] )(?:\.))?(\w )"\)
->XReflection.ofMinecraft().inPackage(MinecraftPackage.CB, "$1").named("$2").unreflect()
- Replace
- NMSExtras
- Replace
import (static )?com.cryptomorin.xseries.NMSExtras
withimport $1com.cryptomorin.xseries.reflection.minecraft.NMSExtras
- Replace
- SkullUtils
- Replace
SkullUtils
withXSkull
- Replace
XSkull.applySkin\(([^,] ), ([\w\d_] )\)
withXSkull.of($1).profile($2).apply()
- Replace
You may have to update some parts manually yourself after this replacement.
XReflection (Former ReflectionUtils)
Completely revamped. ReflectionUtils has been split into so many classes. While I understand this might upset some
people because
they now have to include an entire package for ReflectionUtils-dependent classes to work, the class was becoming
almost unmaintainable from all the clutter. Most of these new features are experimental and might change in the future.
- Now has a functional API.
- Added string-based reflection which works specially well in IntelliJ because of the syntax highlighting support. The
performance of this approach is obviously much worse, but since this should only be done once (even if you're using
the functional approach, you should cache all reflection calls), the readability advantages far outweigh the
performance disadvantage.
void functionalAPI() {
MinecraftClassHandle CraftMetaSkull = XReflection.ofMinecraft()
.inPackage(MinecraftPackage.CB, "inventory")
.named("CraftMetaSkull");
MethodHandle profileGetterMeta = CraftMetaSkull.getterField()
.named("profile")
.returns(GameProfile.class)
.makeAccessible()
.reflect();
}
void stringAPI() {
// Normally all classes you pass to a namespace are visible
// (classes created from XReflection handle methods or passed to parameter(), return(), etc methods)
// But sometimes the only way to make these classes visible would be to import them manually here.
// You can avoid doing this and use fully qualified names instead inside strings.
ReflectiveNamespace ns = XReflection.namespaced().imports(GameProfile.class);
// There are shorthand names for packages like "nms", "spigot" and "cb"
// The "extends CraftMetaItem implements SkullMeta" is completely useless and
// only included for brevity (doesn't affect anything if the found class doesn't implement the specified classes).
MinecraftClassHandle CraftMetaSkull = ns.ofMinecraft(
// This code will be highlighted when used in IntelliJ:
"package cb.inventory; class CraftMetaSkull extends CraftMetaItem implements SkullMeta {}"
);
MethodHandle profileGetterMeta = CraftMetaSkull.field("private GameProfile profile;")
.map(MinecraftMapping.OBFUSCATED, "a") // You can mix functional and string APIs
.getter().reflect();
}
XSkull (Former SkullUtils)
XSkull was completely revamped, all thanks to @Condordito
- It now supports offline mode servers and has a more robust API.
- Fixed some issues with detecting the correct skin value passed.
XBlock
- Removed deprecated methods from XBlock.
- Fixed an issue with setting skulls using XBlock.setType()
Others
- Fixed
Data.NAME_MAPPING
forXParticle
andXEntityType
. - Fixed a bug with
ParticleDisplay
on older versions. - Fixed legacy support for
XPotion
. - Fixed an issue with
XWorldBorder
in outdated servers. - Fixed
withLocationCaller()
forParticles
class. - Removed the deprecated
XMaterial.isOneOf()
andXMaterial.matchXMaterial(int id, byte data)
- Fixed a lot of issues in
XParticle
thanks to @CJCrafter
v10.0.0
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>10.0.0</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:10.0.0") { isTransitive = false }
}
Important
Don't forget to shade the library.
- Added v1.20.6 (and v1.20.5?) support.
- Added XEntityType
- Added XParticle
- Renamed XParticle to Particles
- Added Experimental API to ReflectionUtils
v9.10.0
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.10.0</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:9.10.0") { isTransitive = false }
}
Important
Don't forget to shade the library.
Updated license year.
NMSExtras
- Fixed an error in 1.18.2 servers.
XItemStack
- No longer changes the unbreakable state if not specified in the config.
- Fixed a few errors in v1.9 servers.
ReflectionUtils
- Now compatible with Paper's no-relocation strategy.
- Removed the deprecated getArrayClass()
XBlock
- Added cocoa to crops material list.
- Fixed setRotation() and getRotation() for pre-1.13 versions.
- Fixed setType() for skulls in some pre-1.13 versions.
XMaterial
- Added an experimental Material class for Bukkit Forge abstraction.
XSound
- Fixed an issue with SoundCategory in v1.11 servers and below.
v9.9.0
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.9.0</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:9.9.0") { isTransitive = false }
}
Important
Don't forget to shade the library.
XItemStack
- Only set "effects" when not empty.
- Added a translator function to serialize method.
ParticleDisplay
- Fixed errors caused by using withEntity() method.
- Quaternion -> Added mul(Vector)
- Improved Quaternion cache.
- Replaced onSpawn() with postCalculation()
- Fixed a few issues with commutative rotations.
- A lot of methods have been deprecated and you should update.
v9.8.1
Maven
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.8.1</version>
</dependency>
Gradle
repositories {
mavenCentral()
}
dependencies {
implementation("com.github.cryptomorin:XSeries:9.8.1") { isTransitive = false }
}
Warning
Don't forget to shade the library.
SkullUtils
- Added setProfile(SkullMeta, GameProfile)
XSound
- Since paper now blocks async location-based sound plays (PaperMC/Paper#10021), I decided to use my own system.
- Added namespaced sounds, category and seed support.
- All parameters are now variable now (can be changed at any time)
NMSExtras
- Fixed an issue with BLOCK_POSITION for chest() command.
- Fixed data registry error with 1.19.4
v9.8.0
Updated for 1.20.4
XItemStack
- Fixed an error caused in the latest v1.9.4 versions.
SkullUtils
- Fixed some caching issues with online mode servers in rare cases.
- Fixed skull texture URL detector for rare URLs.