net.minecraft.network.datasync.EntityDataManager Java Examples

The following examples show how to use net.minecraft.network.datasync.EntityDataManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityBackupZombie.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void applyEntityAI() {
	this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, EntityPigZombie.class));
	this.targetTasks.addTask(4, new EntityAITargetFiltered<>(this, EntityMob.class, false, new Predicate<Entity>() {
		public boolean apply(@Nullable Entity entity) {
			if (entity == null) return false;
			if (entity.getDataManager().getAll() == null) return false;

			boolean success = false;
			for (EntityDataManager.DataEntry<?> entry : entity.getDataManager().getAll()) {
				if (entry.getKey().equals(OWNER)) {
					success = true;
					break;
				}
			}
			if (!success) return false;

			UUID theirOwner = null;
			Object ownerObj = entity.getDataManager().get(OWNER);
			if (ownerObj != null && ownerObj instanceof Optional && ((Optional<?>) ownerObj).isPresent() && ((Optional<?>) ownerObj).get() instanceof UUID)
				theirOwner = entity.getDataManager().get(OWNER).orNull();

			return !(theirOwner != null && getDataManager().get(OWNER).isPresent() && theirOwner.equals(getDataManager().get(OWNER).get()));
		}
	}));
}
 
Example #2
Source File: EntityAnimalWithTypes.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public EntityDataManager getDataManagerI() {
    return this.getDataManager();
}
 
Example #3
Source File: IVariantTypes.java    From CommunityMod with GNU Lesser General Public License v2.1 votes vote down vote up
EntityDataManager getDataManagerI();