Skip to content

Commit

Permalink
Piglin
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Dec 15, 2023
1 parent 6964f4c commit 7fba98f
Show file tree
Hide file tree
Showing 26 changed files with 121 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.*;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.*;

public class ValueIndex
{
Expand Down Expand Up @@ -29,4 +30,5 @@ public class ValueIndex
public static final VillagerValues VILLAGER = new VillagerValues();
public static final SnowGolemValues SNOW_GOLEM = new SnowGolemValues();
public static final CreeperValues CREEPER = new CreeperValues();
public static final PiglinValues PIGLIN = new PiglinValues();
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public WatcherIndex()
setTypeWatcher(EntityType.VILLAGER, VillagerWatcher::new);
setTypeWatcher(EntityType.SNOWMAN, SnowGolemWatcher::new);
setTypeWatcher(EntityType.CREEPER, CreeperWatcher::new);
setTypeWatcher(EntityType.PIGLIN, PiglinWatcher::new);
}

private void setTypeWatcher(EntityType type, Function<Player, SingleWatcher> func)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AgeableMobValues;

public class AnimalValues extends AgeableMobValues
{
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import net.minecraft.core.Rotations;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.LivingEntityValues;

public class ArmorStandValues extends LivingEntityValues
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.animal.CatVariant;
import org.bukkit.entity.Cat;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.TameableAnimalValues;

public class CatValues extends TameableAnimalValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AbstractHorseValues;

public class HorseValues extends AbstractHorseValues
{
public final SingleValue<Integer> HORSE_VARIANT = getSingle(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.ChestedHorseValues;

public class LlamaValues extends ChestedHorseValues
{
public final SingleValue<Integer> SLOTS = getSingle(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.LivingEntityValues;

public class MobValues extends LivingEntityValues
{
public final SingleValue MOB_FLAGS = getSingle((byte)0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.TameableAnimalValues;

public class ParrotValues extends TameableAnimalValues
{
public final SingleValue<Integer> PARROT_VARIANT = getSingle(0).withRandom(0, 1, 2, 3, 4);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.BasePiglinValues;

public class PiglinValues extends BasePiglinValues
{
public final SingleValue<Boolean> IS_BABY = getSingle(false);
public final SingleValue<Boolean> CHARGING_CROSSBOW = getSingle(false);
public final SingleValue<Boolean> DANCING = getSingle(false);

public PiglinValues()
{
super();

registerSingle(IS_BABY, CHARGING_CROSSBOW, DANCING);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.LivingEntityValues;

public class PlayerValues extends LivingEntityValues
{
public final SingleValue<Float> ABSORPTION_AMOUNT = getSingle(0f);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AbstractGolemValues;

public class SnowGolemValues extends AbstractGolemValues
{
public final SingleValue<Byte> HAT_FLAGS = getSingle(HAS_PUMPKIN); //.withRandom(HAS_PUMPKIN, NO_PUMPKIN);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AbstractFishValues;

public class TropicalFishValues extends AbstractFishValues
{
public final SingleValue<Integer> FISH_VARIANT = getSingle(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.world.entity.npc.VillagerData;
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraft.world.entity.npc.VillagerType;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AbstractVillagerValues;

public class VillagerValues extends AbstractVillagerValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

public class AbstractFishValues extends WaterAnimalValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.MobValues;

public class AbstractGolemValues extends MobValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

public class AbstractHorseValues extends AgeableMobValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

public class AbstractVillagerValues extends AgeableMobValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.MobValues;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

public class AgeableMobValues extends MobValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.MonsterValues;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

public class BasePiglinValues extends MonsterValues
{
public final SingleValue<Boolean> IMMUNE_TO_ZOMBIFICATION = getSingle(true);

public BasePiglinValues()
{
super();

registerSingle(IMMUNE_TO_ZOMBIFICATION);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AbstractHorseValues;

public class ChestedHorseValues extends AbstractHorseValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Pose;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.AbstractValues;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import net.minecraft.core.BlockPos;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.AnimalValues;
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.SingleValue;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.values;
package xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes;

import xiamomc.morph.backends.server.renderer.network.datawatcher.values.MobValues;

public class WaterAnimalValues extends MobValues
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.watchers.types;

import net.minecraft.nbt.CompoundTag;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import xiamomc.morph.backends.server.renderer.network.datawatcher.ValueIndex;

public class PiglinWatcher extends LivingEntityWatcher
{
public PiglinWatcher(Player bindingPlayer)
{
super(bindingPlayer, EntityType.PIGLIN);
}

@Override
protected void initRegistry()
{
super.initRegistry();

register(ValueIndex.PIGLIN);
}

@Override
public void mergeFromCompound(CompoundTag nbt)
{
super.mergeFromCompound(nbt);

if (nbt.contains("IsBaby"))
write(ValueIndex.PIGLIN.IS_BABY, nbt.getBoolean("IsBaby"));

//if (nbt.contains("IsImmuneToZombification"))
// write(ValueIndex.PIGLIN.IMMUNE_TO_ZOMBIFICATION, nbt.getBoolean("IsImmuneToZombification"));
}
}

0 comments on commit 7fba98f

Please sign in to comment.