-
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.
Merge pull request #17 from 3296Fall2020/fix-bearded
Fix bearded
- Loading branch information
Showing
7 changed files
with
158 additions
and
17 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
38 changes: 38 additions & 0 deletions
38
src/main/java/edu/temple/reptiles/client/model/BeardedDragonModel.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,38 @@ | ||
package edu.temple.reptiles.client.model; | ||
|
||
import com.mojang.blaze3d.matrix.MatrixStack; | ||
import com.mojang.blaze3d.vertex.IVertexBuilder; | ||
import edu.temple.reptiles.entities.BeardedDragonEntity; | ||
import net.minecraft.client.renderer.entity.model.EntityModel; | ||
import net.minecraft.client.renderer.model.ModelRenderer; | ||
import net.minecraft.entity.Entity; | ||
|
||
|
||
public class BeardedDragonModel<T extends BeardedDragonEntity> extends EntityModel<T> { | ||
private final ModelRenderer bb_main; | ||
|
||
public BeardedDragonModel() { | ||
textureWidth = 16; | ||
textureHeight = 16; | ||
|
||
bb_main = new ModelRenderer(this); | ||
bb_main.setRotationPoint(0.0F, 24.0F, 0.0F); | ||
bb_main.setTextureOffset(0, 0).addBox(-3.0F, -2.0F, -1.0F, 7.0F, 2.0F, 2.0F, 0.0F, false); | ||
} | ||
|
||
@Override | ||
public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { | ||
|
||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ | ||
bb_main.render(matrixStack, buffer, packedLight, packedOverlay); | ||
} | ||
|
||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) { | ||
modelRenderer.rotateAngleX = x; | ||
modelRenderer.rotateAngleY = y; | ||
modelRenderer.rotateAngleZ = z; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/edu/temple/reptiles/client/render/BeardedDragonRenderer.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,23 @@ | ||
package edu.temple.reptiles.client.render; | ||
|
||
import edu.temple.reptiles.Reptiles; | ||
import edu.temple.reptiles.client.model.BeardedDragonModel; | ||
import edu.temple.reptiles.entities.BeardedDragonEntity; | ||
import net.minecraft.client.renderer.entity.EntityRendererManager; | ||
import net.minecraft.client.renderer.entity.MobRenderer; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
public class BeardedDragonRenderer extends MobRenderer<BeardedDragonEntity, BeardedDragonModel<BeardedDragonEntity>> { | ||
|
||
protected static final ResourceLocation TEXTURE = new ResourceLocation(Reptiles.MOD_ID, "textures/entity/beardeddragon.png"); | ||
|
||
public BeardedDragonRenderer(EntityRendererManager renderManagerIn) { | ||
super(renderManagerIn, new BeardedDragonModel<>(), 0.7F); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getEntityTexture(BeardedDragonEntity entity) { | ||
return TEXTURE; | ||
} | ||
|
||
} |
86 changes: 86 additions & 0 deletions
86
src/main/java/edu/temple/reptiles/entities/BeardedDragonEntity.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,86 @@ | ||
package edu.temple.reptiles.entities; | ||
|
||
//import edu.temple.reptiles.init.ModEntityTypes; | ||
import edu.temple.reptiles.init.ModEntityTypes; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.entity.AgeableEntity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.MobEntity; | ||
import net.minecraft.entity.ai.attributes.AttributeModifierMap; | ||
import net.minecraft.entity.ai.attributes.Attributes; | ||
import net.minecraft.entity.ai.goal.*; | ||
import net.minecraft.entity.passive.AnimalEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.item.crafting.Ingredient; | ||
import net.minecraft.util.DamageSource; | ||
import net.minecraft.util.SoundEvent; | ||
import net.minecraft.util.SoundEvents; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
public class BeardedDragonEntity extends AnimalEntity { | ||
|
||
public BeardedDragonEntity(EntityType<? extends AnimalEntity> type, World worldIn) { | ||
super(type, worldIn); | ||
} | ||
public static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.CARROT); | ||
|
||
|
||
|
||
|
||
public static AttributeModifierMap.MutableAttribute setCustomAttributes(){ | ||
return MobEntity.registerAttributes() | ||
.createMutableAttribute(Attributes.MAX_HEALTH, 10.0D) | ||
.createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.25D) | ||
.createMutableAttribute(Attributes.FOLLOW_RANGE); | ||
} | ||
|
||
@Override | ||
protected void registerGoals() { | ||
super.registerGoals(); | ||
this.goalSelector.addGoal(0, new SwimGoal(this)); | ||
this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D)); | ||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D)); | ||
this.goalSelector.addGoal(3, new TemptGoal(this, 1.1D, TEMPTATION_ITEMS, false)); | ||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D)); | ||
this.goalSelector.addGoal(5, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); | ||
this.goalSelector.addGoal(6, new LookAtGoal(this, PlayerEntity.class, 6.0F)); | ||
this.goalSelector.addGoal(7, new LookRandomlyGoal(this)); | ||
|
||
} | ||
|
||
@Override | ||
protected int getExperiencePoints(PlayerEntity player) { | ||
return 1 + this.world.rand.nextInt(4); | ||
} | ||
|
||
@Override | ||
protected SoundEvent getAmbientSound() { | ||
return SoundEvents.ENTITY_LLAMA_AMBIENT; | ||
} | ||
|
||
|
||
@Override | ||
protected SoundEvent getDeathSound() { | ||
return SoundEvents.ENTITY_LLAMA_DEATH; | ||
} | ||
|
||
@Override | ||
protected SoundEvent getHurtSound(DamageSource damageSourceIn) { | ||
return SoundEvents.ENTITY_LLAMA_HURT; | ||
} | ||
|
||
@Override | ||
protected void playStepSound(BlockPos pos, BlockState blockIn) { | ||
this.playSound(SoundEvents.ENTITY_LLAMA_STEP, 0.15F, 1.0F); | ||
} | ||
|
||
|
||
@Override | ||
public AgeableEntity createChild(AgeableEntity ageable) { | ||
|
||
return ModEntityTypes.BEARDEDDRAGON.get().create(this.world); | ||
} | ||
} | ||
|
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