Skip to content

Commit

Permalink
Config for holiday feature and student model (#3204)
Browse files Browse the repository at this point in the history
* Config for holiday feature and student model
  • Loading branch information
Raycoms committed Dec 30, 2018
1 parent e9413d0 commit 8a68e22
Show file tree
Hide file tree
Showing 17 changed files with 194 additions and 1 deletion.
Expand Up @@ -269,6 +269,9 @@ public static class Gameplay

@Config.Comment("Days until the pirate ships despawn again.")
public int daysUntilPirateshipsDespawn = 3;

@Config.Comment("Should special holiday content be displayed?")
public boolean holidayFeatures = true;
}

public static class Compatibility
Expand Down
@@ -0,0 +1,177 @@
package com.minecolonies.coremod.client.model;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import org.jetbrains.annotations.NotNull;

/**
* Model for the male students (monks).
*/
public class ModelEntityStudentMale extends ModelBiped
{
public ModelEntityStudentMale()
{
ModelRenderer front;
ModelRenderer back;
ModelRenderer left;
ModelRenderer right;
ModelRenderer armCHorizontal;
ModelRenderer rightArmC;
ModelRenderer leftArmC;
ModelRenderer belly;
ModelRenderer bellyU;
ModelRenderer helmet;

textureWidth = 128;
textureHeight = 64;

front = new ModelRenderer(this, 16, 48);
front.addBox(0F, 0F, 1F, 8, 8, 0);
front.setRotationPoint(-4F, 12F, -3F);
front.setTextureSize(128, 64);
front.mirror = true;
setRotation(front, 0F, 0F, 0F);

back = new ModelRenderer(this, 16, 40);
back.addBox(0F, 0F, 1F, 8, 8, 0);
back.setRotationPoint(-4F, 12F, 3F);
back.setTextureSize(128, 64);
back.mirror = true;
setRotation(back, 0F, 0F, 0F);

left = new ModelRenderer(this, 16, 34);
left.addBox(0F, 0F, 1F, 0, 8, 6);
left.setRotationPoint(4F, 12F, -3F);
left.setTextureSize(128, 64);
left.mirror = true;
setRotation(left, 0F, 0F, 0F);

right = new ModelRenderer(this, 16, 34);
right.addBox(0F, 0F, 1F, 0, 8, 6);
right.setRotationPoint(-4F, 12F, -3F);
right.setTextureSize(128, 64);
right.mirror = true;
setRotation(right, 0F, 0F, 0F);

armCHorizontal = new ModelRenderer(this, 0, 56);
armCHorizontal.addBox(0F, -1F, 1F, 16, 4, 4);
armCHorizontal.setRotationPoint(-8F, 3.8F, -3.5F);
armCHorizontal.setTextureSize(128, 64);
armCHorizontal.mirror = true;
setRotation(armCHorizontal, -0.4886922F, 0F, 0F);

rightArmC = new ModelRenderer(this, 0, 44);
rightArmC.addBox(0F, 0F, 1F, 4, 8, 4);
rightArmC.setRotationPoint(-8F, -0.5F, -1F);
rightArmC.setTextureSize(128, 64);
rightArmC.mirror = true;
setRotation(rightArmC, -0.5061455F, 0F, 0F);

leftArmC = new ModelRenderer(this, 0, 44);
leftArmC.addBox(0F, 0F, 1F, 4, 8, 4);
leftArmC.setRotationPoint(4F, -0.5F, -1F);
leftArmC.setTextureSize(128, 64);
leftArmC.mirror = true;
setRotation(leftArmC, -0.5061455F, 0F, 0F);

bipedRightArm = new ModelRenderer(this, 44, 16);
bipedRightArm.addBox(-3F, -2F, -2F, 4, 12, 4);
bipedRightArm.setRotationPoint(-5F, 2F, 0F);
bipedRightArm.setTextureSize(128, 64);
bipedRightArm.mirror = true;
setRotation(bipedRightArm, 0F, 0F, 0F);

bipedLeftArm = new ModelRenderer(this, 44, 16);
bipedLeftArm.addBox(-1F, -2F, -2F, 4, 12, 4);
bipedLeftArm.setRotationPoint(5F, 2F, 0F);
bipedLeftArm.setTextureSize(128, 64);
bipedLeftArm.mirror = true;
setRotation(bipedLeftArm, 0F, 0F, 0F);

belly = new ModelRenderer(this, 29, 34);
belly.addBox(0F, 0F, 1F, 6, 4, 1);
belly.setRotationPoint(-3F, 6F, -4F);
belly.setTextureSize(128, 64);
belly.mirror = true;
setRotation(belly, 0F, 0F, 0F);

bellyU = new ModelRenderer(this, 19, 29);
bellyU.addBox(0F, 0F, 1F, 4, 1, 1);
bellyU.setRotationPoint(-2F, 5F, -4F);
bellyU.setTextureSize(128, 64);
bellyU.mirror = true;
setRotation(bellyU, 0F, 0F, 0F);

bipedRightLeg = new ModelRenderer(this, 0, 16);
bipedRightLeg.addBox(-2F, 0F, -2F, 4, 12, 4);
bipedRightLeg.setRotationPoint(-2F, 12F, 0F);
bipedRightLeg.setTextureSize(128, 64);
bipedRightLeg.mirror = true;
setRotation(bipedRightLeg, 0F, 0F, 0F);

bipedLeftLeg = new ModelRenderer(this, 0, 16);
bipedLeftLeg.addBox(-2F, 0F, -2F, 4, 12, 4);
bipedLeftLeg.setRotationPoint(2F, 12F, 0F);
bipedLeftLeg.setTextureSize(128, 64);
bipedLeftLeg.mirror = true;
setRotation(bipedLeftLeg, 0F, 0F, 0F);

bipedBody = new ModelRenderer(this, 16, 16);
bipedBody.addBox(-4F, 0F, -2F, 8, 12, 6);
bipedBody.setRotationPoint(0F, 0F, -1F);
bipedBody.setTextureSize(128, 64);
bipedBody.mirror = true;
setRotation(bipedBody, 0F, 0F, 0F);

bipedHead = new ModelRenderer(this, 0, 0);
bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8);
bipedHead.setRotationPoint(0F, 0F, 0F);
bipedHead.setTextureSize(128, 64);
bipedHead.mirror = true;
setRotation(bipedHead, 0F, 0F, 0F);

helmet = new ModelRenderer(this, 40, 46);
helmet.addBox(0F, 0F, 0F, 9, 9, 9);
helmet.setRotationPoint(-4.5F, -8.5F, -4.5F);
helmet.setTextureSize(128, 64);
helmet.mirror = true;
setRotation(helmet, 0F, 0F, 0F);

this.bipedBody.addChild(belly);
this.bipedBody.addChild(bellyU);
this.bipedBody.addChild(front);
this.bipedBody.addChild(back);
this.bipedBody.addChild(right);
this.bipedBody.addChild(left);
this.bipedBody.addChild(armCHorizontal);

this.bipedHead.addChild(helmet);


this.bipedBody.addChild(leftArmC);
this.bipedBody.addChild(rightArmC);

}

@Override
public void render(
@NotNull final Entity entity,
final float limbSwing,
final float limbSwingAmount,
final float ageInTicks,
final float netHeadYaw,
final float headPitch,
final float scaleFactor)
{
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor);
setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entity);
}

private void setRotation(@NotNull final ModelRenderer model, final float x, final float y, final float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}
Expand Up @@ -44,6 +44,7 @@ public class RenderBipedCitizen extends RenderBiped<EntityCitizen>
idToMaleModelMap.put(Model.PIG_FARMER, new ModelEntityPigFarmerMale());
idToMaleModelMap.put(Model.COW_FARMER, new ModelEntityCowFarmerMale());
idToMaleModelMap.put(Model.SMELTER, new ModelEntitySmelterMale());
idToMaleModelMap.put(Model.STUDENT, new ModelEntityStudentMale());
idToMaleModelMap.put(Model.CRAFTER, new ModelEntityCrafterMale());

idToFemaleModelMap.put(Model.NOBLE, new ModelEntityCitizenFemaleNoble());
Expand All @@ -64,6 +65,7 @@ public class RenderBipedCitizen extends RenderBiped<EntityCitizen>
idToFemaleModelMap.put(Model.PIG_FARMER, new ModelEntityPigFarmerFemale());
idToFemaleModelMap.put(Model.SHEEP_FARMER, new ModelEntitySheepFarmerFemale());
idToFemaleModelMap.put(Model.SMELTER, new ModelEntitySmelterFemale());
idToFemaleModelMap.put(Model.STUDENT, new ModelEntityCitizenFemaleCitizen());
idToFemaleModelMap.put(Model.CRAFTER, new ModelEntityCrafterFemale());
}

Expand Down Expand Up @@ -208,6 +210,7 @@ public enum Model
COMPOSTER("composter", 1),
SMELTER("smelter", 1),
COOK("cook", 1),
STUDENT("student", 6),
CRAFTER("crafter", 1);

/**
Expand Down
@@ -1,5 +1,6 @@
package com.minecolonies.coremod.colony.jobs;

import com.minecolonies.coremod.client.render.RenderBipedCitizen;
import com.minecolonies.coremod.colony.CitizenData;
import com.minecolonies.coremod.entity.ai.basic.AbstractAISkeleton;
import com.minecolonies.coremod.entity.ai.citizen.student.EntityAIStudy;
Expand Down Expand Up @@ -43,4 +44,10 @@ public AbstractAISkeleton<JobStudent> generateAI()
{
return new EntityAIStudy(this);
}

@Override
public RenderBipedCitizen.Model getModel()
{
return RenderBipedCitizen.Model.STUDENT;
}
}
Expand Up @@ -18,6 +18,7 @@
import com.minecolonies.coremod.colony.buildings.AbstractBuildingGuards;
import com.minecolonies.coremod.colony.jobs.AbstractJob;
import com.minecolonies.coremod.colony.jobs.AbstractJobGuard;
import com.minecolonies.coremod.colony.jobs.JobStudent;
import com.minecolonies.coremod.colony.permissions.Permissions;
import com.minecolonies.coremod.entity.ai.minimal.*;
import com.minecolonies.coremod.entity.ai.mobs.AbstractEntityMinecoloniesMob;
Expand Down Expand Up @@ -583,7 +584,9 @@ public void onLivingUpdate()
if (getOffsetTicks() % TICKS_20 == 0)
{
final ItemStack hat = getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (LocalDate.now(Clock.systemDefaultZone()).getMonth() == Month.DECEMBER)
if (LocalDate.now(Clock.systemDefaultZone()).getMonth() == Month.DECEMBER
&& Configurations.gameplay.holidayFeatures
&& !(getCitizenJobHandler().getColonyJob() instanceof JobStudent))
{
if (hat.isEmpty())
{
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 8a68e22

Please sign in to comment.