Skip to content

Commit

Permalink
Merge pull request #17 from 3296Fall2020/fix-bearded
Browse files Browse the repository at this point in the history
Fix bearded
  • Loading branch information
amandagrono authored Nov 10, 2020
2 parents 7f5162f + fc5e504 commit 6236e5c
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 17 deletions.
14 changes: 4 additions & 10 deletions src/main/java/edu/temple/reptiles/Reptiles.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package edu.temple.reptiles;
//Was able to push a commit through
import edu.temple.reptiles.entities.GeckoEntity;
import edu.temple.reptiles.entities.DinosaurEntity;
import edu.temple.reptiles.entities.ChameleonEntity;
import edu.temple.reptiles.entities.CrocodileEntity;
import edu.temple.reptiles.init.ModEntityTypes;

import edu.temple.reptiles.entities.*;
import edu.temple.reptiles.init.*;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand All @@ -25,7 +21,6 @@
import org.apache.logging.log4j.Logger;
import java.util.stream.Collectors;

// Adam Gasiewski environment setup

// The value here should match an entry in the META-INF/mods.toml file
@Mod("reptiles")
Expand All @@ -45,8 +40,6 @@ public Reptiles() {
// Register the doClientStuff method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

ModEntityTypes.ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());

// Register ourselves for server and other game events we are interested in

ModEntityTypes.ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());
Expand All @@ -66,6 +59,7 @@ private void setup(final FMLCommonSetupEvent event)
GlobalEntityTypeAttributes.put(ModEntityTypes.DINOSAUR.get(), DinosaurEntity.setCustomAttributes().create());
GlobalEntityTypeAttributes.put(ModEntityTypes.CHAMELEON.get(), ChameleonEntity.setCustomAttributes().create());
GlobalEntityTypeAttributes.put(ModEntityTypes.CROCODILE.get(), CrocodileEntity.setCustomAttributes().create());
GlobalEntityTypeAttributes.put(ModEntityTypes.BEARDEDDRAGON.get(), BeardedDragonEntity.setCustomAttributes().create());
});
}

Expand Down
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;
}
}
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;
}

}
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);
}
}

8 changes: 4 additions & 4 deletions src/main/java/edu/temple/reptiles/init/ModEntityTypes.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package edu.temple.reptiles.init;

import edu.temple.reptiles.Reptiles;
import edu.temple.reptiles.entities.GeckoEntity;
import edu.temple.reptiles.entities.GeckoEntity;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import edu.temple.reptiles.entities.DinosaurEntity;
import edu.temple.reptiles.entities.*;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -35,4 +31,8 @@ public class ModEntityTypes {
() -> EntityType.Builder.create(ChameleonEntity::new, EntityClassification.CREATURE)
.size(0.6f, 0.7f)
.build(new ResourceLocation(Reptiles.MOD_ID, "chameleon").toString()));
public static final RegistryObject<EntityType<BeardedDragonEntity>> BEARDEDDRAGON = ENTITY_TYPES
.register("beardeddragon",
() -> EntityType.Builder.create(BeardedDragonEntity::new, EntityClassification.CREATURE)
.size(0.25F,0.25F).build(new ResourceLocation(Reptiles.MOD_ID, "beardeddragon").toString()));
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package edu.temple.reptiles.util;

import edu.temple.reptiles.Reptiles;
import edu.temple.reptiles.client.render.GeckoRenderer;
import edu.temple.reptiles.client.render.DinosaurRenderer;
import edu.temple.reptiles.client.render.*;
import edu.temple.reptiles.init.ModEntityTypes;
import net.minecraftforge.api.distmarker.Dist;
Expand All @@ -22,6 +20,7 @@ public static void onClientSetup(FMLClientSetupEvent event){
RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.CROCODILE.get(), CrocodileRenderer::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.DINOSAUR.get(), DinosaurRenderer::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.GECKO.get(), GeckoRenderer::new);
RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.BEARDEDDRAGON.get(), BeardedDragonRenderer::new);

}

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/reptiles/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"entity.reptiles.gecko": "Gecko",
"entity.reptiles.dinosaur": "Dinosaur",
"entity.reptiles.crocodile": "Crocodile",
"entity.reptiles.chameleon": "Chameleon"
"entity.reptiles.chameleon": "Chameleon",
"entity.reptiles.beardeddragon": "Bearded Dragon"
}

0 comments on commit 6236e5c

Please sign in to comment.