Skip to content

Commit

Permalink
Rename gazelle variants, add head 2d textures, add selective types to…
Browse files Browse the repository at this point in the history
… crocodiles
  • Loading branch information
itsmeow committed Feb 22, 2023
1 parent 64bc343 commit 09bbe63
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static void registerEntityRenders() {
}));
R.addRender(ModEntities.GAZELLE::getEntityType, 0.8F, r -> r.tVariant().childScale(0.6F).mMapped(e -> {
String v = e.getVariantNameOrEmpty();
if(v.equals("blackbuck_2")) {
if(v.equals("blackbuck_light") || v.equals("blackbuck_dark")) {
return "blackbuck_gazelle";
}
return v.isEmpty() ? "blackbuck_gazelle" : v + "_gazelle";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@
import dev.itsmeow.betteranimalsplus.common.entity.util.abstracts.EntityWaterMobPathing;
import dev.itsmeow.betteranimalsplus.init.ModEntities;
import dev.itsmeow.imdlib.entity.EntityTypeContainer;
import dev.itsmeow.imdlib.entity.interfaces.ISelectiveVariantTypes;
import dev.itsmeow.imdlib.entity.util.BiomeTypes;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.Biome;

public class EntityCrocodile extends EntityCrocidilian {
import java.util.Set;

public class EntityCrocodile extends EntityCrocidilian implements ISelectiveVariantTypes<EntityWaterMobPathing> {

private static final String[] ALL_TYPE = {"american", "nile"};
private static final String[] SAVANNA_TYPE = {"nile"};

public EntityCrocodile(EntityType<? extends EntityCrocidilian> entityType, Level level) {
super(entityType, level);
Expand All @@ -18,4 +28,13 @@ public EntityTypeContainer<? extends EntityWaterMobPathing> getContainer() {
return ModEntities.CROCODILE;
}

@Override
public String[] getTypesFor(ResourceKey<Biome> biomeKey, Biome biome, Set<BiomeTypes.Type> types, MobSpawnType reason) {
if (types.contains(BiomeTypes.SAVANNA)) {
return SAVANNA_TYPE;
} else if (types.contains(BiomeTypes.SWAMP)) {
return ALL_TYPE;
}
return ALL_TYPE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,9 @@ public class ModEntities {
.egg(0x593306, 0xedc391)
.size(1F, 1.5F)
.biomesOverworld(BiomeTypes.SAVANNA)
.variants("blackbuck", "blackbuck_2", "chinkara", "erlanger", "springbok")
.variants("blackbuck_dark", "blackbuck_light", "chinkara", "erlanger", "springbok")
.head().itemGroup(G).mapToNames().setModelMapped(() -> headTypeName -> ModelGazelleHead::new,
headTypeName -> headTypeName.equals("blackbuck_2") ? "blackbuck_gazelle_head" : headTypeName + "_gazelle_head")
headTypeName -> headTypeName.startsWith("blackbuck") ? "blackbuck_gazelle_head" : headTypeName + "_gazelle_head")
.done());
public static final EntityTypeContainer<EntityCrocodile> CROCODILE = H.add(EntityCrocodile.class, EntityCrocodile::new, "crocodile", () -> Mob.createMobAttributes()
.add(Attributes.MAX_HEALTH, 25.0D)
Expand All @@ -509,7 +509,7 @@ public class ModEntities {
.waterPlacement()
.egg(0x4d4732, 0x404a42)
.size(2.2F, 0.8F)
.biomesOverworld(BiomeTypes.SWAMP, BiomeTypes.RIVER)
.biomesOverworld(BiomeTypes.SWAMP, BiomeTypes.SAVANNA)
.variants("american", "nile"));

public static LinkedHashMap<String, EntityTypeContainer<? extends Mob>> getEntities() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betteranimalsplus:item/gazellehead_blackbuck_dark"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betteranimalsplus:item/gazellehead_blackbuck_light"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betteranimalsplus:item/gazellehead_chinkara"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betteranimalsplus:item/gazellehead_erlanger"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betteranimalsplus:item/gazellehead_springbok"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -334,25 +334,25 @@
]
}
},
"gazelle_blackbuck": {
"gazelle_blackbuck_dark": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"betteranimalsplus:gazellehead_blackbuck"
"betteranimalsplus:gazellehead_blackbuck_dark"
]
}
]
}
},
"gazelle_blackbuck_2": {
"gazelle_blackbuck_light": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"betteranimalsplus:gazellehead_blackbuck_2"
"betteranimalsplus:gazellehead_blackbuck_light"
]
}
]
Expand Down Expand Up @@ -466,10 +466,10 @@
"feralwolfhead_red"
],
[
"gazelle_blackbuck"
"gazelle_blackbuck_dark"
],
[
"gazelle_blackbuck_2"
"gazelle_blackbuck_light"
],
[
"gazelle_chinkara"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,25 +325,25 @@
]
}
},
"gazelle_blackbuck": {
"gazelle_blackbuck_dark": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"betteranimalsplus:gazellehead_blackbuck"
"betteranimalsplus:gazellehead_blackbuck_dark"
]
}
]
}
},
"gazelle_blackbuck_2": {
"gazelle_blackbuck_light": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"betteranimalsplus:gazellehead_blackbuck_2"
"betteranimalsplus:gazellehead_blackbuck_light"
]
}
]
Expand Down Expand Up @@ -413,8 +413,8 @@
"feralwolfhead_arctic",
"feralwolfhead_brown",
"feralwolfhead_red",
"gazelle_blackbuck",
"gazelle_blackbuck_2",
"gazelle_blackbuck_dark",
"gazelle_blackbuck_light",
"gazelle_chinkara",
"gazelle_erlanger",
"gazelle_springbok"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,25 +325,25 @@
]
}
},
"gazelle_blackbuck": {
"gazelle_blackbuck_dark": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"betteranimalsplus:gazellehead_blackbuck"
"betteranimalsplus:gazellehead_blackbuck_dark"
]
}
]
}
},
"gazelle_blackbuck_2": {
"gazelle_blackbuck_light": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"betteranimalsplus:gazellehead_blackbuck_2"
"betteranimalsplus:gazellehead_blackbuck_light"
]
}
]
Expand Down Expand Up @@ -427,8 +427,8 @@
"head21"
],
[
"gazelle_blackbuck",
"gazelle_blackbuck_2",
"gazelle_blackbuck_dark",
"gazelle_blackbuck_light",
"gazelle_chinkara",
"gazelle_erlanger",
"gazelle_springbok"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:gazellehead_blackbuck"
"name": "betteranimalsplus:gazellehead_blackbuck_dark"
}
],
"conditions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "betteranimalsplus:gazellehead_blackbuck_2"
"name": "betteranimalsplus:gazellehead_blackbuck_light"
}
],
"conditions": [
Expand Down

0 comments on commit 09bbe63

Please sign in to comment.