-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Akinesis/1.21.1-more-foxes
1.21.1 more foxes
- Loading branch information
Showing
55 changed files
with
558 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Add more foxes variant, both of vanillia spawnable foxes and new biome specifics foxes (E.G.: Nether or End). | ||
|
||
Additional foxes Texures from : <br /> | ||
https://modrinth.com/resourcepack/formidable-foxes <br /> | ||
https://www.planetminecraft.com/member/arianwyn/ <br /> | ||
https://www.planetminecraft.com/texture-pack/more-foxes/ <br /> |
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
12 changes: 12 additions & 0 deletions
12
src/main/generated/data/minecraft/tags/block/foxes_spawnable_on.json
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,12 @@ | ||
{ | ||
"values": [ | ||
"minecraft:netherrack", | ||
"minecraft:sculk", | ||
"minecraft:sculk_vein", | ||
"minecraft:end_stone", | ||
"#minecraft:nylium", | ||
"minecraft:soul_sand", | ||
"minecraft:soul_soil", | ||
"#minecraft:sand" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/generated/data/vulpine/tags/worldgen/biome/has_desert_fox.json
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,6 @@ | ||
{ | ||
"values": [ | ||
"#c:is_desert", | ||
"minecraft:badlands" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/generated/data/vulpine/tags/worldgen/biome/has_ended_fox.json
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,6 @@ | ||
{ | ||
"values": [ | ||
"#c:is_outer_end_island", | ||
"minecraft:the_end" | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/generated/data/vulpine/tags/worldgen/biome/has_nether_fox.json
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,7 @@ | ||
{ | ||
"values": [ | ||
"#c:is_nether_forest", | ||
"minecraft:soul_sand_valley", | ||
"minecraft:nether_wastes" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/generated/data/vulpine/tags/worldgen/biome/has_sculk_fox.json
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 @@ | ||
{ | ||
"values": [ | ||
"minecraft:deep_dark" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/generated/data/vulpine/tags/worldgen/biome/has_snow_fox.json
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 @@ | ||
{ | ||
"values": [ | ||
"#minecraft:spawns_snow_foxes" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/generated/data/vulpine/tags/worldgen/biome/has_taiga_fox.json
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 @@ | ||
{ | ||
"values": [ | ||
"#c:is_taiga" | ||
] | ||
} |
114 changes: 114 additions & 0 deletions
114
src/main/java/sh/talonfox/vulpine/FoxVariantSelector.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,114 @@ | ||
package sh.talonfox.vulpine; | ||
|
||
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags; | ||
import net.minecraft.component.DataComponentTypes; | ||
import net.minecraft.component.type.NbtComponent; | ||
import net.minecraft.entity.EntityData; | ||
import net.minecraft.entity.passive.FoxEntity; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.nbt.NbtElement; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.registry.tag.BiomeTags; | ||
import net.minecraft.registry.tag.EntityTypeTags; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.biome.BiomeKeys; | ||
import net.minecraft.world.dimension.DimensionType; | ||
import net.minecraft.world.dimension.DimensionTypes; | ||
import sh.talonfox.vulpine.registry.ModMobTags; | ||
|
||
import javax.swing.plaf.ViewportUI; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public abstract class FoxVariantSelector { | ||
|
||
private static Random rand = Random.create(); | ||
|
||
public static List<FoxEntity.Type> SNOW_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> DEFAULT_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> DESERT_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> TAIGA_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> NETHER_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> ENDER_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> SCULK_VARIANT = new ArrayList(); | ||
public static List<FoxEntity.Type> MONSTER_VARIANT = new ArrayList(); | ||
|
||
private static FoxEntity.Type randomDefaultVariant(){ | ||
return DEFAULT_VARIANT.get(rand.nextInt(DEFAULT_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomSnowVariant(){ | ||
return SNOW_VARIANT.get(rand.nextInt(SNOW_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomTaigaVariant(){ | ||
return TAIGA_VARIANT.get(rand.nextInt(TAIGA_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomNetherVariant(){ | ||
return NETHER_VARIANT.get(rand.nextInt(NETHER_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomDesertVariant(){ | ||
return DESERT_VARIANT.get(rand.nextInt(DESERT_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomEnderVariant(){ | ||
if(rand.nextInt(100) < 10) | ||
return Vulpine.TALON; //10% Chance to spawn TALON variant. I think it fit well in the END | ||
return ENDER_VARIANT.get(rand.nextInt(ENDER_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomMonsterVariant(){ | ||
return MONSTER_VARIANT.get(rand.nextInt(MONSTER_VARIANT.size())); | ||
} | ||
|
||
private static FoxEntity.Type randomSculkVariant(){ | ||
return SCULK_VARIANT.get(rand.nextInt(SCULK_VARIANT.size())); | ||
} | ||
|
||
private static boolean shouldSpawnMonster(World foxWorld){ | ||
DimensionType dim = foxWorld.getDimensionEntry().value(); | ||
boolean shouldSpawnMonster = foxWorld.getRegistryKey() == World.OVERWORLD; | ||
shouldSpawnMonster = shouldSpawnMonster & foxWorld.isNight(); | ||
return shouldSpawnMonster & rand.nextInt(100)<15; //15% to spawn monster version at night in overwolrd. | ||
} | ||
|
||
public static FoxEntity.Type selectFoxVariant(FoxEntity foxEntity, RegistryEntry<Biome> foxBiome){ | ||
|
||
if(shouldSpawnMonster(foxEntity.getEntityWorld())) | ||
return randomMonsterVariant(); | ||
|
||
if(foxBiome.isIn(ModMobTags.HAS_NETHER_FOX)){ | ||
return randomNetherVariant(); | ||
} | ||
|
||
if(foxBiome.isIn(ModMobTags.HAS_DESERT_FOX)){ | ||
return randomDesertVariant(); | ||
} | ||
|
||
if(foxBiome.isIn(ModMobTags.HAS_SNOW_FOX)){ | ||
return randomSnowVariant(); | ||
} | ||
|
||
if(foxBiome.isIn(ModMobTags.HAS_TAIGA_FOX)){ | ||
if(foxBiome.isIn(ConventionalBiomeTags.IS_SNOWY)) | ||
return randomSnowVariant(); | ||
else | ||
return randomTaigaVariant(); | ||
} | ||
|
||
if(foxBiome.isIn(ModMobTags.HAS_SCULK_FOX)){ | ||
return randomSculkVariant(); | ||
} | ||
|
||
if(foxBiome.isIn(ModMobTags.HAS_ENDER_FOX)){ | ||
return randomEnderVariant(); | ||
} | ||
|
||
return randomDefaultVariant(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package sh.talonfox.vulpine; | ||
|
||
import net.minecraft.util.Identifier; | ||
|
||
public class ModFoxType { | ||
private String variantName; | ||
private Identifier textureIdentifier; | ||
private Identifier sleepingTextureIdentifier; | ||
|
||
public ModFoxType(String variantName) { | ||
this.variantName = variantName; | ||
textureIdentifier = Identifier.of(Vulpine.MOD_ID,"textures/entity/fox/"+variantName+".png"); | ||
sleepingTextureIdentifier = Identifier.of(Vulpine.MOD_ID,"textures/entity/fox/"+variantName+"_sleep.png"); | ||
; } | ||
|
||
public Identifier getTextureIdentifier(boolean isSleepling) { | ||
return isSleepling?sleepingTextureIdentifier:textureIdentifier; | ||
} | ||
} |
Oops, something went wrong.