-
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
ca41a17
commit f9b6922
Showing
18 changed files
with
257 additions
and
21 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
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
13 changes: 13 additions & 0 deletions
13
...xiamomc/morph/backends/server/renderer/network/datawatcher/values/AbstractFishValues.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 AbstractFishValues extends WaterAnimalValues | ||
{ | ||
public final SingleValue<Boolean> FROM_BUCKET = getSingle(false); | ||
|
||
public AbstractFishValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(FROM_BUCKET); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...in/java/xiamomc/morph/backends/server/renderer/network/datawatcher/values/FrogValues.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 net.minecraft.world.entity.animal.FrogVariant; | ||
|
||
public class FrogValues extends AnimalValues | ||
{ | ||
public final SingleValue<FrogVariant> FROG_VARIANT = getSingle(FrogVariant.TEMPERATE).withRandom(FrogVariant.TEMPERATE, FrogVariant.COLD, FrogVariant.WARM); | ||
|
||
public FrogValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(FROG_VARIANT); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...n/java/xiamomc/morph/backends/server/renderer/network/datawatcher/values/PandaValues.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,18 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.values; | ||
|
||
public class PandaValues extends AnimalValues | ||
{ | ||
public final SingleValue<Integer> BREED_TIMER = getSingle(0); | ||
public final SingleValue<Integer> SNEEZE_TIMER = getSingle(0); | ||
public final SingleValue<Integer> EAT_TIMER = getSingle(0); | ||
public final SingleValue<Byte> MAIN_GENE = getSingle((byte)0); | ||
public final SingleValue<Byte> HIDDEN_GENE = getSingle((byte)0); | ||
public final SingleValue<Byte> FLAGS = getSingle((byte)0); | ||
|
||
public PandaValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(BREED_TIMER, SNEEZE_TIMER, EAT_TIMER, MAIN_GENE, HIDDEN_GENE, FLAGS); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../java/xiamomc/morph/backends/server/renderer/network/datawatcher/values/RabbitValues.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 RabbitValues extends AnimalValues | ||
{ | ||
public final SingleValue<Integer> RABBIT_TYPE = getSingle(0); | ||
|
||
public RabbitValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(RABBIT_TYPE); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...xiamomc/morph/backends/server/renderer/network/datawatcher/values/TropicalFishValues.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 TropicalFishValues extends AbstractFishValues | ||
{ | ||
public final SingleValue<Integer> FISH_VARIANT = getSingle(0); | ||
|
||
public TropicalFishValues() | ||
{ | ||
super(); | ||
|
||
registerSingle(FISH_VARIANT); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
.../xiamomc/morph/backends/server/renderer/network/datawatcher/values/WaterAnimalValues.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,5 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.values; | ||
|
||
public class WaterAnimalValues extends MobValues | ||
{ | ||
} |
2 changes: 1 addition & 1 deletion
2
...tawatcher/watchers/AgeableMobWatcher.java → ...her/watchers/types/AgeableMobWatcher.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
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
32 changes: 32 additions & 0 deletions
32
...iamomc/morph/backends/server/renderer/network/datawatcher/watchers/types/FrogWatcher.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,32 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.watchers.types; | ||
|
||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Frog; | ||
import org.bukkit.entity.Player; | ||
import xiamomc.morph.backends.server.renderer.network.datawatcher.ValueIndex; | ||
|
||
import java.util.Arrays; | ||
|
||
public class FrogWatcher extends LivingEntityWatcher | ||
{ | ||
public FrogWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.FROG); | ||
} | ||
|
||
public Frog.Variant getFrogVariant() | ||
{ | ||
var index = BuiltInRegistries.FROG_VARIANT.getId(get(ValueIndex.FROG.FROG_VARIANT)); | ||
|
||
return Arrays.stream(Frog.Variant.values()).toList().get(index); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.FROG); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ork/datawatcher/watchers/GoatWatcher.java → ...tawatcher/watchers/types/GoatWatcher.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
50 changes: 50 additions & 0 deletions
50
...amomc/morph/backends/server/renderer/network/datawatcher/watchers/types/PandaWatcher.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,50 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.watchers.types; | ||
|
||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Panda; | ||
import org.bukkit.entity.Player; | ||
import xiamomc.morph.backends.server.renderer.network.datawatcher.ValueIndex; | ||
import xiamomc.morph.backends.server.renderer.network.datawatcher.values.PandaValues; | ||
|
||
import java.util.Arrays; | ||
import java.util.Random; | ||
|
||
public class PandaWatcher extends LivingEntityWatcher | ||
{ | ||
public PandaWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.PANDA); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.PANDA); | ||
} | ||
|
||
public Panda.Gene getMainGene() | ||
{ | ||
return Arrays.stream(Panda.Gene.values()).toList().get(get(ValueIndex.PANDA.MAIN_GENE)); | ||
} | ||
|
||
public Panda.Gene getHiddenGene() | ||
{ | ||
return Arrays.stream(Panda.Gene.values()).toList().get(get(ValueIndex.PANDA.HIDDEN_GENE)); | ||
} | ||
|
||
@Override | ||
protected void initValues() | ||
{ | ||
super.initValues(); | ||
|
||
var availableValues = Arrays.stream(Panda.Gene.values()).toList(); | ||
var random = new Random(); | ||
var mainGene = availableValues.get(random.nextInt(availableValues.size())); | ||
var hiddenGene = availableValues.get(random.nextInt(availableValues.size())); | ||
|
||
write(ValueIndex.PANDA.MAIN_GENE, (byte)mainGene.ordinal()); | ||
write(ValueIndex.PANDA.HIDDEN_GENE, (byte)hiddenGene.ordinal()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...momc/morph/backends/server/renderer/network/datawatcher/watchers/types/RabbitWatcher.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,42 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.watchers.types; | ||
|
||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.entity.Rabbit; | ||
import xiamomc.morph.backends.server.renderer.network.datawatcher.ValueIndex; | ||
|
||
import java.util.Arrays; | ||
import java.util.Random; | ||
|
||
public class RabbitWatcher extends LivingEntityWatcher | ||
{ | ||
public RabbitWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.RABBIT); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.RABBIT); | ||
} | ||
|
||
public Rabbit.Type getType() | ||
{ | ||
return Arrays.stream(Rabbit.Type.values()).toList().get(get(ValueIndex.RABBIT.RABBIT_TYPE)); | ||
} | ||
|
||
@Override | ||
protected void initValues() | ||
{ | ||
super.initValues(); | ||
|
||
var availableTypes = Arrays.stream(Rabbit.Type.values()).toList(); | ||
var random = new Random(); | ||
|
||
var targetValue = availableTypes.get(random.nextInt(availableTypes.size())); | ||
write(ValueIndex.RABBIT.RABBIT_TYPE, targetValue.ordinal()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...orph/backends/server/renderer/network/datawatcher/watchers/types/TropicalFishWatcher.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,29 @@ | ||
package xiamomc.morph.backends.server.renderer.network.datawatcher.watchers.types; | ||
|
||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Player; | ||
import xiamomc.morph.backends.server.renderer.network.datawatcher.ValueIndex; | ||
|
||
public class TropicalFishWatcher extends LivingEntityWatcher | ||
{ | ||
public TropicalFishWatcher(Player bindingPlayer) | ||
{ | ||
super(bindingPlayer, EntityType.TROPICAL_FISH); | ||
} | ||
|
||
@Override | ||
protected void initRegistry() | ||
{ | ||
super.initRegistry(); | ||
|
||
register(ValueIndex.TROPICAL); | ||
} | ||
|
||
@Override | ||
protected void initValues() | ||
{ | ||
super.initValues(); | ||
|
||
//todo | ||
} | ||
} |
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