diff --git a/src/main/java/org/spongepowered/common/data/provider/entity/EntityDataProviders.java b/src/main/java/org/spongepowered/common/data/provider/entity/EntityDataProviders.java index a73ad5946fc..397f528d03d 100644 --- a/src/main/java/org/spongepowered/common/data/provider/entity/EntityDataProviders.java +++ b/src/main/java/org/spongepowered/common/data/provider/entity/EntityDataProviders.java @@ -181,6 +181,7 @@ public void registerProviders() { SlimeData.register(this.registrator); SpellcastingIllagerData.register(this.registrator); SpiderData.register(this.registrator); + StriderData.register(this.registrator); TadpoleData.register(this.registrator); TameableData.register(this.registrator); ThrowableItemProjectileData.register(this.registrator); diff --git a/src/main/java/org/spongepowered/common/data/provider/entity/StriderData.java b/src/main/java/org/spongepowered/common/data/provider/entity/StriderData.java new file mode 100644 index 00000000000..d8c4a45656e --- /dev/null +++ b/src/main/java/org/spongepowered/common/data/provider/entity/StriderData.java @@ -0,0 +1,54 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.spongepowered.common.data.provider.entity; + +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.monster.Strider; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import org.spongepowered.api.data.Keys; +import org.spongepowered.common.data.provider.DataProviderRegistrator; + +public final class StriderData { + + private StriderData() { + } + + // @formatter:off + public static void register(final DataProviderRegistrator registrator) { + registrator + .asMutable(Strider.class) + .create(Keys.IS_SADDLED) + .get(Strider::isSaddled) + .set((h, v) -> { + if (v) { + h.setItemSlot(EquipmentSlot.SADDLE, new ItemStack(Items.SADDLE)); + } else { + h.setItemSlot(EquipmentSlot.SADDLE, ItemStack.EMPTY); + } + }); + } + // @formatter:on +}