Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix stuck builder
Fix messed up leg
Fix nametag render option for visitors
  • Loading branch information
Raycoms committed Nov 13, 2022
1 parent 194ebc6 commit ebe9a5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,10 @@ public static LayerDefinition createMesh()
.texOffs(88, 40).mirror().addBox(-4.0F, -0.6F, -2.3F, 7.0F, 3.0F, 4.0F, new CubeDeformation(0.252F)).mirror(false), PartPose.offsetAndRotation(-1.0F, 2.5F, -3.8F, -1.0472F, 0.0F, 0.0F));

PartDefinition Right_Leg = partdefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 32).addBox(-2.1F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.6F)), PartPose.offset(-1.9F, 12.0F, 0.0F));

PartDefinition Left_Leg = partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 48).addBox(-1.95F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.591F)), PartPose.offset(1.9F, 12.0F, 0.0F));
.texOffs(0, 32).addBox(-2.1F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.6F)), PartPose.offset(-1.9F, 12.0F, 0.0F));

PartDefinition Left_Leg = partdefinition.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(0, 48).addBox(-1.95F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.591F)), PartPose.offset(1.9F, 12.0F, 0.0F));
return LayerDefinition.create(meshdefinition, 128, 64);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ protected enum RequestStage
*/
protected BlockPos requestProgress = null;

/**
* Variable telling us if we already recalculated the list.
* We don't want to persist this anywhere on purpose.
*/
private boolean recalculated = false;

/**
* Initialize the builder and add all his tasks.
*
Expand Down Expand Up @@ -197,7 +203,7 @@ private void requestMaterialsState()
@Override
protected IAIState waitForRequests()
{
if (job.hasWorkOrder() && building.getNeededResources().isEmpty())
if (job.hasWorkOrder() && building.getNeededResources().isEmpty() && !recalculated)
{
return START_BUILDING;
}
Expand Down Expand Up @@ -293,10 +299,12 @@ public boolean requestMaterials()
{
requestState = RequestStage.SOLID;
requestProgress = null;
recalculated = true;
return true;
}
return false;
default:
recalculated = true;
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,9 @@ public void setFleeingState(final boolean fleeing)
currentlyFleeing = fleeing;
}

@javax.annotation.Nullable
@Nullable
@Override
public AbstractContainerMenu createMenu(
final int id, final Inventory playerInventory, final Player playerEntity)
public AbstractContainerMenu createMenu(final int id, final Inventory playerInventory, final Player playerEntity)
{
return new ContainerCitizenInventory(id, playerInventory, citizenColonyHandler.getColonyId(), citizenId);
}
Expand Down Expand Up @@ -641,9 +640,6 @@ protected void defineSynchedData()
entityData.define(DATA_CITIZEN_ID, citizenId);
}

/**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons. use this to react to sunlight and start to burn.
*/
@Override
public void aiStep()
{
Expand All @@ -670,6 +666,10 @@ public void aiStep()
else
{
citizenColonyHandler.registerWithColony(citizenColonyHandler.getColonyId(), citizenId);
if (tickCount % 500 == 0)
{
this.setCustomNameVisible(MineColonies.getConfig().getServer().alwaysRenderNameTag.get());
}
}
}

Expand Down Expand Up @@ -741,28 +741,6 @@ protected void dropEquipment()
}
}

// TODO:REMOVE DEBUG
@Override
public void setPos(final double x, final double y, final double z)
{
super.setPos(x, y, z);
if (level.isClientSide)
{
return;
}

if (citizenStatusHandler != null && x < 1 && x > -1 && z < 1 && z > -1)
{
Log.getLogger().error("Visitor entity set to zero pos, report to mod author:", new Exception());
remove(RemovalReason.DISCARDED);

if (getCitizenData() != null && citizenColonyHandler.getColony() != null)
{
citizenColonyHandler.getColony().getVisitorManager().removeCivilian(getCitizenData());
}
}
}

@Override
public void queueSound(final @NotNull SoundEvent soundEvent, final BlockPos pos, final int length, final int repetitions)
{
Expand Down

0 comments on commit ebe9a5c

Please sign in to comment.