Skip to content

Commit

Permalink
Initial popom addition
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXBlade committed Nov 6, 2024
1 parent 79b6559 commit fe0fb6e
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class ParadiseLostModelLayers {
public static final EntityModelLayer ENVOY_OUTER_ARMOR = register("envoy", "outer_armor", OUTER_ARMOR_MODEL_DATA);
public static final EntityModelLayer MOA = register("moa", "main", MoaModel.getTexturedModelData());
public static final EntityModelLayer PHOENIX_ARMOR = register("phoenix_armor", "main", PhoenixArmorModel.getTexturedModelData());
public static final EntityModelLayer POPOM = register("popom", "main", EnvoyEntityModel.getTexturedModelData());


public static EntityModelLayer register(Identifier id, String layer, TexturedModelData data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.id.paradiselost.client.rendering.entity.hostile.EnvoyEntityRenderer;
import net.id.paradiselost.client.rendering.entity.passive.MoaEntityRenderer;
import net.id.paradiselost.client.rendering.entity.passive.PopomEntityRenderer;
import net.id.paradiselost.entities.ParadiseLostEntityTypes;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
Expand All @@ -24,6 +25,8 @@ public static void initClient() {
// passive
register(ParadiseLostEntityTypes.MOA, MoaEntityRenderer::new);

register(ParadiseLostEntityTypes.POPOM, PopomEntityRenderer::new);

// projectile
register(ParadiseLostEntityTypes.THROWN_NITRA, FlyingItemEntityRenderer::new);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.id.paradiselost.client.rendering.entity.passive;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.id.paradiselost.ParadiseLost;
import net.id.paradiselost.client.model.ParadiseLostModelLayers;
import net.id.paradiselost.entities.passive.PopomEntity;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.PigEntityRenderer;
import net.id.paradiselost.client.rendering.entity.passive.PopomEntityRenderer;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.util.Identifier;

@Environment(EnvType.CLIENT)
public class PopomEntityRenderer extends PigEntityRenderer {
private static final Identifier TEXTURE = ParadiseLost.locate("textures/entity/popom/popom.png");

public PopomEntityRenderer(EntityRendererFactory.Context renderManager) {
super(renderManager);
}

public Identifier getTexture(PigEntity entity) {
return TEXTURE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.id.paradiselost.entities.block.SliderEntity;
import net.id.paradiselost.entities.hostile.EnvoyEntity;
import net.id.paradiselost.entities.passive.ParadiseLostAnimalEntity;
import net.id.paradiselost.entities.passive.PopomEntity;
import net.id.paradiselost.entities.passive.moa.MoaEntity;
import net.id.paradiselost.entities.projectile.ThrownNitraEntity;
import net.minecraft.entity.*;
Expand Down Expand Up @@ -41,6 +42,9 @@ public class ParadiseLostEntityTypes {
public static final EntityType<MoaEntity> MOA = add("moa", of(MoaEntity::new, CREATURE, changing(1.0F, 2.0F), 5),
attributes(MoaEntity::createMoaAttributes), spawnRestrictions(ParadiseLostAnimalEntity::isValidNaturalParadiseLostSpawn));

public static final EntityType<PopomEntity> POPOM = add("popom", of(PopomEntity::new, CREATURE, changing(1.0F, 2.0F), 5),
attributes(PopomEntity::createPopomAttributes), spawnRestrictions(PopomEntity::canMobSpawn));

// projectile
public static final EntityType<ThrownNitraEntity> THROWN_NITRA = add("thrown_nitra", of(ThrownNitraEntity::new, MISC, changing(0.5F, 0.5F), 5));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package net.id.paradiselost.entities.passive;

import net.id.paradiselost.util.ParadiseLostSoundEvents;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.sound.SoundEvent;
import net.minecraft.world.World;

public class PopomEntity extends PigEntity {

public PopomEntity(EntityType<? extends PopomEntity> entityType, World world) {
super(entityType, world);
}

// Custom sounds for Popom
@Override
protected SoundEvent getAmbientSound() {
return ParadiseLostSoundEvents.ENTITY_POPOM_AMBIENT;
}
/* @Override
protected SoundEvent getHurtSound(DamageSource source) {
return ParadiseLostSoundEvents.ENTITY_POPOM_HURT;
}*/

@Override
protected SoundEvent getDeathSound() {
return ParadiseLostSoundEvents.ENTITY_POPOM_DEATH;
}

// Define attributes for Popom
public static DefaultAttributeContainer.Builder createPopomAttributes() {
return createMobAttributes()
.add(EntityAttributes.GENERIC_MAX_HEALTH, 20.0D)
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25D);
}

@Override
public void writeCustomDataToNbt(NbtCompound compound) {
super.writeCustomDataToNbt(compound);
// Any custom data you want to save
}

@Override
public void readCustomDataFromNbt(NbtCompound compound) {
super.readCustomDataFromNbt(compound);
// Any custom data you want to load
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ public void attemptMoaSound()
}
}
private boolean canFlap = true;
public void attemptMoaFlap(boolean bypassFlapCheck)
{
public void attemptMoaFlap(boolean bypassFlapCheck) {
if (getWingRoll() > 0.8 && canFlap || bypassFlapCheck) {
this.getWorld().playSound(null, this.getX(), this.getY(), this.getZ(), ParadiseLostSoundEvents.ENTITY_MOA_GLIDING, SoundCategory.NEUTRAL, 0.25F, getRandomFloat(0.9f, 0.97f));
canFlap = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ public static void init() {
.register((itemGroup) -> {
itemGroup.add(MOA_SPAWN_EGG);
itemGroup.add(ENVOY_SPAWN_EGG);
itemGroup.add(POPOM_SPAWN_EGG);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ private static Settings food(FoodComponent foodComponent) {

public static final SpawnEggItem ENVOY_SPAWN_EGG = add("envoy_spawn_egg", new SpawnEggItem(ParadiseLostEntityTypes.ENVOY, 0xc5b1af, 0x993c3c, new Settings()), spawnEggBehavior);
public static final SpawnEggItem MOA_SPAWN_EGG = add("moa_spawn_egg", new SpawnEggItem(ParadiseLostEntityTypes.MOA, 0xC55C2E4, 0xB3A8BB, new Settings()), spawnEggBehavior);
public static final SpawnEggItem POPOM_SPAWN_EGG = add("popom_spawn_egg", new SpawnEggItem(ParadiseLostEntityTypes.POPOM, 0xd984e8, 0xd4d0cf, new Settings()), spawnEggBehavior);

public static final BlockItem BLOOMED_CALCITE = add(ParadiseLostBlocks.BLOOMED_CALCITE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public final class ParadiseLostSoundEvents {
public static final SoundEvent ENTITY_MOA_EGG_HATCH = register("entity.moa.egg_hatch");
public static final SoundEvent ENTITY_MOA_STEP = register("entity.moa.step");

public static final SoundEvent ENTITY_POPOM_AMBIENT = register(("entity.popom.ambient"));
public static final SoundEvent ENTITY_POPOM_HURT = register(("entity.popom.hurt"));
public static final SoundEvent ENTITY_POPOM_DEATH = register(("entity.popom.death"));


public static final SoundEvent ENTITY_ENVOY_AMBIENT = register(("entity.envoy.ambient"));
public static final SoundEvent ENTITY_ENVOY_HURT = register(("entity.envoy.hurt"));
public static final SoundEvent ENTITY_ENVOY_DEATH = register(("entity.envoy.death"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "paradise_lost:item/template_spawn_egg"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fe0fb6e

Please sign in to comment.