-
Notifications
You must be signed in to change notification settings - Fork 43
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
Showing
12 changed files
with
223 additions
and
52 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
14 changes: 14 additions & 0 deletions
14
src/main/java/net/id/paradiselost/client/model/entity/EnvoyEntityModel.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,14 @@ | ||
package net.id.paradiselost.client.model.entity; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.id.paradiselost.entities.hostile.EnvoyEntity; | ||
import net.minecraft.client.model.ModelPart; | ||
import net.minecraft.client.render.entity.model.SkeletonEntityModel; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class EnvoyEntityModel<T extends EnvoyEntity> extends SkeletonEntityModel<T> { | ||
public EnvoyEntityModel(ModelPart modelPart) { | ||
super(modelPart); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/net/id/paradiselost/client/model/entity/EnvoyEyesFeatureRenderer.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 net.id.paradiselost.client.model.entity; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.id.paradiselost.ParadiseLost; | ||
import net.id.paradiselost.entities.hostile.EnvoyEntity; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.entity.feature.EyesFeatureRenderer; | ||
import net.minecraft.client.render.entity.feature.FeatureRendererContext; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class EnvoyEyesFeatureRenderer<T extends EnvoyEntity> extends EyesFeatureRenderer<T, EnvoyEntityModel<T>> { | ||
|
||
private static final RenderLayer TEXTURE = RenderLayer.getEyes(ParadiseLost.locate("textures/entity/envoy/envoy_enlightened_eyes.png")); | ||
|
||
public EnvoyEyesFeatureRenderer(FeatureRendererContext<T, EnvoyEntityModel<T>> featureRendererContext) { | ||
super(featureRendererContext); | ||
} | ||
|
||
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, T entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) { | ||
if (entity.getEnlightened()) { | ||
super.render(matrices, vertexConsumers, light, entity, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch); | ||
} | ||
} | ||
|
||
@Override | ||
public RenderLayer getEyesTexture() { | ||
return TEXTURE; | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
src/main/java/net/id/paradiselost/client/rendering/entity/hostile/EnvoyEntityRenderer.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,30 @@ | ||
package net.id.paradiselost.client.rendering.entity.hostile; | ||
|
||
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.client.model.entity.EnvoyEyesFeatureRenderer; | ||
import net.id.paradiselost.entities.hostile.EnvoyEntity; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.render.entity.SkeletonEntityRenderer; | ||
import net.minecraft.entity.mob.AbstractSkeletonEntity; | ||
import net.minecraft.util.Identifier; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class EnvoyEntityRenderer extends SkeletonEntityRenderer { | ||
private static final Identifier TEXTURE = ParadiseLost.locate("textures/entity/envoy/envoy.png"); | ||
private static final Identifier TEXTURE_ENLIGHTENED = ParadiseLost.locate("textures/entity/envoy/envoy_enlightened.png"); | ||
|
||
public EnvoyEntityRenderer(EntityRendererFactory.Context renderManager) { | ||
super(renderManager, ParadiseLostModelLayers.ENVOY, ParadiseLostModelLayers.ENVOY_INNER_ARMOR, ParadiseLostModelLayers.ENVOY_OUTER_ARMOR); | ||
this.addFeature(new EnvoyEyesFeatureRenderer(this)); | ||
} | ||
|
||
public Identifier getTexture(AbstractSkeletonEntity entity) { | ||
if (((EnvoyEntity) entity).getEnlightened()) { | ||
return TEXTURE_ENLIGHTENED; | ||
} | ||
return TEXTURE; | ||
} | ||
} |
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
68 changes: 68 additions & 0 deletions
68
src/main/java/net/id/paradiselost/entities/hostile/EnvoyEntity.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,68 @@ | ||
package net.id.paradiselost.entities.hostile; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.attribute.DefaultAttributeContainer; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.entity.data.DataTracker; | ||
import net.minecraft.entity.data.TrackedData; | ||
import net.minecraft.entity.data.TrackedDataHandlerRegistry; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.entity.mob.SkeletonEntity; | ||
import net.minecraft.nbt.NbtCompound; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.LocalDifficulty; | ||
import net.minecraft.world.World; | ||
|
||
public class EnvoyEntity extends SkeletonEntity { | ||
private static final TrackedData<Boolean> ENLIGHTENED; | ||
|
||
public EnvoyEntity(EntityType<? extends EnvoyEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
public boolean getEnlightened() { | ||
return this.dataTracker.get(ENLIGHTENED); | ||
} | ||
|
||
protected void initDataTracker() { | ||
super.initDataTracker(); | ||
this.dataTracker.startTracking(ENLIGHTENED, false); | ||
} | ||
|
||
protected void initEquipment(Random random, LocalDifficulty localDifficulty) { | ||
} | ||
|
||
public boolean tryAttack(Entity target) { | ||
if (!super.tryAttack(target)) { | ||
return false; | ||
} else { | ||
if (target instanceof LivingEntity) { | ||
((LivingEntity) target).addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 200), this); | ||
} | ||
return true; | ||
} | ||
} | ||
public static DefaultAttributeContainer.Builder createEnvoyAttributes() { | ||
return createHostileAttributes() | ||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.2D); | ||
} | ||
|
||
@Override | ||
public void writeCustomDataToNbt(NbtCompound compound) { | ||
super.writeCustomDataToNbt(compound); | ||
compound.putBoolean("Enlightened", this.dataTracker.get(ENLIGHTENED)); | ||
} | ||
|
||
@Override | ||
public void readCustomDataFromNbt(NbtCompound compound) { | ||
super.readCustomDataFromNbt(compound); | ||
this.dataTracker.set(ENLIGHTENED, compound.getBoolean("Enlightened")); | ||
} | ||
|
||
static { | ||
ENLIGHTENED = DataTracker.registerData(EnvoyEntity.class, TrackedDataHandlerRegistry.BOOLEAN); | ||
} | ||
} |
Oops, something went wrong.