Serializes Entities, Basically converting them to namespacedkeys that can be used later, not exactly serializing with its common definition

Overview

EntitySerializer

CodeFactor

Serializes Entities, Basically converting them to namespacedkeys that can be used later, not exactly serializing with its common definition.

Note:

  • This will only work for 1.17.1+
  • Only use classes EntitySerializer, and classes inside api package.

Easily turn an entity into a namespacedkey of the name of your choice, then turn it back into an entity.

Credits to: gizmonster for giving me the idea of using StructuresAPI Introduced in 1.17.1

Installation

For MAVEN: Add this to your repositories

<repository>
    <id>jitpack.ioid>
    <url>https://jitpack.iourl>
repository>

Then add this to your dependencies

<dependency>
   <groupId>com.github.2HexgroupId>
   <artifactId>EntitySerializerartifactId>
   <version>Tagversion>
dependency>

For GRADLE:

Use this:

  allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

And the dependency:

	dependencies {
implementation 'com.github.2Hex:EntitySerializer:Tag'
}

Usage

First, you have to create an object of EntitySerializer in your onEnable:

EntitySerializer entitySerializer = EntitySerializer.create(this);

Then make a variable, referencing the class EntityHandler:

private static EntityHandler handler;

then on your onEnable again:

handler = entitySerializer.getEntityHandler();

Then make a static getter:

public static EntityHandler getHandler() {
        return handler;
}

Then later in whatever class, you can use

NamespacedKey namespacedkey = new NamespacedKey(pluginInstance, "your-key-here");
YourMainClass.getHandler().serialize(entity, namespackedkey);
EntityHolder entityDeserialized = YourMainClass.getHandler().deserialize(namespacedkey);

Note that you should have a unique namespacedkey for each unique entity serialization.

You can invoke spawnAndGet() (which will return the entity and spawn it) on the EntityHolder later, or spawn.

And to Destroy a serialization (Remove its access, and its place in server storage) Use:

YourMainClass.getHandler().destroy(namespacedkey)
You might also like...

This is a Meme repo for fixed & Cleaned source of 'Better'Bungeecord but its not realy better code is trash!

#Fucking cleaned by CryCodes Disclaimer: Based of MD_5's Bungeecord (Fork of "BetterBungee") | I am not the owner of the code This repo is just for fu

Jan 2, 2022

GitHub Search Engine: Web Application used to retrieve, store and present projects from GitHub, as well as any statistics related to them.

GHSearch Platform This project is made of two subprojects: application: The main application has two main responsibilities: Crawling GitHub and retrie

Nov 25, 2022

Test if a request/response matches a given raml definition

raml-tester Test if a request/response matches a given raml definition. Versioning Version Contents 0.8.x Stable version, uses RAML parser 0.8.x and s

Mar 21, 2022

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.

Socket.IO-client Java This is the Socket.IO Client Library for Java, which is simply ported from the JavaScript client. See also: Android chat demo en

Jan 4, 2023

Converting Infix to Postfix and Evaluating Postfix Expression. (Java & Scala).

GUI-Calculator-Infix-to-Postfix Converting Infix to Postfix and Evaluating Postfix Expression. (Java & Scala). Converting Infix to Postfix and Evaluat

Sep 22, 2022

Library for converting from one Java class to a dissimilar Java class with similar names based on the Bean convention

Library for converting from one Java class to a dissimilar Java class with similar names based on the Bean convention

Beanmapper Beanmapper is a Java library for mapping dissimilar Java classes with similar names. The use cases for Beanmapper are the following: mappin

Nov 15, 2022

documents4j is a Java library for converting documents into another document format

documents4j is a Java library for converting documents into another document format. This is achieved by delegating the conversion to any

Dec 23, 2022

Kyrestia, named after Kyrestia the Firstborne, is a process engine supporting mainstream process definition standards.

Kyrestia Kyrestia, named after Kyrestia the Firstborne, is a process engine supporting mainstream process definition standards. It is not only lightwe

Feb 22, 2022

SynchronizeFX - a library for JavaFX 2 and later that enables property bindings between different JVMs

SynchronizeFX - a library for JavaFX 2 and later that enables property bindings between different JVMs

SynchronizeFX - a library for JavaFX 2 and later that enables property bindings between different JVMs, both on a local computer and over the network.

Jul 24, 2020

RR4J is a tool that records java execution and later allows developers to replay locally.

RR4J is a tool that records java execution and later allows developers to replay locally.

RR4J [Record Replay 4 Java] RR4J is a tool that records java execution and later allows developers to replay locally. The tool solves one of the chall

Dec 7, 2022

Archinsight project tends to implement architecture-as-code definition of a standard c4 architecture model

Archinsight project tends to implement architecture-as-code definition of a standard c4 architecture model. This project offers a new Insight language designed in such way that an Architect can focus on architecture definition, not visualization. Compared to UML, the Insight language is more specific and is unable to describe an arbitrary entity, but shorter and probably easier to use.

Nov 24, 2022

A Java library for serializing objects as PHP serialization format.

Java PHP Serializer Latest release: A Java library for serializing objects as PHP serialization format. The library fully implements the PHP serializa

Jun 13, 2022

Dynamically filters JPA entities with a simple query syntax. Provides JPA/Hibernate predicates and Spring Data specifications.

Spring Filter You need a way to dynamically filter entities without any effort? Just add me to your pom.xml. Your API will gain a full featured search

Dec 13, 2022

HATEOAS with HAL for Java. Create hypermedia APIs by easily serializing your Java models into HAL JSON.

hate HATEOAS with HAL for Java. Create hypermedia APIs by easily serializing your Java models into HAL JSON. More info in the wiki. Install with Maven

Oct 5, 2022

An experimental mod that converts some block entities to blockstates. This is done for performance & functionality reasons.

An experimental mod that converts some block entities to blockstates. This is done for performance & functionality reasons.

BetterBlockStates An experimental mod that converts some block entities to blockstates. This is done for performance & functionality reasons. Current

Sep 17, 2022

Java libraries for serializing, deserializing, and manipulating JSON values

java-json-toolkit The json-toolkit repository contains the code to the following libraries: json-toolkit-text: basic library for conversion between te

Jan 26, 2022

A mod that lets you create "contracts" that transfer ownership of pets and other tameable entities.

A mod that lets you create

Pet Transfer A simple mod for Fabric that lets you create contracts that can transfer ownership of pets and other tameable creatures. No Forge port pl

Jan 14, 2022
Releases(v1.1)
Owner
2Hex
Java developer :)
2Hex
A Java Redis PubSub helper which let you send full objects without need of manual serializing

A Java Redis PubSub helper which let you send full objects without need of manual serializing

Andy 8 Nov 30, 2022
java common utils library

java-common-utils java common utils library 一个简单的Java通用工具类,目前的设想,包括简化异常处理工具、简易限流处理工具等 ExceptionHandler, 目标简化try catch的代码冗余度

xuangy 2 Jan 21, 2022
A beta mindustry mod, this mod not uploaded on mindustry until a new release has been released

Project EPL A beta mindustry mod, this mod not uploaded on mindustry until a new release has been released. the way you can compile/implement it is in

ExplerHD 2 Feb 4, 2022
Pass variables into methods based off name, not position.

Named Arguments are a feature that many languages lack. Some call it Feature Envy. The Problem You have a menu() method that prints out a 5 option men

Xavier D 3 Jul 1, 2022
Mint 0.1.1 public release, HWID System removed. Feel free to use. (Note: for all of u thinking its ratted; its not.)

Mint By: zPrestige_ | ! zPrestige_#1514 | git Kambing | dragonhacker32_#3091 | git FB | FB#7334 | git ZenovJB | Zenov#0603 | git Support no support No

null 17 Dec 2, 2022
A fairly Simple Game made in Java,You can adopt Pets, name them, and take care of them for XpPoints and level up!

Introducing PetGame! A simple console based game made by @denzven in Java ☕ About the Game PetGame is my first big project in Java, the rules are simp

Denzven 11 Jun 7, 2022
Presti 5 Nov 19, 2022
Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Android Auto Apps Downloader (AAAD) is an app for Android Phones that downloads popular Android Auto 3rd party apps and installs them in the correct way to have them in Android Auto.

Gabriele Rizzo 865 Jan 2, 2023
My first proper GitHub project, I guess. Basically an automated version of the "Battle Royale" short series on Geo Facts' YouTube channel.

State-Royale Made by Pixer415, with some help from ThatOneCalculator This project needs your contributions. New modes/new features/typo fixes/suggesti

null 2 Jun 27, 2022
Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.

twitter-text This repository is a collection of libraries and conformance tests to standardize parsing of Tweet text. It synchronizes development, tes

Twitter 2.9k Jan 8, 2023