-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d162243
commit 87af05b
Showing
15 changed files
with
312 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...va/xiamomc/morph/backends/server/renderer/network/datawatcher/values/MooshroomValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.AnimalValues; | ||
|
||
public class MooshroomValues extends AnimalValues | ||
{ | ||
public final SingleValue<String> VARIANT = getSingle(RED).withRandom(RED, RED, RED, BROWN); | ||
public static final String RED = "red"; | ||
public static final String BROWN = "brown"; | ||
|
||
public MooshroomValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(VARIANT); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...java/xiamomc/morph/backends/server/renderer/network/datawatcher/values/PhantomValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.values; | ||
|
||
public class PhantomValues extends MobValues | ||
{ | ||
public final SingleValue<Integer> SIZE = getSingle(0); | ||
|
||
public PhantomValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(SIZE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...n/java/xiamomc/morph/backends/server/renderer/network/datawatcher/values/SheepValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.values; | ||
|
||
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.basetypes.AnimalValues; | ||
|
||
public class SheepValues extends AnimalValues | ||
{ | ||
public final SingleValue<Byte> WOOL_TYPE = getSingle((byte)0); | ||
|
||
public SheepValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(WOOL_TYPE); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...in/java/xiamomc/morph/backends/server/renderer/network/datawatcher/values/WolfValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.TameableAnimalValues; | ||
|
||
public class WolfValues extends TameableAnimalValues | ||
{ | ||
public final SingleValue<Boolean> BEGGING = getSingle(false); | ||
public final SingleValue<Integer> COLLAR_COLOR = getSingle(14); | ||
public final SingleValue<Integer> ANGER_TIME = getSingle(0); | ||
|
||
public WolfValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(BEGGING, COLLAR_COLOR, ANGER_TIME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...c/morph/backends/server/renderer/network/datawatcher/watchers/types/MooshroomWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 MooshroomWatcher extends LivingEntityWatcher | ||
{ | ||
public MooshroomWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.MUSHROOM_COW); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.MOOSHROOM); | ||
} | ||
|
||
@Override | ||
public void mergeFromCompound(CompoundTag nbt) | ||
{ | ||
super.mergeFromCompound(nbt); | ||
|
||
if (nbt.contains("Type")) | ||
write(ValueIndex.MOOSHROOM.VARIANT, nbt.getString("Type")); | ||
} | ||
|
||
@Override | ||
public void writeToCompound(CompoundTag nbt) | ||
{ | ||
super.writeToCompound(nbt); | ||
|
||
nbt.putString("Type", get(ValueIndex.MOOSHROOM.VARIANT)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...omc/morph/backends/server/renderer/network/datawatcher/watchers/types/PhantomWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 PhantomWatcher extends LivingEntityWatcher | ||
{ | ||
public PhantomWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.PHANTOM); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.PHANTOM); | ||
} | ||
|
||
@Override | ||
public void mergeFromCompound(CompoundTag nbt) | ||
{ | ||
super.mergeFromCompound(nbt); | ||
|
||
if (nbt.contains("Size")) | ||
write(ValueIndex.PHANTOM.SIZE, nbt.getInt("Size")); | ||
} | ||
|
||
@Override | ||
public void writeToCompound(CompoundTag nbt) | ||
{ | ||
super.writeToCompound(nbt); | ||
|
||
nbt.putInt("Size", get(ValueIndex.PHANTOM.SIZE)); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...amomc/morph/backends/server/renderer/network/datawatcher/watchers/types/SheepWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 SheepWatcher extends LivingEntityWatcher | ||
{ | ||
public SheepWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.SHEEP); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.SHEEP); | ||
} | ||
|
||
@Override | ||
public void mergeFromCompound(CompoundTag nbt) | ||
{ | ||
super.mergeFromCompound(nbt); | ||
|
||
if (nbt.contains("Color")) | ||
write(ValueIndex.SHEEP.WOOL_TYPE, nbt.getByte("Color")); | ||
} | ||
|
||
@Override | ||
public void writeToCompound(CompoundTag nbt) | ||
{ | ||
super.writeToCompound(nbt); | ||
|
||
nbt.putByte("Color", get(ValueIndex.SHEEP.WOOL_TYPE)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...ph/backends/server/renderer/network/datawatcher/watchers/types/TameableAnimalWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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 TameableAnimalWatcher extends LivingEntityWatcher | ||
{ | ||
protected TameableAnimalWatcher(Player bindingPlayer, EntityType entityType) | ||
{ | ||
super(bindingPlayer, entityType); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.TAMEABLE); | ||
} | ||
|
||
@Override | ||
public void mergeFromCompound(CompoundTag nbt) | ||
{ | ||
super.mergeFromCompound(nbt); | ||
|
||
if (nbt.contains("Owner")) | ||
{ | ||
write(ValueIndex.TAMEABLE.OWNER, nbt.getUUID("Owner")); | ||
|
||
byte val = get(ValueIndex.TAMEABLE.TAMEABLE_FLAGS); | ||
write(ValueIndex.TAMEABLE.TAMEABLE_FLAGS, (byte)(val | 0x04)); | ||
} | ||
|
||
if (nbt.contains("Sitting")) | ||
{ | ||
byte val = get(ValueIndex.TAMEABLE.TAMEABLE_FLAGS); | ||
|
||
write(ValueIndex.TAMEABLE.TAMEABLE_FLAGS, (byte)(val | 0x01)); | ||
} | ||
} | ||
|
||
@Override | ||
public void writeToCompound(CompoundTag nbt) | ||
{ | ||
super.writeToCompound(nbt); | ||
|
||
var flag = get(ValueIndex.TAMEABLE.TAMEABLE_FLAGS); | ||
nbt.putBoolean("Sitting", (flag & 0x01) == 0x01); | ||
nbt.putUUID("Owner", get(ValueIndex.TAMEABLE.OWNER)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...iamomc/morph/backends/server/renderer/network/datawatcher/watchers/types/WolfWatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 WolfWatcher extends TameableAnimalWatcher | ||
{ | ||
public WolfWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.WOLF); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.WOLF); | ||
} | ||
|
||
@Override | ||
public void mergeFromCompound(CompoundTag nbt) | ||
{ | ||
super.mergeFromCompound(nbt); | ||
|
||
if (nbt.contains("CollarColor")) | ||
write(ValueIndex.WOLF.COLLAR_COLOR, (int)nbt.getByte("CollarColor")); | ||
} | ||
|
||
@Override | ||
public void writeToCompound(CompoundTag nbt) | ||
{ | ||
super.writeToCompound(nbt); | ||
|
||
nbt.putByte("CollarColor", get(ValueIndex.WOLF.COLLAR_COLOR).byteValue()); | ||
} | ||
} |